aboutsummaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
Diffstat (limited to 'g10')
-rw-r--r--g10/ChangeLog9
-rw-r--r--g10/armor.c23
-rw-r--r--g10/g10.c3
-rw-r--r--g10/openfile.c6
-rw-r--r--g10/options.h1
5 files changed, 30 insertions, 12 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index aa5a9dae6..e776f171c 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,12 @@
+2000-10-19 Werner Koch <[email protected]>
+
+ * g10.c: New option --ignore-crc-error
+ * armor.c (invalid_crc): New.
+ (radix64_read): Act on new option.
+
+ * openfile.c (try_make_homedir): Klaus Singvogel fixed a stupid
+ error introduced on Sep 6th.
+
2000-10-18 Werner Koch <[email protected]>
* misc.c (print_cipher_algo_note): Don't print the note for AES.
diff --git a/g10/armor.c b/g10/armor.c
index cc7d97214..576a15ff4 100644
--- a/g10/armor.c
+++ b/g10/armor.c
@@ -590,6 +590,15 @@ fake_packet( armor_filter_context_t *afx, IOBUF a,
}
+static int
+invalid_crc(void)
+{
+ if ( opt.ignore_crc_error )
+ return 0;
+ log_inc_errorcount();
+ return G10ERR_INVALID_ARMOR;
+}
+
static int
radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn,
@@ -728,17 +737,17 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn,
break; /* eof */
} while( ++idx < 4 );
if( c == -1 ) {
- log_error(_("premature eof (in CRC)\n"));
- rc = G10ERR_INVALID_ARMOR;
- }
+ log_info(_("premature eof (in CRC)\n"));
+ rc = invalid_crc();
+ }
else if( idx != 4 ) {
- log_error(_("malformed CRC\n"));
- rc = G10ERR_INVALID_ARMOR;
+ log_info(_("malformed CRC\n"));
+ rc = invalid_crc();
}
else if( mycrc != afx->crc ) {
- log_error(_("CRC error; %06lx - %06lx\n"),
+ log_info (_("CRC error; %06lx - %06lx\n"),
(ulong)afx->crc, (ulong)mycrc);
- rc = G10ERR_INVALID_ARMOR;
+ rc = invalid_crc();
}
else {
rc = 0;
diff --git a/g10/g10.c b/g10/g10.c
index 9ba7e8942..9fabc9360 100644
--- a/g10/g10.c
+++ b/g10/g10.c
@@ -189,6 +189,7 @@ enum cmd_and_opt_values { aNull = 0,
oFastListMode,
oListOnly,
oIgnoreTimeConflict,
+ oIgnoreCrcError,
oShowSessionKey,
oOverrideSessionKey,
oNoRandomSeedFile,
@@ -378,6 +379,7 @@ static ARGPARSE_OPTS opts[] = {
{ oFastListMode,"fast-list-mode", 0, "@" },
{ oListOnly, "list-only", 0, "@"},
{ oIgnoreTimeConflict, "ignore-time-conflict", 0, "@" },
+ { oIgnoreCrcError, "ignore-crc-error", 0,"@" },
{ oShowSessionKey, "show-session-key", 0, "@" },
{ oOverrideSessionKey, "override-session-key", 2, "@" },
{ oNoRandomSeedFile, "no-random-seed-file", 0, "@" },
@@ -928,6 +930,7 @@ main( int argc, char **argv )
case oFastListMode: opt.fast_list_mode = 1; break;
case oListOnly: opt.list_only=1; break;
case oIgnoreTimeConflict: opt.ignore_time_conflict = 1; break;
+ case oIgnoreCrcError: opt.ignore_crc_error = 1; break;
case oNoRandomSeedFile: use_random_seed = 0; break;
case oNoAutoKeyRetrieve: opt.auto_key_retrieve = 0; break;
case oShowSessionKey: opt.show_session_key = 1; break;
diff --git a/g10/openfile.c b/g10/openfile.c
index ff7478d86..460b4449e 100644
--- a/g10/openfile.c
+++ b/g10/openfile.c
@@ -329,7 +329,7 @@ try_make_homedir( const char *fname )
if ( ( *defhome == '~'
&& ( strlen(fname) >= strlen (defhome+1)
- && !strcmp(fname+strlen(defhome+1)-strlen(defhome+1),
+ && !strcmp(fname+strlen(fname)-strlen(defhome+1),
defhome+1 ) ))
|| ( *defhome != '~'
&& !compare_filenames( fname, defhome ) )
@@ -345,7 +345,3 @@ try_make_homedir( const char *fname )
g10_exit(1);
}
}
-
-
-
-
diff --git a/g10/options.h b/g10/options.h
index 18abd7ce4..40417159a 100644
--- a/g10/options.h
+++ b/g10/options.h
@@ -90,6 +90,7 @@ struct {
int honor_http_proxy;
int fast_list_mode;
int ignore_time_conflict;
+ int ignore_crc_error;
int command_fd;
int auto_key_retrieve;
const char *override_session_key;