1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-23 10:29:58 +01:00

* g10.c (main): Add --multifile as an alias to turn --encrypt into

--encrypt-files (plus --verify-files, --decrypt-files).

* encode.c (use_mdc), g10.c (main): Use RFC1991 and RFC2440 directly to
check for MDC usability.  Do not set the force_mdc or disable_mdc flags
since there is no point any longer.
This commit is contained in:
David Shaw 2003-09-05 23:55:51 +00:00
parent 772ff76486
commit 54d55d4147
3 changed files with 56 additions and 40 deletions

View File

@ -1,3 +1,12 @@
2003-09-05 David Shaw <dshaw@jabberwocky.com>
* g10.c (main): Add --multifile as an alias to turn --encrypt into
--encrypt-files (plus --verify-files, --decrypt-files).
* encode.c (use_mdc), g10.c (main): Use RFC1991 and RFC2440
directly to check for MDC usability. Do not set the force_mdc or
disable_mdc flags since there is no point any longer.
2003-08-30 David Shaw <dshaw@jabberwocky.com> 2003-08-30 David Shaw <dshaw@jabberwocky.com>
* keylist.c (show_policy_url): Policy URLs might be UTF8. * keylist.c (show_policy_url): Policy URLs might be UTF8.

View File

@ -106,6 +106,10 @@ encode_sesskey( DEK *dek, DEK **ret_dek, byte *enckey )
static int static int
use_mdc(PK_LIST pk_list,int algo) use_mdc(PK_LIST pk_list,int algo)
{ {
/* RFC-1991 and 2440 don't have MDC */
if(RFC1991 || RFC2440)
return 0;
/* --force-mdc overrides --disable-mdc */ /* --force-mdc overrides --disable-mdc */
if(opt.force_mdc) if(opt.force_mdc)
return 1; return 1;

View File

@ -296,7 +296,8 @@ enum cmd_and_opt_values { aNull = 0,
oNoStrict, oNoStrict,
oMangleDosFilenames, oMangleDosFilenames,
oNoMangleDosFilenames, oNoMangleDosFilenames,
oEnableProgressFilter, oEnableProgressFilter,
oMultifile,
aTest }; aTest };
@ -600,6 +601,7 @@ static ARGPARSE_OPTS opts[] = {
{ oMangleDosFilenames, "mangle-dos-filenames", 0, "@" }, { oMangleDosFilenames, "mangle-dos-filenames", 0, "@" },
{ oNoMangleDosFilenames, "no-mangle-dos-filenames", 0, "@" }, { oNoMangleDosFilenames, "no-mangle-dos-filenames", 0, "@" },
{ oEnableProgressFilter, "enable-progress-filter", 0, "@" }, { oEnableProgressFilter, "enable-progress-filter", 0, "@" },
{ oMultifile, "multifile", 0, "@" },
{0} }; {0} };
@ -1071,6 +1073,7 @@ main( int argc, char **argv )
char *pers_digest_list = NULL; char *pers_digest_list = NULL;
char *pers_compress_list = NULL; char *pers_compress_list = NULL;
int eyes_only=0; int eyes_only=0;
int multifile=0;
int pwfd = -1; int pwfd = -1;
int with_fpr = 0; /* make an option out of --fingerprint */ int with_fpr = 0; /* make an option out of --fingerprint */
int any_explicit_recipient = 0; int any_explicit_recipient = 0;
@ -1273,11 +1276,15 @@ main( int argc, char **argv )
case aDetachedSign: detached_sig = 1; set_cmd( &cmd, aSign ); break; case aDetachedSign: detached_sig = 1; set_cmd( &cmd, aSign ); break;
case aSym: set_cmd( &cmd, aSym); break; case aSym: set_cmd( &cmd, aSym); break;
case aDecryptFiles: multifile=1; /* fall through */
case aDecrypt: set_cmd( &cmd, aDecrypt); break; case aDecrypt: set_cmd( &cmd, aDecrypt); break;
case aDecryptFiles: set_cmd( &cmd, aDecryptFiles); break;
case aEncrFiles: multifile=1; /* fall through */
case aEncr: set_cmd( &cmd, aEncr); break; case aEncr: set_cmd( &cmd, aEncr); break;
case aEncrFiles: set_cmd( &cmd, aEncrFiles ); break;
case aVerifyFiles: multifile=1; /* fall through */
case aVerify: set_cmd( &cmd, aVerify); break;
case aSign: set_cmd( &cmd, aSign ); break; case aSign: set_cmd( &cmd, aSign ); break;
case aKeygen: set_cmd( &cmd, aKeygen); greeting=1; break; case aKeygen: set_cmd( &cmd, aKeygen); greeting=1; break;
case aSignKey: set_cmd( &cmd, aSignKey); break; case aSignKey: set_cmd( &cmd, aSignKey); break;
@ -1289,8 +1296,6 @@ main( int argc, char **argv )
case aClearsign: set_cmd( &cmd, aClearsign); break; case aClearsign: set_cmd( &cmd, aClearsign); break;
case aGenRevoke: set_cmd( &cmd, aGenRevoke); break; case aGenRevoke: set_cmd( &cmd, aGenRevoke); break;
case aDesigRevoke: set_cmd( &cmd, aDesigRevoke); break; case aDesigRevoke: set_cmd( &cmd, aDesigRevoke); break;
case aVerify: set_cmd( &cmd, aVerify); break;
case aVerifyFiles: set_cmd( &cmd, aVerifyFiles); break;
case aPrimegen: set_cmd( &cmd, aPrimegen); break; case aPrimegen: set_cmd( &cmd, aPrimegen); break;
case aGenRandom: set_cmd( &cmd, aGenRandom); break; case aGenRandom: set_cmd( &cmd, aGenRandom); break;
case aPrintMD: set_cmd( &cmd, aPrintMD); break; case aPrintMD: set_cmd( &cmd, aPrintMD); break;
@ -1440,7 +1445,6 @@ main( int argc, char **argv )
case oRFC1991: case oRFC1991:
opt.compliance = CO_RFC1991; opt.compliance = CO_RFC1991;
opt.force_v4_certs = 0; opt.force_v4_certs = 0;
opt.disable_mdc = 1;
opt.escape_from = 1; opt.escape_from = 1;
break; break;
case oRFC2440: case oRFC2440:
@ -1448,7 +1452,6 @@ main( int argc, char **argv )
/* TODO: When 2440bis becomes a RFC, these may need /* TODO: When 2440bis becomes a RFC, these may need
changing. */ changing. */
opt.compliance = CO_RFC2440; opt.compliance = CO_RFC2440;
opt.disable_mdc = 1;
opt.allow_non_selfsigned_uid = 1; opt.allow_non_selfsigned_uid = 1;
opt.allow_freeform_uid = 1; opt.allow_freeform_uid = 1;
opt.pgp2_workarounds = 0; opt.pgp2_workarounds = 0;
@ -1694,11 +1697,10 @@ main( int argc, char **argv )
case oGroup: add_group(pargs.r.ret_str); break; case oGroup: add_group(pargs.r.ret_str); break;
case oStrict: /* noop */ break; case oStrict: /* noop */ break;
case oNoStrict: /* noop */ break; case oNoStrict: /* noop */ break;
case oMangleDosFilenames: opt.mangle_dos_filenames = 1; break; case oMangleDosFilenames: opt.mangle_dos_filenames = 1; break;
case oNoMangleDosFilenames: opt.mangle_dos_filenames = 0; break; case oNoMangleDosFilenames: opt.mangle_dos_filenames = 0; break;
case oEnableProgressFilter: opt.enable_progress_filter = 1; break;
case oEnableProgressFilter: opt.enable_progress_filter = 1; break; case oMultifile: multifile=1; break;
default : pargs.err = configfp? 1:2; break; default : pargs.err = configfp? 1:2; break;
} }
@ -1822,8 +1824,6 @@ main( int argc, char **argv )
compliance_failure(); compliance_failure();
else else
{ {
opt.force_mdc = 0;
opt.disable_mdc = 1;
opt.force_v4_certs = 0; opt.force_v4_certs = 0;
opt.sk_comments = 0; opt.sk_comments = 0;
opt.escape_from = 1; opt.escape_from = 1;
@ -1842,8 +1842,6 @@ main( int argc, char **argv )
opt.escape_from=1; opt.escape_from=1;
opt.force_v3_sigs=1; opt.force_v3_sigs=1;
opt.ask_sig_expire=0; opt.ask_sig_expire=0;
opt.force_mdc=0;
opt.disable_mdc=1;
} }
else if(PGP7) else if(PGP7)
{ {
@ -2042,8 +2040,7 @@ main( int argc, char **argv )
&& !(cmd == aKMode && argc == 2 ) ) && !(cmd == aKMode && argc == 2 ) )
{ {
if (cmd != aCheckKeys && cmd != aListSigs && cmd != aListKeys if (cmd != aCheckKeys && cmd != aListSigs && cmd != aListKeys
&& cmd != aVerify && cmd != aVerifyFiles && cmd != aVerify && cmd != aSym)
&& cmd != aSym)
{ {
if (!sec_nrings || default_keyring) /* add default secret rings */ if (!sec_nrings || default_keyring) /* add default secret rings */
keydb_add_resource ("secring" EXTSEP_S "gpg", 0, 1); keydb_add_resource ("secring" EXTSEP_S "gpg", 0, 1);
@ -2112,15 +2109,17 @@ main( int argc, char **argv )
break; break;
case aEncr: /* encrypt the given file */ case aEncr: /* encrypt the given file */
if( argc > 1 ) if(multifile)
wrong_args(_("--encrypt [filename]")); encode_crypt_files(argc, argv, remusr);
if( (rc = encode_crypt(fname,remusr)) ) else
log_error("%s: encryption failed: %s\n", print_fname_stdin(fname), g10_errstr(rc) ); {
if( argc > 1 )
wrong_args(_("--encrypt [filename]"));
if( (rc = encode_crypt(fname,remusr)) )
log_error("%s: encryption failed: %s\n",
print_fname_stdin(fname), g10_errstr(rc) );
}
break; break;
case aEncrFiles: /* encrypt the given files */
encode_crypt_files(argc, argv, remusr);
break;
case aSign: /* sign the given file */ case aSign: /* sign the given file */
sl = NULL; sl = NULL;
@ -2173,25 +2172,29 @@ main( int argc, char **argv )
break; break;
case aVerify: case aVerify:
if( (rc = verify_signatures( argc, argv ) )) if(multifile)
log_error("verify signatures failed: %s\n", g10_errstr(rc) ); {
break; if( (rc = verify_files( argc, argv ) ))
log_error("verify files failed: %s\n", g10_errstr(rc) );
case aVerifyFiles: }
if( (rc = verify_files( argc, argv ) )) else
log_error("verify files failed: %s\n", g10_errstr(rc) ); {
if( (rc = verify_signatures( argc, argv ) ))
log_error("verify signatures failed: %s\n", g10_errstr(rc) );
}
break; break;
case aDecrypt: case aDecrypt:
if( argc > 1 ) if(multifile)
wrong_args(_("--decrypt [filename]")); decrypt_messages(argc, argv);
if( (rc = decrypt_message( fname ) )) else
log_error("decrypt_message failed: %s\n", g10_errstr(rc) ); {
if( argc > 1 )
wrong_args(_("--decrypt [filename]"));
if( (rc = decrypt_message( fname ) ))
log_error("decrypt_message failed: %s\n", g10_errstr(rc) );
}
break; break;
case aDecryptFiles:
decrypt_messages(argc, argv);
break;
case aSignKey: /* sign the key given as argument */ case aSignKey: /* sign the key given as argument */
if( argc != 1 ) if( argc != 1 )