From: Werner Koch Date: Thu, 20 Jun 2002 13:47:24 +0000 (+0000) Subject: * gpgsm/t-sign.c (main): Also test a normal signature. X-Git-Tag: gpgme-0-3-8~13 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e6dc9fd6c4d00455975fc4bb6d98f31b3c36b517;p=gpgme.git * gpgsm/t-sign.c (main): Also test a normal signature. * gpg/Makefile (TESTS_ENVIRONMENT): Set GPG_AGENT_INFO empty. * gpg/t-signers.c, gpg/t-sign.c, gpg/t-encrypt-sym.c * gpg/t-encrypt-sign.c, gpg/t-decrypt.c * gpg/t-decrypt-verify.c (main): Changed the GPG_AGENT_INFO check to match the one in ../../gpgme/rungpg.c. --- diff --git a/tests/ChangeLog b/tests/ChangeLog index aea23e5..2222de1 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,13 @@ +2002-06-20 Werner Koch + + * gpgsm/t-sign.c (main): Also test a normal signature. + + * gpg/Makefile (TESTS_ENVIRONMENT): Set GPG_AGENT_INFO empty. + * gpg/t-signers.c, gpg/t-sign.c, gpg/t-encrypt-sym.c + * gpg/t-encrypt-sign.c, gpg/t-decrypt.c + * gpg/t-decrypt-verify.c (main): Changed the GPG_AGENT_INFO check to + match the one in ../../gpgme/rungpg.c. + 2002-06-12 Werner Koch * gpgsm/t-keylist.c (doit): Print operation info if available. diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am index 04c0d11..456d63d 100644 --- a/tests/gpg/Makefile.am +++ b/tests/gpg/Makefile.am @@ -21,7 +21,7 @@ GPG = @GPG@ -TESTS_ENVIRONMENT = GNUPGHOME=. +TESTS_ENVIRONMENT = GNUPGHOME=. GPG_AGENT_INFO= TESTS = t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \ t-decrypt t-verify t-decrypt-verify t-keylist t-export \ diff --git a/tests/gpg/t-decrypt-verify.c b/tests/gpg/t-decrypt-verify.c index bf407ee..0c85d1b 100644 --- a/tests/gpg/t-decrypt-verify.c +++ b/tests/gpg/t-decrypt-verify.c @@ -101,12 +101,15 @@ main (int argc, char **argv) struct passphrase_cb_info_s info; const char *cipher_2_asc = mk_fname ("cipher-2.asc"); GpgmeSigStat stat; + char *p; do { err = gpgme_new (&ctx); fail_if_err (err); - if (!getenv("GPG_AGENT_INFO")) + + p = getenv("GPG_AGENT_INFO"); + if (!(p && strchr (p, ':'))) { memset (&info, 0, sizeof info); info.c = ctx; diff --git a/tests/gpg/t-decrypt.c b/tests/gpg/t-decrypt.c index e6bc099..6b21d41 100644 --- a/tests/gpg/t-decrypt.c +++ b/tests/gpg/t-decrypt.c @@ -103,15 +103,19 @@ main (int argc, char **argv ) GpgmeData in, out, pwdata = NULL; struct passphrase_cb_info_s info; const char *cipher_1_asc = mk_fname ("cipher-1.asc"); + char *p; do { err = gpgme_new (&ctx); fail_if_err (err); - if ( !getenv("GPG_AGENT_INFO") ) { + + p = getenv("GPG_AGENT_INFO"); + if (!(p && strchr (p, ':'))) + { memset ( &info, 0, sizeof info ); info.c = ctx; gpgme_set_passphrase_cb ( ctx, passphrase_cb, &info ); - } + } err = gpgme_data_new_from_file ( &in, cipher_1_asc, 1 ); fail_if_err (err); diff --git a/tests/gpg/t-encrypt-sign.c b/tests/gpg/t-encrypt-sign.c index a4620d2..b92d74c 100644 --- a/tests/gpg/t-encrypt-sign.c +++ b/tests/gpg/t-encrypt-sign.c @@ -90,6 +90,7 @@ main (int argc, char **argv ) GpgmeError err; GpgmeData in, out; GpgmeRecipients rset; + char *p; err = gpgme_check_engine (); fail_if_err (err); @@ -99,7 +100,9 @@ main (int argc, char **argv ) err = gpgme_new (&ctx); fail_if_err (err); gpgme_set_armor (ctx, 1); - if (!getenv("GPG_AGENT_INFO")) + + p = getenv("GPG_AGENT_INFO"); + if (!(p && strchr (p, ':'))) gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL); err = gpgme_data_new_from_mem ( &in, "Hallo Leute\n", 12, 0 ); diff --git a/tests/gpg/t-encrypt-sym.c b/tests/gpg/t-encrypt-sym.c index 72672d3..6c765b8 100644 --- a/tests/gpg/t-encrypt-sym.c +++ b/tests/gpg/t-encrypt-sym.c @@ -76,6 +76,7 @@ main (int argc, char **argv) GpgmeData plain, cipher; const char *text = "Hallo Leute\n"; char *text2; + char *p; int i; err = gpgme_check_engine (); @@ -86,8 +87,10 @@ main (int argc, char **argv) err = gpgme_new (&ctx); fail_if_err (err); gpgme_set_armor (ctx, 1); - if (!getenv("GPG_AGENT_INFO")) - gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL); + + p = getenv("GPG_AGENT_INFO"); + if (!(p && strchr (p, ':'))) + gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL); err = gpgme_data_new_from_mem (&plain, text, strlen (text), 0); fail_if_err (err); diff --git a/tests/gpg/t-sign.c b/tests/gpg/t-sign.c index 28c34dc..0e5f5c3 100644 --- a/tests/gpg/t-sign.c +++ b/tests/gpg/t-sign.c @@ -87,13 +87,15 @@ main (int argc, char **argv ) GpgmeCtx ctx; GpgmeError err; GpgmeData in, out; + char *p; do { err = gpgme_new (&ctx); fail_if_err (err); - if ( !getenv("GPG_AGENT_INFO") ) { - gpgme_set_passphrase_cb ( ctx, passphrase_cb, NULL ); - } + + p = getenv("GPG_AGENT_INFO"); + if (!(p && strchr (p, ':'))) + gpgme_set_passphrase_cb ( ctx, passphrase_cb, NULL ); gpgme_set_textmode (ctx, 1); gpgme_set_armor (ctx, 1); diff --git a/tests/gpg/t-signers.c b/tests/gpg/t-signers.c index f3fa6f5..d0aa00b 100644 --- a/tests/gpg/t-signers.c +++ b/tests/gpg/t-signers.c @@ -86,6 +86,7 @@ main (int argc, char *argv[]) GpgmeError err; GpgmeData in, out; GpgmeKey key[2]; /* There are two secret keys in the test area. */ + char *p; err = gpgme_new (&ctx); fail_if_err (err); @@ -101,7 +102,9 @@ main (int argc, char *argv[]) { err = gpgme_new (&ctx); fail_if_err (err); - if (!getenv ("GPG_AGENT_INFO")) + + p = getenv("GPG_AGENT_INFO"); + if (!(p && strchr (p, ':'))) gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL); err = gpgme_signers_add (ctx, key[0]); fail_if_err (err); diff --git a/tests/gpgsm/t-sign.c b/tests/gpgsm/t-sign.c index fd656a9..5d54475 100644 --- a/tests/gpgsm/t-sign.c +++ b/tests/gpgsm/t-sign.c @@ -78,7 +78,6 @@ main (int argc, char **argv ) err = gpgme_data_new_from_mem ( &in, "Hallo Leute!\n", 13, 0 ); fail_if_err (err); -#if 0 /* first a normal signature */ err = gpgme_data_new ( &out ); fail_if_err (err); @@ -91,7 +90,6 @@ main (int argc, char **argv ) fputs ("End Result.\n", stdout ); gpgme_data_release (out); gpgme_data_rewind (in); -#endif /* now a detached signature */ err = gpgme_data_new ( &out ); @@ -106,21 +104,6 @@ main (int argc, char **argv ) gpgme_data_release (out); gpgme_data_rewind (in); - -#if 0 - /* And finally a cleartext signature */ - err = gpgme_data_new ( &out ); - fail_if_err (err); - err = gpgme_op_sign (ctx, in, out, GPGME_SIG_MODE_CLEAR ); - fail_if_err (err); - fflush (NULL); - print_op_info (ctx); - fputs ("Begin Result:\n", stdout ); - print_data (out); - fputs ("End Result.\n", stdout ); - gpgme_data_release (out); - gpgme_data_rewind (in); -#endif /* ready */ gpgme_data_release (in);