Fixed a keylisting bug
This commit is contained in:
parent
0bc8c1c7e1
commit
b4eddd3042
2
NEWS
2
NEWS
@ -10,7 +10,7 @@ Noteworthy changes in version 0.2.3 (2001-09-17)
|
||||
|
||||
* Added a simple encryption component for MS-Windows; however the
|
||||
build procedure might have some problems.
|
||||
o
|
||||
|
||||
Noteworthy changes in version 0.2.2 (2001-06-12)
|
||||
------------------------------------------------
|
||||
|
||||
|
@ -31,7 +31,7 @@ AM_MAINTAINER_MODE
|
||||
# AGE, set REVISION to 0.
|
||||
# 3. Interfaces removed (BAD, breaks upward compatibility): Increment
|
||||
# CURRENT, set AGE and REVISION to 0.
|
||||
AM_INIT_AUTOMAKE(gpgme,0.2.3)
|
||||
AM_INIT_AUTOMAKE(gpgme,0.2.3a)
|
||||
#
|
||||
LIBGPGME_LT_CURRENT=4
|
||||
LIBGPGME_LT_AGE=4
|
||||
|
@ -1,3 +1,11 @@
|
||||
2001-09-17 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* keylist.c (finish_key): Shortcut for no tmp_key. Changed all
|
||||
callers to use this function without a check for tmp_key.
|
||||
|
||||
* keylist.c (gpgme_op_keylist_next): Reset the key_cond after
|
||||
emptying the queue. Bug reported by Rick van Rein.
|
||||
|
||||
2001-09-12 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* data.c (gpgme_data_rewind): Allow rewind for callbacks.
|
||||
|
@ -88,7 +88,7 @@ typedef enum {
|
||||
GPGME_No_Passphrase = 19,
|
||||
GPGME_Canceled = 20,
|
||||
GPGME_Invalid_Key = 21,
|
||||
GPGME_Invalid_Engine = 22,
|
||||
GPGME_Invalid_Engine = 22
|
||||
} GpgmeError;
|
||||
|
||||
typedef enum {
|
||||
|
@ -44,7 +44,6 @@ keylist_status_handler ( GpgmeCtx ctx, GpgStatusCode code, char *args )
|
||||
|
||||
switch (code) {
|
||||
case STATUS_EOF:
|
||||
if (ctx->tmp_key)
|
||||
finish_key (ctx);
|
||||
break;
|
||||
|
||||
@ -157,7 +156,6 @@ keylist_colon_handler ( GpgmeCtx ctx, char *line )
|
||||
if ( ctx->out_of_core )
|
||||
return;
|
||||
if (!line) { /* EOF */
|
||||
if (ctx->tmp_key)
|
||||
finish_key (ctx);
|
||||
return;
|
||||
}
|
||||
@ -198,7 +196,6 @@ keylist_colon_handler ( GpgmeCtx ctx, char *line )
|
||||
return;
|
||||
}
|
||||
rectype = RT_PUB;
|
||||
if ( ctx->tmp_key )
|
||||
finish_key ( ctx );
|
||||
assert ( !ctx->tmp_key );
|
||||
ctx->tmp_key = key;
|
||||
@ -210,7 +207,6 @@ keylist_colon_handler ( GpgmeCtx ctx, char *line )
|
||||
return;
|
||||
}
|
||||
rectype = RT_SEC;
|
||||
if ( ctx->tmp_key )
|
||||
finish_key ( ctx );
|
||||
assert ( !ctx->tmp_key );
|
||||
ctx->tmp_key = key;
|
||||
@ -345,7 +341,7 @@ finish_key ( GpgmeCtx ctx )
|
||||
GpgmeKey key = ctx->tmp_key;
|
||||
struct key_queue_item_s *q, *q2;
|
||||
|
||||
assert (key);
|
||||
if (key) {
|
||||
ctx->tmp_key = NULL;
|
||||
|
||||
_gpgme_key_cache_add (key);
|
||||
@ -368,6 +364,7 @@ finish_key ( GpgmeCtx ctx )
|
||||
}
|
||||
ctx->key_cond = 1;
|
||||
/* fixme: unlock queue */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -482,6 +479,8 @@ gpgme_op_keylist_next ( GpgmeCtx c, GpgmeKey *r_key )
|
||||
}
|
||||
q = c->key_queue;
|
||||
c->key_queue = q->next;
|
||||
if (!c->key_queue)
|
||||
c->key_cond = 0;
|
||||
|
||||
*r_key = q->key;
|
||||
xfree (q);
|
||||
|
@ -139,7 +139,7 @@ _gpgme_remove_proc_from_wait_queue ( int pid )
|
||||
* @hang:
|
||||
*
|
||||
* Wait for a finished request, if @c is given the function does only
|
||||
* wait on a finsihed request for that context, otherwise it will return
|
||||
* wait on a finished request for that context, otherwise it will return
|
||||
* on any request. When @hang is true the function will wait, otherwise
|
||||
* it will return immediately when there is no pending finished request.
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user