diff options
author | Werner Koch <wk@gnupg.org> | 1998-02-16 21:05:02 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 1998-02-16 21:05:02 +0100 |
commit | 82464369f664f821542c416d35d4013f9723f87a (patch) | |
tree | d127f2d891260ff1c6d4264630b2ba7bd463b1f4 /g10/ringedit.c | |
parent | added option export (diff) | |
download | gnupg2-82464369f664f821542c416d35d4013f9723f87a.tar.xz gnupg2-82464369f664f821542c416d35d4013f9723f87a.zip |
some import functionality
Diffstat (limited to 'g10/ringedit.c')
-rw-r--r-- | g10/ringedit.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/g10/ringedit.c b/g10/ringedit.c index adba3db0b..6d3fc14bb 100644 --- a/g10/ringedit.c +++ b/g10/ringedit.c @@ -123,10 +123,24 @@ add_keyblock_resource( const char *filename, int force, int secret ) return 0; } +/**************** + * Return the resource name of the keyblock associated with KBPOS. + */ +const char * +keyblock_resource_name( KBPOS *kbpos ) +{ + RESTBL *rentry; + + if( !(rentry = check_pos( kbpos )) || !rentry->fname ) + log_bug("no name for keyblock resource %d\n", kbpos->resno ); + return rentry->fname; +} + /**************** * Get a keyblock handle KBPOS from a filename. This can be used * to get a handle for insert_keyblock for a new keyblock. + * Using a filename of NULL returns the default resource */ int get_keyblock_handle( const char *filename, int secret, KBPOS *kbpos ) @@ -136,7 +150,7 @@ get_keyblock_handle( const char *filename, int secret, KBPOS *kbpos ) for(i=0; i < MAX_RESOURCES; i++ ) if( resource_table[i].used && !resource_table[i].secret == !secret ) { /* fixme: dos needs case insensitive file compare */ - if( !strcmp( resource_table[i].fname, filename ) ) { + if( !filename || !strcmp( resource_table[i].fname, filename ) ) { memset( kbpos, 0, sizeof *kbpos ); kbpos->resno = i; return 0; @@ -598,6 +612,7 @@ keyring_read( KBPOS *kbpos, KBNODE *ret_root ) } kbpos->count++; free_packet( pkt ); + init_packet( pkt ); continue; } /* make a linked list of all packets */ @@ -660,6 +675,7 @@ keyring_enum( KBPOS *kbpos, KBNODE *ret_root ) goto ready; } free_packet( pkt ); + init_packet( pkt ); continue; } /* make a linked list of all packets */ |