Patch gnupg_fix_14345.patch for gnupg Bug #58272
Patch version 2013-02-06 08:04 UTC
Return to Bug #58272 |
Download this patch
Patch Revisions:
Developer: kenny@kennynet.co.uk
diff -urN gnupg-1.3.1/gnupg.c gnupg-1.3.2/gnupg.c
--- gnupg-1.3.1/gnupg.c 2007-05-04 14:23:41.000000000 +0100
+++ gnupg-1.3.2/gnupg.c 2008-08-08 16:26:11.000000000 +0100
@@ -408,27 +408,36 @@
}
gpgme_error_t passphrase_decrypt_cb (gnupg_object *intern, const char *uid_hint, const char *passphrase_info,int last_was_bad, int fd TSRMLS_DC){
+ static int passphrase_found = 0;
char uid[16];
int idx;
char *passphrase = NULL;
zval *return_value = NULL;
-
- if(last_was_bad){
- GNUPG_ERR("Incorrent passphrase");
+
+ if(passphrase_found && last_was_bad){
+ GNUPG_ERR("Incorrent passphrase");
return 1;
}
+
for(idx=0;idx<16;idx++){
uid[idx] = uid_hint[idx];
}
uid[16] = '\0';
if(zend_hash_find(intern->decryptkeys,(char *) uid,17,(void **) &passphrase)==FAILURE){
- GNUPG_ERR("no passphrase set");
- return 1;
+ /* Don't return 1 here so we can contine on data encrypted to
+ * multiple keys. */
+ passphrase_found = 0;
+ write(fd, "\n", 1);
+ return 0;
}
+
if(!passphrase){
+ passphrase_found = 0;
GNUPG_ERR("no passphrase set");
return 1;
}
+
+ passphrase_found = 1;
write (fd, passphrase, strlen(passphrase));
write (fd, "\n", 1);
return 0;
|