X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=blobdiff_plain;f=src%2Fpassphrase.c;h=f88d1b9f24c098fb8029e57363ae5d5a01ae3391;hp=bf69340f79997200e4d942184e3bbf34f73bb006;hb=abbd7a7a3cc83056b2bf76322598698d0f1730e3;hpb=249bb0f0146e95523d80794f8502bbe346f32d0f diff --git a/src/passphrase.c b/src/passphrase.c index bf69340f7..f88d1b9f2 100644 --- a/src/passphrase.c +++ b/src/passphrase.c @@ -23,6 +23,7 @@ #if USE_GPGME #include +#include #include #include #include @@ -48,7 +49,7 @@ static int grab_all = 0; static gboolean pass_ack; -static gchar* lastPass = NULL; +static gchar *last_pass = NULL; static void passphrase_ok_cb(GtkWidget *widget, gpointer data); static void passphrase_cancel_cb(GtkWidget *widget, gpointer data); @@ -268,10 +269,10 @@ create_description (const gchar *desc) static int free_passphrase(gpointer _unused) { - if (lastPass != NULL) { - munlock(lastPass, strlen(lastPass)); - g_free(lastPass); - lastPass = NULL; // necessary? + if (last_pass != NULL) { + munlock(last_pass, strlen(last_pass)); + g_free(last_pass); + last_pass = NULL; g_message("%% passphrase removed"); } @@ -279,7 +280,7 @@ static int free_passphrase(gpointer _unused) } const char* -gpgmegtk_passphrase_cb (void *opaque, const char *desc, void *r_hd) +gpgmegtk_passphrase_cb (void *opaque, const char *desc, void **r_hd) { struct passphrase_cb_info_s *info = opaque; GpgmeCtx ctx = info ? info->c : NULL; @@ -289,9 +290,9 @@ gpgmegtk_passphrase_cb (void *opaque, const char *desc, void *r_hd) /* FIXME: cleanup by looking at *r_hd */ return NULL; } - if (prefs_common.store_passphrase - && strncmp(desc, "TRY_AGAIN", 9) && (lastPass != NULL)) - return g_strdup(lastPass); + if (prefs_common.store_passphrase && last_pass != NULL && + strncmp(desc, "TRY_AGAIN", 9) != 0) + return g_strdup(last_pass); gpgmegtk_set_passphrase_grab (prefs_common.passphrase_grab); g_message ("%% requesting passphrase for `%s': ", desc ); @@ -303,8 +304,8 @@ gpgmegtk_passphrase_cb (void *opaque, const char *desc, void *r_hd) } else { if (prefs_common.store_passphrase) { - lastPass = g_strdup(pass); - if (mlock(lastPass, strlen(lastPass)) == -1) + last_pass = g_strdup(pass); + if (mlock(last_pass, strlen(last_pass)) == -1) g_message("%% locking passphrase failed"); if (prefs_common.store_passphrase_timeout > 0) {