* 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)
------------------------------------------------
# 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
+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.
GPGME_No_Passphrase = 19,
GPGME_Canceled = 20,
GPGME_Invalid_Key = 21,
- GPGME_Invalid_Engine = 22,
+ GPGME_Invalid_Engine = 22
} GpgmeError;
typedef enum {
switch (code) {
case STATUS_EOF:
- if (ctx->tmp_key)
- finish_key (ctx);
+ finish_key (ctx);
break;
default:
if ( ctx->out_of_core )
return;
if (!line) { /* EOF */
- if (ctx->tmp_key)
- finish_key (ctx);
+ finish_key (ctx);
return;
}
return;
}
rectype = RT_PUB;
- if ( ctx->tmp_key )
- finish_key ( ctx );
+ finish_key ( ctx );
assert ( !ctx->tmp_key );
ctx->tmp_key = key;
}
return;
}
rectype = RT_SEC;
- if ( ctx->tmp_key )
- finish_key ( ctx );
+ finish_key ( ctx );
assert ( !ctx->tmp_key );
ctx->tmp_key = key;
}
GpgmeKey key = ctx->tmp_key;
struct key_queue_item_s *q, *q2;
- assert (key);
- ctx->tmp_key = NULL;
-
- _gpgme_key_cache_add (key);
-
- q = xtrymalloc ( sizeof *q );
- if ( !q ) {
- gpgme_key_release (key);
- ctx->out_of_core = 1;
- return;
- }
- q->key = key;
- q->next = NULL;
- /* fixme: lock queue. Use a tail pointer? */
- if ( !(q2 = ctx->key_queue) )
- ctx->key_queue = q;
- else {
- for ( ; q2->next; q2 = q2->next )
- ;
- q2->next = q;
+ if (key) {
+ ctx->tmp_key = NULL;
+
+ _gpgme_key_cache_add (key);
+
+ q = xtrymalloc ( sizeof *q );
+ if ( !q ) {
+ gpgme_key_release (key);
+ ctx->out_of_core = 1;
+ return;
+ }
+ q->key = key;
+ q->next = NULL;
+ /* fixme: lock queue. Use a tail pointer? */
+ if ( !(q2 = ctx->key_queue) )
+ ctx->key_queue = q;
+ else {
+ for ( ; q2->next; q2 = q2->next )
+ ;
+ q2->next = q;
+ }
+ ctx->key_cond = 1;
+ /* fixme: unlock queue */
}
- ctx->key_cond = 1;
- /* fixme: unlock queue */
}
}
q = c->key_queue;
c->key_queue = q->next;
+ if (!c->key_queue)
+ c->key_cond = 0;
*r_key = q->key;
xfree (q);
* @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.
*
}
+/*
+ * 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 )
{
}
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 */
} while ( loop );
gpgme_release (ctx);
+ check_two_contexts ();
+
return 0;
}