2003-05-27 Marcus Brinkmann <marcus@g10code.de>

* gpg/Makefile.am (TESTS): Order t-keylist and t-keylist-sig after
	t-import.
	* gpg/t-edit.c (edit_fnc): Work around gpg 1.2.2 bug by resetting
	primary uid after setting expiration date.
	* gpg/t-keylist.c: Change order of user IDs.
	* gpg/t-keylist-sig.c: Likewise.
	* gpg/t-import.c: Add support for gpg in CVS.
This commit is contained in:
Marcus Brinkmann 2003-05-27 05:07:19 +00:00
parent 0a1940070d
commit 0be6fec1e2
6 changed files with 92 additions and 27 deletions

View File

@ -1,3 +1,13 @@
2003-05-27 Marcus Brinkmann <marcus@g10code.de>
* gpg/Makefile.am (TESTS): Order t-keylist and t-keylist-sig after
t-import.
* gpg/t-edit.c (edit_fnc): Work around gpg 1.2.2 bug by resetting
primary uid after setting expiration date.
* gpg/t-keylist.c: Change order of user IDs.
* gpg/t-keylist-sig.c: Likewise.
* gpg/t-import.c: Add support for gpg in CVS.
2003-05-27 Marcus Brinkmann <marcus@g10code.de>
* t-data.c: Remove TEST_OUT_CB.

View File

@ -23,9 +23,11 @@ GPG = @GPG@
TESTS_ENVIRONMENT = GNUPGHOME=. GPG_AGENT_INFO=
# The keylist test must come after the import test.
TESTS = t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \
t-decrypt t-verify t-decrypt-verify t-keylist t-keylist-sig \
t-export t-import t-trustlist t-eventloop t-edit
t-decrypt t-verify t-decrypt-verify \
t-export t-import t-trustlist t-eventloop t-edit \
t-keylist t-keylist-sig
CLEANFILES = secring.gpg pubring.gpg trustdb.gpg
DISTCLEANFILES = pubring.gpg~ random_seed

View File

@ -92,6 +92,17 @@ edit_fnc (void *opaque, gpgme_status_code_t status, const char *args, int fd)
case 1:
result = "expire";
break;
/* Work around a bug in GPG 1.2.2, which causes the
primary UID to change when setting the expiration
date. */
case 2:
result = "1";
break;
case 3:
result = "primary";
break;
default:
result = "quit";
break;

View File

@ -105,7 +105,10 @@ check_result (gpgme_import_result_t result, char *fpr, int secret)
result->new_sub_keys);
exit (1);
}
if (result->new_signatures != 0)
if ((secret
&& ((result->secret_imported == 0 && result->new_signatures != 0)
|| (result->secret_imported == 1 && result->new_signatures != 1)))
|| (!secret && result->new_signatures != 0))
{
fprintf (stderr, "Unexpected number of new signatures %i\n",
result->new_signatures);
@ -146,38 +149,77 @@ check_result (gpgme_import_result_t result, char *fpr, int secret)
result->not_imported);
exit (1);
}
if (secret)
{
if (!result->imports
|| (result->imports->next && result->imports->next->next))
{
fprintf (stderr, "Unexpected number of status reports\n");
exit (1);
}
}
else
{
if (!result->imports || result->imports->next)
{
fprintf (stderr, "Unexpected number of status reports\n");
exit (1);
}
}
if (strcmp (fpr, result->imports->fpr))
{
fprintf (stderr, "Unexpected fingerprint %s\n",
result->imports->fpr);
exit (1);
}
if (result->imports->next && strcmp (fpr, result->imports->next->fpr))
{
fprintf (stderr, "Unexpected fingerprint on second status %s\n",
result->imports->next->fpr);
exit (1);
}
if (result->imports->result != 0)
{
fprintf (stderr, "Unexpected status result %s\n",
gpgme_strerror (result->imports->result));
exit (1);
}
if ((secret
&& ((result->secret_imported == 0
&& result->imports->status != GPGME_IMPORT_SECRET)
|| (result->secret_imported == 1
&& result->imports->status != (GPGME_IMPORT_SECRET | GPGME_IMPORT_NEW))))
|| (!secret
&& ((result->imported == 0 && result->imports->status != 0)
|| (result->imported == 1
&& result->imports->status != GPGME_IMPORT_NEW))))
if (secret)
{
if (result->secret_imported == 0)
{
if (result->imports->status != GPGME_IMPORT_SECRET)
{
fprintf (stderr, "Unexpected status %i\n",
result->imports->status);
exit (1);
}
}
else
{
if (result->imports->status
!= (GPGME_IMPORT_SECRET | GPGME_IMPORT_NEW)
|| !result->imports->next
|| result->imports->next->status != GPGME_IMPORT_SIG)
{
fprintf (stderr, "Unexpected status %i\n",
result->imports->status);
exit (1);
}
}
}
else
{
if ((result->imported == 0 && result->imports->status != 0)
|| (result->imported == 1
&& result->imports->status != GPGME_IMPORT_NEW))
{
fprintf (stderr, "Unexpected status %i\n",
result->imports->status);
exit (1);
}
}
}
int

View File

@ -62,15 +62,15 @@ struct
keys[] =
{
{ "A0FF4590BB6122EDEF6E3C542D727CC768697734", "6AE6D7EE46A871F8",
{ { "Alpha Test", "demo key", "alpha@example.net",
{ { "Alfa Test", "demo key", "alfa@example.net",
{ GPGME_PK_DSA, "2D727CC768697734",
"Alpha Test", "demo key", "alpha@example.net", 19, 1 } },
"Alfa Test", "demo key", "alfa@example.net", 19, 1 } },
{ "Alpha Test", "demo key", "alpha@example.net",
{ GPGME_PK_DSA, "2D727CC768697734",
"Alfa Test", "demo key", "alfa@example.net", 19, 1 } },
{ "Alice", "demo key", NULL,
{ GPGME_PK_DSA, "2D727CC768697734",
"Alpha Test", "demo key", "alpha@example.net", 19, 1 } },
{ "Alfa Test", "demo key", "alfa@example.net",
{ GPGME_PK_DSA, "2D727CC768697734",
"Alpha Test", "demo key", "alpha@example.net", 19, 1 } } } },
"Alfa Test", "demo key", "alfa@example.net", 19, 1 } } } },
{ NULL }
};

View File

@ -52,9 +52,9 @@ struct
keys[] =
{
{ "A0FF4590BB6122EDEF6E3C542D727CC768697734", "6AE6D7EE46A871F8",
{ { "Alpha Test", "demo key", "alpha@example.net" },
{ "Alice", "demo key", NULL },
{ "Alfa Test", "demo key", "alfa@example.net" } } },
{ { "Alfa Test", "demo key", "alfa@example.net" },
{ "Alpha Test", "demo key", "alpha@example.net" },
{ "Alice", "demo key", NULL } } },
{ "61EE841A2A27EB983B3B3C26413F4AF31AFDAB6C", "E71E72ACBC43DA60",
{ { "Charlie Test", "demo key", "charlie@example.net" } } },
{ "3531152DE293E26A07F504BC318C1FAEFAEF6D1B", "B5C79E1A7272144D",