From d87a3c14c47e16bba135c2af948b00670fea8c30 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 27 Nov 1998 14:33:31 +0000 Subject: [PATCH] See ChangeLog: Fri Nov 27 15:30:24 CET 1998 Werner Koch --- checks/ChangeLog | 4 ++++ checks/clearsig.test | 20 ++++++++++++++++++++ g10/ChangeLog | 4 ++++ g10/armor.c | 6 ++++-- g10/mainproc.c | 2 +- g10/sign.c | 1 + include/util.h | 1 + scripts/commit | 1 - util/argparse.c | 21 ++++++++++++++------- 9 files changed, 49 insertions(+), 11 deletions(-) diff --git a/checks/ChangeLog b/checks/ChangeLog index 3b87c65e6..83afdd699 100644 --- a/checks/ChangeLog +++ b/checks/ChangeLog @@ -1,3 +1,7 @@ +Fri Nov 27 15:30:24 CET 1998 Werner Koch + + * clearsig.test: Some more test cases. + Sun Oct 25 18:19:35 1998 Werner Koch (wk@isil.d.shuttle.de) * mds.test: Check whether TIGER is available. diff --git a/checks/clearsig.test b/checks/clearsig.test index 69c2544d7..29407e8bd 100755 --- a/checks/clearsig.test +++ b/checks/clearsig.test @@ -15,4 +15,24 @@ for i in $plain_files; do --rfc1991 --digest-algo md5 -sat -o x --yes $i $srcdir/run-gpg --verify x done +# and one with long lines +cat >y <y <y < + + * armor.c (find_header): Another fix for clearsigs. + Fri Nov 27 12:39:29 CET 1998 Werner Koch diff --git a/g10/armor.c b/g10/armor.c index 91eb55198..78656bae9 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -405,10 +405,11 @@ find_header( fhdr_state_t state, byte *buf, size_t *r_buflen, c = 0; for(n=0; n < buflen && (c=iobuf_get(a)) != -1 && c != '\n'; ) buf[n++] = c; - if( n < buflen || c == '\n' ) { - buf[n] = 0; + if( c != -1 ) { if( n > 15 && !memcmp(buf, "-----", 5 ) ) state = fhdrNullClearsig; + else if( c != '\n' ) + state = fhdrREADClearsigNext; else state = fhdrCHECKDashEscaped3; } @@ -693,6 +694,7 @@ check_input( armor_filter_context_t *afx, IOBUF a ) case fhdrNullClearsig: case fhdrCLEARSIG: /* start fake package mode (for clear signatures) */ + case fhdrREADClearsigNext: case fhdrCLEARSIGSimple: case fhdrCLEARSIGSimpleNext: afx->helplen = n; diff --git a/g10/mainproc.c b/g10/mainproc.c index aa903025f..559b057f8 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -278,7 +278,7 @@ proc_plaintext( CTX c, PACKET *pkt ) md_enable( c->mfx.md, DIGEST_ALGO_SHA1 ); md_enable( c->mfx.md, DIGEST_ALGO_MD5 ); } - + /*md_start_debug( c->mfx.md, "verify" );*/ 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 diff --git a/g10/sign.c b/g10/sign.c index 52f36f937..ffa72c0d7 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -608,6 +608,7 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile ) PKT_secret_key *sk = sk_rover->sk; md_enable(textmd, hash_for(sk->pubkey_algo)); } + /*md_start_debug( textmd, "create" );*/ if( !opt.not_dash_escaped ) iobuf_push_filter( inp, text_filter, &tfx ); rc = write_dash_escaped( inp, out, textmd ); diff --git a/include/util.h b/include/util.h index 03ac8edd4..fdea00350 100644 --- a/include/util.h +++ b/include/util.h @@ -46,6 +46,7 @@ typedef struct { int stopped; const char *last; void *aliases; + const void *cur_alias; } internal; /* DO NOT CHANGE */ } ARGPARSE_ARGS; diff --git a/scripts/commit b/scripts/commit index 18e540078..d74747e95 100755 --- a/scripts/commit +++ b/scripts/commit @@ -15,7 +15,6 @@ for i in `find . -name Changes -print`; do echo "$date $name $addr" >$dir/ChangeLog.new echo >>$dir/ChangeLog.new cat $dir/Changes >>$dir/ChangeLog.new - echo >>$dir/ChangeLog.new [ -f $dir/ChangeLog ] && cat $dir/ChangeLog >>$dir/ChangeLog.new echo -n > $dir/Changes [ -f $dir/ChangeLog ] && rm $dir/ChangeLog diff --git a/util/argparse.c b/util/argparse.c index 29870e977..ffda57238 100644 --- a/util/argparse.c +++ b/util/argparse.c @@ -148,6 +148,7 @@ initialize( ARGPARSE_ARGS *arg, const char *filename, unsigned *lineno ) arg->internal.inarg = 0; arg->internal.stopped = 0; arg->internal.aliases = NULL; + arg->internal.cur_alias = NULL; arg->err = 0; arg->flags |= 1<<15; /* mark initialized */ if( *arg->argc < 0 ) @@ -401,7 +402,6 @@ find_long_option( ARGPARSE_ARGS *arg, { int i; size_t n; - ALIAS_DEF a; /* Would be better if we can do a binary search, but it is not possible to reorder our option table because we would mess @@ -412,12 +412,19 @@ find_long_option( ARGPARSE_ARGS *arg, for(i=0; opts[i].short_opt; i++ ) if( opts[i].long_opt && !strcmp( opts[i].long_opt, keyword) ) return i; - #if 0 - /* see whether it is an alias */ - for( a= argds->internal.aliases; a; a = a->next ) - if( !strcmp( a->name, keyword) ) - return what_do_we_return_here; - #endif + #if 0 + { + ALIAS_DEF a; + /* see whether it is an alias */ + for( a = args->internal.aliases; a; a = a->next ) { + if( !strcmp( a->name, keyword) ) { + /* fixme: must parse the alias here */ + args->internal.cur_alias = a; + return -3; /* alias available */ + } + } + } + #endif /* not found, see whether it is an abbreviation */ /* aliases may not be abbreviated */ n = strlen( keyword );