1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

Bug fix in "showpref"

Allow setting a no-compression preference
This commit is contained in:
David Shaw 2001-12-07 00:57:50 +00:00
parent 88fbd0dfcf
commit ebd148e553
5 changed files with 50 additions and 4 deletions

View File

@ -1,3 +1,17 @@
2001-11-16 David Shaw <dshaw@jabberwocky.com>
* Allow the user to select no compression via "--compress-algo 0"
on the command line.
* keyedit.c (show_prefs): Show compression preferences in the
long-form "showpref" style.
* keygen.c (set_one_pref): Permit setting a no-compression ("Z0")
preference.
* getkey.c (fixup_uidnode): Fix compression preference corruption
bug.
2001-12-02 David Shaw <dshaw@jabberwocky.com>
* g10.c: Add advisory --for-your-eyes-only option as per section

View File

@ -1238,8 +1238,8 @@ main( int argc, char **argv )
if( check_policy_url( opt.set_policy_url ) )
log_error(_("the given policy URL is invalid\n"));
}
if( opt.def_compress_algo < 1 || opt.def_compress_algo > 2 )
log_error(_("compress algorithm must be in range %d..%d\n"), 1, 2);
if( opt.def_compress_algo < 0 || opt.def_compress_algo > 2 )
log_error(_("compress algorithm must be in range %d..%d\n"), 0, 2);
if( opt.completes_needed < 1 )
log_error(_("completes-needed must be greater than 0\n"));
if( opt.marginals_needed < 2 )
@ -1290,6 +1290,9 @@ main( int argc, char **argv )
g10_opt_verbose = opt.verbose;
}
/* Compression algorithm 0 means no compression at all */
if( opt.def_compress_algo == 0)
opt.compress = 0;
/* kludge to let -sat generate a clear text signature */
if( opt.textmode == 2 && !detached_sig && opt.armor && cmd == aSign )

View File

@ -1163,7 +1163,7 @@ fixup_uidnode ( KBNODE uidnode, KBNODE signode, u32 keycreated )
}
for (; nzip; nzip--, n++) {
uid->prefs[n].type = PREFTYPE_ZIP;
uid->prefs[n].value = *sym++;
uid->prefs[n].value = *zip++;
}
uid->prefs[n].type = PREFTYPE_NONE; /* end of list marker */
uid->prefs[n].value = 0;

View File

@ -1175,6 +1175,35 @@ show_prefs (PKT_user_id *uid, int verbose)
tty_printf ("[%d]", prefs[i].value);
}
}
tty_printf ("\n Compression: ");
for(i=any=0; prefs[i].type; i++ ) {
if( prefs[i].type == PREFTYPE_ZIP ) {
const char *s=NULL;
switch(prefs[i].value)
{
case 0:
s="Uncompressed";
break;
case 1:
s="ZIP";
break;
case 2:
s="ZLIB";
break;
}
if (any)
tty_printf (", ");
any = 1;
/* We don't want to display strings for experimental algos */
if (s && prefs[i].value < 100 )
tty_printf ("%s", s );
else
tty_printf ("[%d]", prefs[i].value);
}
}
tty_printf("\n");
}
else {

View File

@ -175,7 +175,7 @@ set_one_pref (ulong val, int type, int (*cf)(int), byte *buf, int *nbuf)
{
int i;
if (!val || val > 127 || cf (val)) {
if (cf (val)) {
log_info (_("preference %c%lu is not valid\n"), type, val);
return -1;
}