[Gpa-commits] r784 - in trunk: . src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Sep 28 19:50:01 CEST 2007
Author: werner
Date: 2007-09-28 19:50:00 +0200 (Fri, 28 Sep 2007)
New Revision: 784
Modified:
trunk/autogen.sh
trunk/src/ChangeLog
trunk/src/gpa.c
trunk/src/gpacontext.c
trunk/src/gpakeyselector.c
trunk/src/gpgmetools.c
trunk/src/keytable.c
trunk/src/options.c
trunk/src/server.c
Log:
A couple of fixes for the CMS server..
BEWARE: OpenPGP Support is currently disabled.
Modified: trunk/autogen.sh
===================================================================
--- trunk/autogen.sh 2007-09-27 13:42:53 UTC (rev 783)
+++ trunk/autogen.sh 2007-09-28 17:50:00 UTC (rev 784)
@@ -85,7 +85,7 @@
--with-gpgme-prefix=${w32root} \
--with-lib-prefix=${w32root} \
--with-libiconv-prefix=${w32root} \
- PKG_CONFIG_LIBDIR="$w32root/lib/pkgconfig"
+ PKG_CONFIG_LIBDIR="$w32root/lib/pkgconfig" "$@"
rc=$?
exit $rc
fi
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2007-09-27 13:42:53 UTC (rev 783)
+++ trunk/src/ChangeLog 2007-09-28 17:50:00 UTC (rev 784)
@@ -1,3 +1,8 @@
+2007-09-28 Werner Koch <wk at g10code.com>
+
+ * gpakeyselector.c (gpa_key_selector_next_key): Don't segv is not
+ a default key is missing.
+
2007-09-27 Werner Koch <wk at g10code.com>
* server.c: New.
Modified: trunk/src/gpa.c
===================================================================
--- trunk/src/gpa.c 2007-09-27 13:42:53 UTC (rev 783)
+++ trunk/src/gpa.c 2007-09-28 17:50:00 UTC (rev 784)
@@ -544,13 +544,13 @@
/* Now, make sure there are reasonable defaults for the default key and
* keyserver */
- gpa_options_update_default_key (gpa_options_get_instance ());
- if (!gpa_options_get_default_keyserver (gpa_options_get_instance ()))
- {
- GList *keyservers = keyserver_get_as_glist ();
- gpa_options_set_default_keyserver (gpa_options_get_instance (),
- keyservers->data);
- }
+/* gpa_options_update_default_key (gpa_options_get_instance ()); */
+/* if (!gpa_options_get_default_keyserver (gpa_options_get_instance ())) */
+/* { */
+/* GList *keyservers = keyserver_get_as_glist (); */
+/* gpa_options_set_default_keyserver (gpa_options_get_instance (), */
+/* keyservers->data); */
+/* } */
#ifndef G_OS_WIN32
/* Internationalisation with gtk+-2.0 wants UTF8 instead of the
Modified: trunk/src/gpacontext.c
===================================================================
--- trunk/src/gpacontext.c 2007-09-27 13:42:53 UTC (rev 783)
+++ trunk/src/gpacontext.c 2007-09-28 17:50:00 UTC (rev 784)
@@ -167,6 +167,7 @@
{
gpg_error_t err;
+ g_debug ("gpa_context_init: enter");
context->busy = FALSE;
/* The callback queue */
@@ -179,8 +180,6 @@
gpa_gpgme_warning (err);
return;
}
- gpgme_set_protocol (context->ctx, GPGME_PROTOCOL_CMS);
-
/* Set the appropriate callbacks. */
gpgme_set_passphrase_cb (context->ctx, gpa_context_passphrase_cb, context);
gpgme_set_progress_cb (context->ctx, gpa_context_progress_cb, context);
@@ -193,6 +192,8 @@
context->io_cbs->event_priv = context;
/* Set the callbacks */
gpgme_set_io_cbs (context->ctx, context->io_cbs);
+
+ gpgme_set_protocol (context->ctx, GPGME_PROTOCOL_CMS);
}
static void
@@ -279,6 +280,7 @@
#ifdef G_OS_WIN32
/* We have to ask GPGME for the GIOChannel to use. The "file
descriptor" may not be a system file descriptor. */
+ g_debug ("calling gpgme_get_fdptr (%d)", cb->fd);
channel = gpgme_get_giochannel (cb->fd);
g_assert (channel);
#else
@@ -307,8 +309,8 @@
context->cbs = g_list_append (context->cbs, cb);
}
-/* Register with GLib all previously unregistered callbacks.
- */
+
+/* Register with GLib all previously unregistered callbacks. */
static void
register_all_callbacks (GpaContext *context)
{
@@ -342,10 +344,11 @@
}
}
+
/* The real GPGME callbacks */
-/* Register a callback.
- */
+/* Register a callback. This is called by GPGME when a crypto
+ operation is initiated in this context. */
static gpg_error_t
gpa_context_register_cb (void *data, int fd, int dir, gpgme_io_cb_t fnc,
void *fnc_data, void **tag)
@@ -354,6 +357,7 @@
struct gpa_io_cb_data *cb = g_malloc (sizeof (struct gpa_io_cb_data));
+ g_debug ("gpa_context_register callback allocated tag %p", cb);
cb->registered = FALSE;
cb->fd = fd;
cb->dir = dir;
@@ -361,38 +365,41 @@
cb->fnc_data = fnc_data;
cb->context = context;
/* If the context is busy, we already have a START event, and can
- * register GLib callbacks freely.
- */
+ * register GLib callbacks immediately. */
if (context->busy)
{
register_callback (cb);
}
- /* In any case, we add it to the list.
- */
+ /* In any case, we add it to the list. */
add_callback (context, cb);
*tag = cb;
return gpg_error (GPG_ERR_NO_ERROR);
}
-/* Remove a callback.
- */
+
+/* Remove a callback. This is called by GPGME if a context is to be
+ destroyed. */
static void
gpa_context_remove_cb (void *tag)
{
struct gpa_io_cb_data *cb = tag;
+ g_debug ("gpa_context_remove callback for tag %p called", cb);
if (cb->registered)
{
+ g_debug (" really removed");
g_source_remove (cb->watch);
}
cb->context->cbs = g_list_remove (cb->context->cbs, cb);
g_free (cb);
}
-/* The event callback. This just emits signals for the GpaContext. The signal
- * handlers do the real job.
- */
+
+/* The event callback. It is called by GPGME to signal an event for
+ an operation running in this context. This fucntion merely mits
+ signals for GpaContext; the Glib signal handlers do the real
+ job. */
static void
gpa_context_event_cb (void *data, gpgme_event_io_t type, void *type_data)
{
@@ -431,15 +438,18 @@
static void
gpa_context_start (GpaContext *context)
{
+ g_debug ("gpgme event START enter");
context->busy = TRUE;
/* We have START, register all queued callbacks */
register_all_callbacks (context);
+ g_debug ("gpgme event START leave");
}
static void
gpa_context_done (GpaContext *context, gpg_error_t err)
{
context->busy = FALSE;
+ g_debug ("gpgme event DONE ready");
}
static void
Modified: trunk/src/gpakeyselector.c
===================================================================
--- trunk/src/gpakeyselector.c 2007-09-27 13:42:53 UTC (rev 783)
+++ trunk/src/gpakeyselector.c 2007-09-28 17:50:00 UTC (rev 784)
@@ -228,16 +228,21 @@
GPA_KEY_SELECTOR_COLUMN_USERID, userid,
GPA_KEY_SELECTOR_COLUMN_KEY, key, -1);
/* If this is a secret key selector, select the default key */
- if (selector->secret) {
- const gchar *key_fpr = key->subkeys->fpr;
- const gchar *default_key = gpa_options_get_default_key
- (gpa_options_get_instance())->subkeys[0].fpr;
+ if (selector->secret)
+ {
+ const char *key_fpr = key->subkeys->fpr;
+ gpgme_key_t akey;
+ const char *default_key;
+
+ akey = gpa_options_get_default_key (gpa_options_get_instance());
+ default_key = akey? akey->subkeys->fpr : NULL;
- if (g_str_equal (key_fpr, default_key)) {
- gtk_tree_selection_select_iter
- (gtk_tree_view_get_selection (GTK_TREE_VIEW (selector)),&iter);
+ if (default_key && g_str_equal (key_fpr, default_key))
+ {
+ gtk_tree_selection_select_iter
+ (gtk_tree_view_get_selection (GTK_TREE_VIEW (selector)),&iter);
+ }
}
- }
/* Clean up */
g_free (userid);
}
Modified: trunk/src/gpgmetools.c
===================================================================
--- trunk/src/gpgmetools.c 2007-09-27 13:42:53 UTC (rev 783)
+++ trunk/src/gpgmetools.c 2007-09-28 17:50:00 UTC (rev 784)
@@ -84,13 +84,13 @@
{
gpgme_ctx_t ctx;
gpg_error_t err;
-
+
+ g_assert (!"using gpa_gpgme_new");
err = gpgme_new (&ctx);
if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
{
gpa_gpgme_error (err);
}
- gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS);
gpgme_set_passphrase_cb (ctx, gpa_passphrase_cb, NULL);
return ctx;
Modified: trunk/src/keytable.c
===================================================================
--- trunk/src/keytable.c 2007-09-27 13:42:53 UTC (rev 783)
+++ trunk/src/keytable.c 2007-09-28 17:50:00 UTC (rev 784)
@@ -86,7 +86,6 @@
keytable->end = NULL;
keytable->data = NULL;
keytable->context = gpa_context_new ();
- gpgme_set_protocol (keytable->context->ctx, GPGME_PROTOCOL_CMS);
keytable->keys = NULL;
keytable->secret = FALSE;
keytable->initialized = FALSE;
Modified: trunk/src/options.c
===================================================================
--- trunk/src/options.c 2007-09-27 13:42:53 UTC (rev 783)
+++ trunk/src/options.c 2007-09-28 17:50:00 UTC (rev 784)
@@ -262,8 +262,10 @@
{
gpgme_key_t key = NULL;
gpg_error_t err;
- gpgme_ctx_t ctx = gpa_gpgme_new ();
+ gpgme_ctx_t ctx/* = gpa_gpgme_new ()*/;
+ return NULL;
+
err = gpgme_op_keylist_start (ctx, NULL, 1);
if (gpg_err_code (err) != GPG_ERR_NO_ERROR)
{
@@ -298,8 +300,10 @@
{
gboolean update = FALSE;
gpgme_key_t key = NULL;
- gpgme_ctx_t ctx = gpa_gpgme_new ();
+ gpgme_ctx_t ctx /*= gpa_gpgme_new ()*/;
+ return;
+
if (!options->default_key_fpr)
{
update = TRUE;
Modified: trunk/src/server.c
===================================================================
--- trunk/src/server.c 2007-09-27 13:42:53 UTC (rev 783)
+++ trunk/src/server.c 2007-09-28 17:50:00 UTC (rev 784)
@@ -445,6 +445,7 @@
g_free (socket_name);
return;
}
+ g_debug ("using server socket `%s'", socket_name);
#ifdef HAVE_W32_SYSTEM
fd = _w32_sock_new (AF_UNIX, SOCK_STREAM, 0);
More information about the Gpa-commits
mailing list