summaryrefslogtreecommitdiff
path: root/debian/patches/28_multiple_message.dpatch
diff options
context:
space:
mode:
authorKibum Kim <kb0929.kim@samsung.com>2012-01-07 00:46:38 +0900
committerKibum Kim <kb0929.kim@samsung.com>2012-01-07 00:46:38 +0900
commitf5660c6460a863b19f9ef745575780e37cc192a9 (patch)
tree0b478679da32d706de7b0de546d2e4daf03b160c /debian/patches/28_multiple_message.dpatch
parent06b9124a4f9d38acc78e6af686bc49a06f6354f8 (diff)
downloadgnupg-f5660c6460a863b19f9ef745575780e37cc192a9.tar.gz
gnupg-f5660c6460a863b19f9ef745575780e37cc192a9.tar.bz2
gnupg-f5660c6460a863b19f9ef745575780e37cc192a9.zip
Diffstat (limited to 'debian/patches/28_multiple_message.dpatch')
-rw-r--r--debian/patches/28_multiple_message.dpatch192
1 files changed, 192 insertions, 0 deletions
diff --git a/debian/patches/28_multiple_message.dpatch b/debian/patches/28_multiple_message.dpatch
new file mode 100644
index 0000000..e882d48
--- /dev/null
+++ b/debian/patches/28_multiple_message.dpatch
@@ -0,0 +1,192 @@
+#! /bin/sh -e
+## 28_multiple_message.dpatch
+##
+## DP: Description: Fix problems handling multiple messages [CVE-2007-1263]
+## DP: Author: Werner Koch <wk@gnupg.org>
+## DP: Upstream status: part of 1.4.7
+## DP: Date: 2007-03-07
+
+if [ $# -lt 1 ]; then
+ echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+ exit 1
+fi
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"
+
+case "$1" in
+ -patch) patch -p1 ${patch_opts} < $0;;
+ -unpatch) patch -R -p1 ${patch_opts} < $0;;
+ *)
+ echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
+ exit 1;;
+esac
+
+exit 0
+
+@DPATCH@
+diff -urNad gnupg-1.4.6~/checks/verify.test gnupg-1.4.6/checks/verify.test
+--- gnupg-1.4.6~/checks/verify.test 2006-03-07 10:28:24.000000000 +0000
++++ gnupg-1.4.6/checks/verify.test 2007-03-07 21:39:20.000000000 +0000
+@@ -231,15 +231,15 @@
+ eval "(IFS=; echo \"\$$i\")" >x
+ case "$i" in
+ msg_*_asc)
+- $GPG --verify x || error "verify of $i failed"
++ $GPG --allow-multiple-messages --verify x || error "verify of $i failed"
+ ;;
+ msg_*_asc_multisig)
+- $GPG --verify --allow-multisig-verification x \
++ $GPG --allow-multiple-messages --verify --allow-multisig-verification x \
+ || error "verify of $i failed"
+- $GPG --verify x && error "verify of $i succeeded but should not"
++ $GPG --allow-multiple-messages --verify x && error "verify of $i succeeded but should not"
+ ;;
+ bad_*_asc)
+- $GPG --verify x && error "verify of $i succeeded but should not"
++ $GPG --allow-multiple-messages --verify x && error "verify of $i succeeded but should not"
+ ;;
+ *)
+ error "No handler for test case $i"
+diff -urNad gnupg-1.4.6~/g10/gpg.c gnupg-1.4.6/g10/gpg.c
+--- gnupg-1.4.6~/g10/gpg.c 2007-03-07 21:38:57.000000000 +0000
++++ gnupg-1.4.6/g10/gpg.c 2007-03-07 21:39:20.000000000 +0000
+@@ -368,6 +368,8 @@
+ oAllowMultisigVerification,
+ oEnableDSA2,
+ oDisableDSA2,
++ oAllowMultipleMessages,
++ oNoAllowMultipleMessages,
+
+ oNoop
+ };
+@@ -711,6 +713,8 @@
+ { oAllowMultisigVerification, "allow-multisig-verification", 0, "@"},
+ { oEnableDSA2, "enable-dsa2", 0, "@"},
+ { oDisableDSA2, "disable-dsa2", 0, "@"},
++ { oAllowMultipleMessages, "allow-multiple-messages", 0, "@"},
++ { oNoAllowMultipleMessages, "no-allow-multiple-messages", 0, "@"},
+
+ /* These two are aliases to help users of the PGP command line
+ product use gpg with minimal pain. Many commands are common
+@@ -2782,6 +2786,14 @@
+ case oEnableDSA2: opt.flags.dsa2=1; break;
+ case oDisableDSA2: opt.flags.dsa2=0; break;
+
++ case oAllowMultipleMessages:
++ opt.flags.allow_multiple_messages=1;
++ break;
++
++ case oNoAllowMultipleMessages:
++ opt.flags.allow_multiple_messages=0;
++ break;
++
+ case oNoop: break;
+
+ default : pargs.err = configfp? 1:2; break;
+diff -urNad gnupg-1.4.6~/g10/mainproc.c gnupg-1.4.6/g10/mainproc.c
+--- gnupg-1.4.6~/g10/mainproc.c 2006-04-08 01:51:28.000000000 +0100
++++ gnupg-1.4.6/g10/mainproc.c 2007-03-07 21:39:20.000000000 +0000
+@@ -84,10 +84,9 @@
+
+
+ static int do_proc_packets( CTX c, IOBUF a );
+-
+ static void list_node( CTX c, KBNODE node );
+ static void proc_tree( CTX c, KBNODE node );
+-
++static int literals_seen;
+
+ static void
+ release_list( CTX c )
+@@ -619,6 +618,8 @@
+ int any, clearsig, only_md5, rc;
+ KBNODE n;
+
++ literals_seen++;
++
+ if( pt->namelen == 8 && !memcmp( pt->name, "_CONSOLE", 8 ) )
+ log_info(_("NOTE: sender requested \"for-your-eyes-only\"\n"));
+ else if( opt.verbose )
+@@ -702,16 +703,37 @@
+ if ( c->mfx.md2 )
+ md_start_debug( c->mfx.md2, "verify2" );
+ }
+- if ( c->pipemode.op == 'B' )
+- rc = handle_plaintext( pt, &c->mfx, 1, 0 );
+- else {
+- rc = handle_plaintext( pt, &c->mfx, c->sigs_only, clearsig );
+- if( rc == G10ERR_CREATE_FILE && !c->sigs_only) {
+- /* can't write output but we hash it anyway to
+- * check the signature */
+- rc = handle_plaintext( pt, &c->mfx, 1, clearsig );
+- }
+- }
++
++ rc=0;
++
++ if(literals_seen>1)
++ {
++ log_info(_("WARNING: multiple plaintexts seen\n"));
++
++ if(!opt.flags.allow_multiple_messages)
++ {
++ write_status_text (STATUS_ERROR, "proc_pkt.plaintext 89_BAD_DATA");
++ log_inc_errorcount();
++ rc=G10ERR_UNEXPECTED;
++ }
++ }
++
++ if(!rc)
++ {
++ if ( c->pipemode.op == 'B' )
++ rc = handle_plaintext( pt, &c->mfx, 1, 0 );
++ else
++ {
++ rc = handle_plaintext( pt, &c->mfx, c->sigs_only, clearsig );
++ if( rc == G10ERR_CREATE_FILE && !c->sigs_only)
++ {
++ /* can't write output but we hash it anyway to
++ * check the signature */
++ rc = handle_plaintext( pt, &c->mfx, 1, clearsig );
++ }
++ }
++ }
++
+ if( rc )
+ log_error( "handle plaintext failed: %s\n", g10_errstr(rc));
+ free_packet(pkt);
+diff -urNad gnupg-1.4.6~/g10/options.h gnupg-1.4.6/g10/options.h
+--- gnupg-1.4.6~/g10/options.h 2006-12-03 15:37:45.000000000 +0000
++++ gnupg-1.4.6/g10/options.h 2007-03-07 21:39:20.000000000 +0000
+@@ -226,6 +226,7 @@
+ unsigned int use_embedded_filename:1;
+ unsigned int utf8_filename:1;
+ unsigned int dsa2:1;
++ unsigned int allow_multiple_messages:1;
+ } flags;
+
+ /* Linked list of ways to find a key if the key isn't on the local
+diff -urNad gnupg-1.4.6~/g10/status.c gnupg-1.4.6/g10/status.c
+--- gnupg-1.4.6~/g10/status.c 2007-03-07 21:38:57.000000000 +0000
++++ gnupg-1.4.6/g10/status.c 2007-03-07 21:39:20.000000000 +0000
+@@ -166,6 +166,7 @@
+ case STATUS_PKA_TRUST_BAD : s = "PKA_TRUST_BAD"; break;
+ case STATUS_PKA_TRUST_GOOD : s = "PKA_TRUST_GOOD"; break;
+ case STATUS_BEGIN_SIGNING : s = "BEGIN_SIGNING"; break;
++ case STATUS_ERROR : s = "ERROR"; break;
+ default: s = "?"; break;
+ }
+ return s;
+diff -urNad gnupg-1.4.6~/g10/status.h gnupg-1.4.6/g10/status.h
+--- gnupg-1.4.6~/g10/status.h 2006-04-03 09:05:24.000000000 +0100
++++ gnupg-1.4.6/g10/status.h 2007-03-07 21:39:20.000000000 +0000
+@@ -120,6 +120,8 @@
+
+ #define STATUS_BEGIN_SIGNING 84
+
++#define STATUS_ERROR 85
++
+
+ /*-- status.c --*/
+ void set_status_fd ( int fd );