From e6f72aa347d0fdc44a22d40f671d4190731758de Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 5 Feb 1998 08:54:39 +0000 Subject: [PATCH] I believe clearsig works --- g10/armor.c | 15 ++++++++++++--- g10/sign.c | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/g10/armor.c b/g10/armor.c index dbe3406bf..e397346cc 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -72,6 +72,7 @@ typedef enum { fhdrCHECKDashEscaped3, fhdrREADClearsigNext, fhdrENDClearsig, + fhdrENDClearsigHelp, fhdrTESTSpaces, fhdrTEXT, fhdrERROR, @@ -291,7 +292,7 @@ find_header( fhdr_state_t state, byte *buf, size_t *r_buflen, state = fhdrCHECKDashEscaped3; } else { - /* fixme: we should check wether this linee continues + /* fixme: we should check wether this line continues * it is poosible that we have only read ws until here * and more stuff is to come */ state = fhdrEOF; @@ -565,6 +566,12 @@ fake_packet( armor_filter_context_t *afx, IOBUF a, } continue; } + if( state == fhdrENDClearsigHelp ) { + state = fhdrENDClearsig; + afx->faked = 0; + rc = -1; + continue; + } if( afx->helpidx < afx->helplen ) { /* flush the last buffer */ n = afx->helplen; for(nn=afx->helpidx; len < size && nn < n ; nn++ ) @@ -598,9 +605,11 @@ fake_packet( armor_filter_context_t *afx, IOBUF a, break; case fhdrENDClearsig: + log_debug("endclearsig: emplines=%u n=%u\n", emplines, n ); + assert( emplines ); + emplines--; /* don't count the last one */ + state = fhdrENDClearsigHelp; afx->helplen = n; - afx->faked = 0; - rc = -1; break; default: BUG(); diff --git a/g10/sign.c b/g10/sign.c index d06b91990..010c6bcc3 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -376,7 +376,7 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile ) if( rc ) goto leave; - iobuf_writestr(out, "\n\n" ); + iobuf_writestr(out, "\n" ); afx.what = 2; iobuf_push_filter( out, armor_filter, &afx );