aboutsummaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
Diffstat (limited to 'g10')
-rw-r--r--g10/ChangeLog10
-rw-r--r--g10/armor.c1
-rw-r--r--g10/encode.c1
-rw-r--r--g10/filter.h3
-rw-r--r--g10/textfilter.c21
-rw-r--r--g10/verify.c16
6 files changed, 46 insertions, 6 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index aa3e38c04..83620ff73 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,13 @@
+Tue Sep 28 20:54:37 CEST 1999 Werner Koch <[email protected]>
+
+ * encode.c (encode_simple): Use new CTB when we don't have the
+ length of the file. This is somewhat strange as the comment above
+ indicates that this part is actually fixed for PGP 5 - maybe I simply
+ lost the source line, tsss.
+
+ * armor.c (armor_filter): Set a flag if no OpenPGP data has been found.
+ * verify.c (verify_signatures): Add an error helptext.
+
Thu Sep 23 19:24:30 CEST 1999 Werner Koch <[email protected]>
* openfile.c (open_outfile): Fixed the 8dot3 handling.
diff --git a/g10/armor.c b/g10/armor.c
index 38c48fbbe..d0cbfd067 100644
--- a/g10/armor.c
+++ b/g10/armor.c
@@ -999,6 +999,7 @@ armor_filter( void *opaque, int control,
}
else if( !afx->any_data && !afx->inp_bypass ) {
log_error(_("no valid OpenPGP data found.\n"));
+ afx->no_openpgp_data = 1;
write_status_text( STATUS_NODATA, "1" );
}
if( afx->truncated )
diff --git a/g10/encode.c b/g10/encode.c
index bc03401ac..2149cb0c4 100644
--- a/g10/encode.c
+++ b/g10/encode.c
@@ -177,6 +177,7 @@ encode_simple( const char *filename, int mode )
pt->timestamp = make_timestamp();
pt->mode = opt.textmode? 't' : 'b';
pt->len = filesize;
+ pt->new_ctb = !pt->len && !opt.rfc1991;
pt->buf = inp;
pkt.pkttype = PKT_PLAINTEXT;
pkt.pkt.plaintext = pt;
diff --git a/g10/filter.h b/g10/filter.h
index 86a8e45b8..49d92103b 100644
--- a/g10/filter.h
+++ b/g10/filter.h
@@ -35,6 +35,9 @@ typedef struct {
int only_keyblocks; /* skip all headers but ".... key block" */
const char *hdrlines; /* write these headerlines */
+ /* these fileds must be initialized to zero */
+ int no_openpgp_data; /* output flag: "No valid OpenPGP data found" */
+
/* the following fields must be initialized to zero */
int inp_checked; /* set if the input has been checked */
int inp_bypass; /* set if the input is not armored */
diff --git a/g10/textfilter.c b/g10/textfilter.c
index 3125925b6..dc143b354 100644
--- a/g10/textfilter.c
+++ b/g10/textfilter.c
@@ -183,11 +183,32 @@ copy_clearsig_text( IOBUF out, IOBUF inp, MD_HANDLE md,
iobuf_put( out, '-' );
iobuf_put( out, ' ' );
}
+ #ifdef __MINGW32__
+ /* make sure the lines do end in CR,LF */
+ if( n > 1 && ( (buffer[n-2] == '\r' && buffer[n-1] == '\n' )
+ || (buffer[n-2] == '\n' && buffer[n-1] == '\r'))) {
+ iobuf_write( out, buffer, n-2 );
+ iobuf_put( out, '\r');
+ iobuf_put( out, '\n');
+ }
+ else if( n && buffer[n-1] == '\n' ) {
+ iobuf_write( out, buffer, n-1 );
+ iobuf_put( out, '\r');
+ iobuf_put( out, '\n');
+ }
+ else
+ iobuf_write( out, buffer, n );
+
+ #else
iobuf_write( out, buffer, n );
+ #endif
}
/* at eof */
if( !pending_lf ) { /* make sure that the file ends with a LF */
+ #ifndef __MINGW32__
+ iobuf_put( out, '\r');
+ #endif
iobuf_put( out, '\n');
if( !escape_dash )
md_putc( md, '\n' );
diff --git a/g10/verify.c b/g10/verify.c
index 680fed0ff..d0feda7aa 100644
--- a/g10/verify.c
+++ b/g10/verify.c
@@ -59,6 +59,7 @@ verify_signatures( int nfiles, char **files )
int i, rc;
STRLIST sl;
+ memset( &afx, 0, sizeof afx);
sigfile = nfiles? *files : NULL;
/* open the signature file */
@@ -68,12 +69,8 @@ verify_signatures( int nfiles, char **files )
return G10ERR_OPEN_FILE;
}
- if( !opt.no_armor ) {
- if( use_armor_filter( fp ) ) {
- memset( &afx, 0, sizeof afx);
- iobuf_push_filter( fp, armor_filter, &afx );
- }
- }
+ if( !opt.no_armor && use_armor_filter( fp ) )
+ iobuf_push_filter( fp, armor_filter, &afx );
sl = NULL;
for(i=1 ; i < nfiles; i++ )
@@ -81,6 +78,13 @@ verify_signatures( int nfiles, char **files )
rc = proc_signature_packets( NULL, fp, sl, sigfile );
free_strlist(sl);
iobuf_close(fp);
+ if( afx.no_openpgp_data && rc == -1 ) {
+ log_error(_("the signature could not be verified.\n"
+ "Please remember that the signature file (.sig or .asc)\n"
+ "should be the first file given on the command line.\n") );
+ rc = 0;
+ }
+
return rc;
}