diff options
| author | Werner Koch <[email protected]> | 2001-09-17 10:36:05 +0000 | 
|---|---|---|
| committer | Werner Koch <[email protected]> | 2001-09-17 10:36:05 +0000 | 
| commit | b4eddd304269da30d29fc1a272237e706773ea2e (patch) | |
| tree | e66cf7df026dc614793f3b56a2a5786e408359b6 /tests | |
| parent | Added more doc entries and prepared for 0.2.3 (diff) | |
| download | gpgme-b4eddd304269da30d29fc1a272237e706773ea2e.tar.gz gpgme-b4eddd304269da30d29fc1a272237e706773ea2e.zip | |
Fixed a keylisting bug
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/t-keylist.c | 33 | 
1 files changed, 33 insertions, 0 deletions
| diff --git a/tests/t-keylist.c b/tests/t-keylist.c index aa82a5b6..9a81c120 100644 --- a/tests/t-keylist.c +++ b/tests/t-keylist.c @@ -94,6 +94,34 @@ doit ( GpgmeCtx ctx, const char *pattern )  } +/*  + * Check that there are no problems when we are using two context for + * listing keys.  + */ +static void +check_two_contexts (void) +{ +    GpgmeError err; +    GpgmeCtx ctx1, ctx2; +    GpgmeKey key; +	 +    err = gpgme_new(&ctx1); fail_if_err (err); +    err = gpgme_op_keylist_start(ctx1, "", 1); fail_if_err (err); +    err = gpgme_new(&ctx2); fail_if_err (err); +    err = gpgme_op_keylist_start(ctx2, "", 1); fail_if_err (err); + +    while ( (err=gpgme_op_keylist_next(ctx2, &key)) != GPGME_EOF) { +        gpgme_key_release (key); +    } +    if (err != GPGME_EOF) +        fail_if_err (err); +    while ( (err=gpgme_op_keylist_next(ctx1, &key)) != GPGME_EOF) { +        gpgme_key_release (key); +    } +    if (err != GPGME_EOF) +        fail_if_err (err); +} +  int   main (int argc, char **argv )  { @@ -112,6 +140,9 @@ main (int argc, char **argv )      }      pattern = argc? *argv : NULL; +    err = gpgme_check_engine(); +    fail_if_err (err); +      err = gpgme_new (&ctx);      fail_if_err (err);      gpgme_set_keylist_mode (ctx, 1); /* no validity calculation */ @@ -121,6 +152,8 @@ main (int argc, char **argv )      } while ( loop );      gpgme_release (ctx); +    check_two_contexts (); +      return 0;  } | 
