1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

See ChangeLog: Thu Feb 25 18:47:39 CET 1999 Werner Koch

This commit is contained in:
Werner Koch 1999-02-25 17:51:55 +00:00
parent cbe6d2fd2a
commit 946916a53d
12 changed files with 90 additions and 11 deletions

View file

@ -1,3 +1,17 @@
Thu Feb 25 18:47:39 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
* pkclist.c (algo_available): New.
(select_algo_from_prefs): Check whether algo is available.
* ringedit.c (keyring_copy): Take care of opt.dry_run.
(do_gdbm_store): Ditto.
* openfile.c (open_outfile). Ditto.
(copy_options_file): Ditto.
* trustdb.c (update_trustdb): Ditto.
(clear_trust_checked_flag): Ditto.
(update_trust_record): Ditto.
(insert_trust_record): Ditto.
Wed Feb 24 11:07:27 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
* keylist.c (secret_key_list): Now really list the secret key.

View file

@ -232,7 +232,7 @@ static ARGPARSE_OPTS opts[] = {
{ oVerbose, "verbose", 0, N_("verbose") },
{ oQuiet, "quiet", 0, N_("be somewhat more quiet") },
{ oForceV3Sigs, "force-v3-sigs", 0, N_("force v3 signatures") },
/* { oDryRun, "dry-run", 0, N_("do not make any changes") }, */
{ oDryRun, "dry-run", 0, N_("do not make any changes") },
{ oBatch, "batch", 0, N_("batch mode: never ask")},
{ oAnswerYes, "yes", 0, N_("assume yes on most questions")},
{ oAnswerNo, "no", 0, N_("assume no on most questions")},
@ -695,6 +695,7 @@ main( int argc, char **argv )
case oArmor: opt.armor = 1; opt.no_armor=0; break;
case oOutput: opt.outfile = pargs.r.ret_str; break;
case oQuiet: opt.quiet = 1; break;
case oDryRun: opt.dry_run = 1; break;
case oVerbose: g10_opt_verbose++;
opt.verbose++; opt.list_sigs=1; break;
case oKOption: set_cmd( &cmd, aKMode ); break;

View file

@ -199,6 +199,10 @@ proc_pubkey_enc( CTX c, PACKET *pkt )
log_info( _("public key encrypted data: good DEK\n") );
}
else {
/* fixme: defer this message until we have parsed all packets of
* this type - do this by building a list of keys with their stati
* and store it with the conetxt. do_proc_packets can then use
* this list to display some information */
log_error(_("public key decryption failed: %s\n"), g10_errstr(result));
}
free_packet(pkt);

View file

@ -93,7 +93,9 @@ open_outfile( const char *iname, int mode, IOBUF *a )
char *buf=NULL;
const char *name;
if( opt.outfile )
if( opt.dry_run )
name = "/dev/null";
else if( opt.outfile )
name = opt.outfile;
else {
#ifdef USE_ONLY_8DOT3
@ -162,6 +164,9 @@ copy_options_file( const char *destdir )
int linefeeds=0;
int c;
if( opt.dry_run )
return;
fname = m_alloc( strlen(datadir) + strlen(destdir) + 15 );
strcpy(stpcpy(fname, datadir), "/options" SKELEXT );
src = fopen( fname, "r" );

View file

@ -31,6 +31,7 @@ struct {
int armor;
int compress;
char *outfile;
int dry_run;
int textmode;
int batch; /* run in batch mode */
int answer_yes; /* answer yes on most questions */

View file

@ -367,7 +367,9 @@ do_we_trust( PKT_public_key *pk, int trustlevel )
static int
do_we_trust_pre( PKT_public_key *pk, int trustlevel )
{
int rc = do_we_trust( pk, trustlevel );
int rc;
rc = do_we_trust( pk, trustlevel );
if( (trustlevel & TRUST_FLAG_REVOKED) && !rc )
return 0;
@ -650,6 +652,23 @@ build_pk_list( STRLIST remusr, PK_LIST *ret_pk_list, unsigned use )
}
static int
algo_available( int preftype, int algo )
{
if( preftype == PREFTYPE_SYM ) {
return algo && !check_cipher_algo( algo );
}
else if( preftype == PREFTYPE_HASH ) {
return algo && !check_digest_algo( algo );
}
else if( preftype == PREFTYPE_COMPR ) {
return !algo || algo == 1 || algo == 2;
}
else
return 0;
}
/****************
* Return -1 if we could not find an algorithm.
*/
@ -726,9 +745,10 @@ select_algo_from_prefs( PK_LIST pk_list, int preftype )
if( pref[j] == preftype ) {
any = 1;
if( (bits[pref[j+1]/32] & (1<<(pref[j+1]%32))) ) {
/* fixme: check whether this algoritm is available */
i = pref[j+1];
break;
if( algo_available( preftype, pref[j+1] ) ) {
i = pref[j+1];
break;
}
}
}
}
@ -736,9 +756,10 @@ select_algo_from_prefs( PK_LIST pk_list, int preftype )
if( !pref || !any ) {
for(j=0; j < 256; j++ )
if( (bits[j/32] & (1<<(j%32))) ) {
/* fixme: check whether this algoritm is available */
i = j;
break;
if( algo_available( preftype, j ) ) {
i = j;
break;
}
}
}
#if 0

View file

@ -1297,6 +1297,9 @@ keyring_copy( KBPOS *kbpos, int mode, KBNODE root )
if( kbpos->fp )
BUG(); /* not allowed with such a handle */
if( opt.dry_run )
return 0;
lock_rentry( rentry );
/* open the source file */
@ -1535,6 +1538,9 @@ do_gdbm_store( KBPOS *kbpos, KBNODE root, int update )
if( !(rentry = check_pos( kbpos )) )
return G10ERR_GENERAL;
if( opt.dry_run )
return 0;
/* construct the fingerprint which is used as the primary key */
node = find_kbnode( root, PKT_PUBLIC_KEY );
if( !node )

View file

@ -1506,8 +1506,10 @@ list_trust_path( const char *username )
int rc;
ulong lid;
TRUSTREC rec;
#if 0
TRUST_INFO *tmppath;
TRUST_SEG_LIST trust_seg_list, tsl, tsl2;
#endif
PKT_public_key *pk = m_alloc_clear( sizeof *pk );
INIT_TRUSTDB();
@ -1688,6 +1690,9 @@ update_trustdb( )
KBPOS kbpos;
int rc;
if( opt.dry_run )
return;
INIT_TRUSTDB();
rc = enum_keyblocks( 0, &kbpos, &keyblock );
if( !rc ) {
@ -2121,6 +2126,9 @@ clear_trust_checked_flag( PKT_public_key *pk )
TRUSTREC rec;
int rc;
if( opt.dry_run )
return 0;
INIT_TRUSTDB();
rc = get_dir_record( pk, &rec );
if( rc )
@ -3108,6 +3116,9 @@ update_trust_record( KBNODE keyblock, int recheck, int *modified )
RECNO_LIST recno_list = NULL; /* list of verified records */
/* fixme: replace recno_list by a lookup on node->recno */
if( opt.dry_run )
return 0;
INIT_TRUSTDB();
if( modified )
*modified = 0;
@ -3237,6 +3248,10 @@ insert_trust_record( PKT_public_key *pk )
int rc = 0;
ulong hintlist = 0;
if( opt.dry_run )
return 0;
INIT_TRUSTDB();
if( pk->local_id )