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

See ChangeLog: Sun Jan 24 18:16:26 CET 1999 Werner Koch

This commit is contained in:
Werner Koch 1999-01-24 17:16:40 +00:00
parent 9ef0f26270
commit a16e15282a
13 changed files with 912 additions and 351 deletions

5
NEWS
View File

@ -1,3 +1,8 @@
* changed the internal design of getkey which now allows a
efficient lookup of multiple keys and add a word match mode.
Noteworthy changes in version 0.9.2 Noteworthy changes in version 0.9.2
----------------------------------- -----------------------------------

View File

@ -47,3 +47,8 @@
* Keep a list of duplicate, faked or unwanted keyids. * Keep a list of duplicate, faked or unwanted keyids.
* use regular C strings for the user ids; this can be done because
OpenPGP requires them to be UTF-8 and we can replace a Null by
an UTF-8 character (which one?)

View File

@ -1 +1 @@
0.9.2 0.9.2a

View File

@ -88,6 +88,11 @@
#undef IPC_HAVE_SHM_LOCK #undef IPC_HAVE_SHM_LOCK
#undef IPC_RMID_DEFERRED_RELEASE #undef IPC_RMID_DEFERRED_RELEASE
/* set this to limit filenames to the 8.3 format */
#undef USE_ONLY_8DOT3
/* defined if we must run on a stupid file system */
#undef HAVE_DRIVE_LETTERS
@BOTTOM@ @BOTTOM@
#include "g10defs.h" #include "g10defs.h"

View File

@ -100,6 +100,8 @@ case "${target}" in
RANLIB="i386--mingw32-ranlib" RANLIB="i386--mingw32-ranlib"
ac_cv_have_dev_random=no ac_cv_have_dev_random=no
AC_DEFINE(USE_RNDW32) AC_DEFINE(USE_RNDW32)
AC_DEFINE(USE_ONLY_8DOT3)
AC_DEFINE(HAVE_DRIVE_LETTERS)
;; ;;
*-*-hpux*) *-*-hpux*)
if test -z "$GCC" ; then if test -z "$GCC" ; then

View File

@ -253,7 +253,7 @@ B<--trusted-key> I<keyid>
time GnuPG starts up: Use for I<keyid> the one of time GnuPG starts up: Use for I<keyid> the one of
your key. your key.
B<-r> I<name>, B<--remote-user> I<name> B<-r> I<name>, B<--recipient> I<name>
Use I<name> as the user-id for encryption. Use I<name> as the user-id for encryption.
This option is silently ignored for the list commands, This option is silently ignored for the list commands,
so that it can be used in an options file. so that it can be used in an options file.

View File

@ -1,3 +1,18 @@
Sun Jan 24 18:16:26 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
* getkey.c: Changed the internal design to allow simultaneous
lookup of multible user ids
(get_pubkey_bynames): New.
(get_seckey_bynames): New.
(get_seckey_next): New.
(get_seckey_end): New.
* keylist.c (list_one): Use the new functions.
* keylist.c (list_keyblock): add a newline for normal listings.
* g10.c (--recipient): New option name to replace --remote-user
Wed Jan 20 18:59:49 CET 1999 Werner Koch <wk@isil.d.shuttle.de> Wed Jan 20 18:59:49 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
* textfilter.c: Mostly rewritten * textfilter.c: Mostly rewritten

View File

@ -60,7 +60,7 @@ enum cmd_and_opt_values { aNull = 0,
oDryRun = 'n', oDryRun = 'n',
oOutput = 'o', oOutput = 'o',
oQuiet = 'q', oQuiet = 'q',
oRemote = 'r', oRecipient = 'r',
aSign = 's', aSign = 's',
oTextmodeShort= 't', oTextmodeShort= 't',
oUser = 'u', oUser = 'u',
@ -215,9 +215,10 @@ static ARGPARSE_OPTS opts[] = {
{ 301, NULL, 0, N_("@\nOptions:\n ") }, { 301, NULL, 0, N_("@\nOptions:\n ") },
{ oArmor, "armor", 0, N_("create ascii armored output")}, { oArmor, "armor", 0, N_("create ascii armored output")},
{ oRecipient, "recipient", 2, N_("|NAME|encrypt for NAME")},
{ oRecipient, "remote-user", 2, "@"}, /* old option name */
#ifdef IS_G10 #ifdef IS_G10
{ oUser, "local-user",2, N_("use this user-id to sign or decrypt")}, { oUser, "local-user",2, N_("use this user-id to sign or decrypt")},
{ oRemote, "remote-user", 2, N_("use this user-id for encryption")},
{ oCompress, NULL, 1, N_("|N|set compress level N (0 disables)") }, { oCompress, NULL, 1, N_("|N|set compress level N (0 disables)") },
{ oTextmodeShort, NULL, 0, "@"}, { oTextmodeShort, NULL, 0, "@"},
{ oTextmode, "textmode", 0, N_("use canonical text mode")}, { oTextmode, "textmode", 0, N_("use canonical text mode")},
@ -552,7 +553,7 @@ main( int argc, char **argv )
opt.max_cert_depth = 5; opt.max_cert_depth = 5;
opt.homedir = getenv("GNUPGHOME"); opt.homedir = getenv("GNUPGHOME");
if( !opt.homedir || !*opt.homedir ) { if( !opt.homedir || !*opt.homedir ) {
#ifdef __MINGW32__ #ifdef HAVE_DRIVE_LETTERS
opt.homedir = "c:/gnupg"; opt.homedir = "c:/gnupg";
#else #else
opt.homedir = "~/.gnupg"; opt.homedir = "~/.gnupg";
@ -758,7 +759,7 @@ main( int argc, char **argv )
case oS2KCipher: s2k_cipher_string = m_strdup(pargs.r.ret_str); break; case oS2KCipher: s2k_cipher_string = m_strdup(pargs.r.ret_str); break;
#ifdef IS_G10 #ifdef IS_G10
case oRemote: /* store the remote users */ case oRecipient: /* store the recipient */
sl = m_alloc( sizeof *sl + strlen(pargs.r.ret_str)); sl = m_alloc( sizeof *sl + strlen(pargs.r.ret_str));
strcpy(sl->d, pargs.r.ret_str); strcpy(sl->d, pargs.r.ret_str);
sl->next = remusr; sl->next = remusr;

File diff suppressed because it is too large Load Diff

View File

@ -31,10 +31,8 @@
#define MAX_FINGERPRINT_LEN 20 #define MAX_FINGERPRINT_LEN 20
struct getkey_ctx_s;
typedef struct getkey_ctx_s *GETKEY_CTX; typedef struct getkey_ctx_s *GETKEY_CTX;
#ifndef DEFINES_GETKEY_CTX
struct getkey_ctx_s { char hidden[1]; };
#endif
/**************** /****************
* A Keyblock is all packets which form an entire certificate; * A Keyblock is all packets which form an entire certificate;
@ -135,6 +133,8 @@ void getkey_disable_caches(void);
int get_pubkey( PKT_public_key *pk, u32 *keyid ); int get_pubkey( PKT_public_key *pk, u32 *keyid );
int get_pubkey_byname( GETKEY_CTX *rx, PKT_public_key *pk, int get_pubkey_byname( GETKEY_CTX *rx, PKT_public_key *pk,
const char *name, KBNODE *ret_keyblock ); const char *name, KBNODE *ret_keyblock );
int get_pubkey_bynames( GETKEY_CTX *rx, PKT_public_key *pk,
STRLIST names, KBNODE *ret_keyblock );
int get_pubkey_next( GETKEY_CTX ctx, PKT_public_key *pk, KBNODE *ret_keyblock ); int get_pubkey_next( GETKEY_CTX ctx, PKT_public_key *pk, KBNODE *ret_keyblock );
void get_pubkey_end( GETKEY_CTX ctx ); void get_pubkey_end( GETKEY_CTX ctx );
int get_seckey( PKT_secret_key *sk, u32 *keyid ); int get_seckey( PKT_secret_key *sk, u32 *keyid );
@ -145,6 +145,10 @@ int get_keyblock_byfprint( KBNODE *ret_keyblock, const byte *fprint,
size_t fprint_len ); size_t fprint_len );
int seckey_available( u32 *keyid ); int seckey_available( u32 *keyid );
int get_seckey_byname( PKT_secret_key *sk, const char *name, int unlock ); int get_seckey_byname( PKT_secret_key *sk, const char *name, int unlock );
int get_seckey_bynames( GETKEY_CTX *rx, PKT_secret_key *sk,
STRLIST names, KBNODE *ret_keyblock );
int get_seckey_next( GETKEY_CTX ctx, PKT_secret_key *sk, KBNODE *ret_keyblock );
void get_seckey_end( GETKEY_CTX ctx );
int enum_secret_keys( void **context, PKT_secret_key *sk, int with_subkeys ); int enum_secret_keys( void **context, PKT_secret_key *sk, int with_subkeys );
void merge_keys_and_selfsig( KBNODE keyblock ); void merge_keys_and_selfsig( KBNODE keyblock );
char*get_user_id_string( u32 *keyid ); char*get_user_id_string( u32 *keyid );

View File

@ -36,7 +36,7 @@
#include "i18n.h" #include "i18n.h"
static void list_all(int); static void list_all(int);
static void list_one(const char *name, int secret); static void list_one( STRLIST names, int secret);
static void list_keyblock( KBNODE keyblock, int secret ); static void list_keyblock( KBNODE keyblock, int secret );
static void fingerprint( PKT_public_key *pk, PKT_secret_key *sk ); static void fingerprint( PKT_public_key *pk, PKT_secret_key *sk );
@ -51,8 +51,11 @@ public_key_list( int nnames, char **names )
if( !nnames ) if( !nnames )
list_all(0); list_all(0);
else { /* List by user id */ else { /* List by user id */
STRLIST list = NULL;
for( ; nnames ; nnames--, names++ ) for( ; nnames ; nnames--, names++ )
list_one( *names, 0 ); add_to_strlist( &list, *names );
list_one( list, 0 );
free_strlist( list );
} }
} }
@ -62,8 +65,11 @@ secret_key_list( int nnames, char **names )
if( !nnames ) if( !nnames )
list_all(1); list_all(1);
else { /* List by user id */ else { /* List by user id */
STRLIST list = NULL;
for( ; nnames ; nnames--, names++ ) for( ; nnames ; nnames--, names++ )
list_one( *names, 1 ); add_to_strlist( &list, *names );
list_one( list, 0 );
free_strlist( list );
} }
} }
@ -111,36 +117,30 @@ list_all( int secret )
static void static void
list_one( const char *name, int secret ) list_one( STRLIST names, int secret )
{ {
int rc = 0; int rc = 0;
KBNODE keyblock = NULL; KBNODE keyblock = NULL;
GETKEY_CTX ctx;
if( secret ) { if( secret ) {
KBPOS kbpos; rc = get_seckey_bynames( &ctx, NULL, names, &keyblock );
rc = secret? find_secret_keyblock_byname( &kbpos, name )
: find_keyblock_byname( &kbpos, name );
if( rc ) { if( rc ) {
log_error("%s: user not found\n", name ); log_error("error reading key: %s\n", g10_errstr(rc) );
get_seckey_end( ctx );
return; return;
} }
do {
rc = read_keyblock( &kbpos, &keyblock ); merge_keys_and_selfsig( keyblock );
if( rc ) { list_keyblock( keyblock, 0 );
log_error("%s: keyblock read problem: %s\n", name, g10_errstr(rc) ); release_kbnode( keyblock );
return; } while( !get_seckey_next( ctx, NULL, &keyblock ) );
} get_seckey_end( ctx );
merge_keys_and_selfsig( keyblock );
list_keyblock( keyblock, secret );
release_kbnode( keyblock );
} }
else { else {
GETKEY_CTX ctx; rc = get_pubkey_bynames( &ctx, NULL, names, &keyblock );
rc = get_pubkey_byname( &ctx, NULL, name, &keyblock );
if( rc ) { if( rc ) {
log_error("%s: %s\n", name, g10_errstr(rc) ); log_error("error reading key: %s\n", g10_errstr(rc) );
get_pubkey_end( ctx ); get_pubkey_end( ctx );
return; return;
} }
@ -380,6 +380,8 @@ list_keyblock( KBNODE keyblock, int secret )
putchar(':'); putchar(':');
putchar('\n'); putchar('\n');
} }
else if( !opt.with_colons )
putchar('\n'); /* separator line */
} }

View File

@ -33,6 +33,11 @@
#include "status.h" #include "status.h"
#include "i18n.h" #include "i18n.h"
#ifdef USE_ONLY_8DOT3
#define SKELEXT ".skl"
#else
#define SKELEXT ".skel"
#endif
/**************** /****************
* Check whether FNAME exists and ask if it's okay to overwrite an * Check whether FNAME exists and ask if it's okay to overwrite an
@ -91,6 +96,9 @@ open_outfile( const char *iname, int mode, IOBUF *a )
if( opt.outfile ) if( opt.outfile )
name = opt.outfile; name = opt.outfile;
else { else {
#ifdef USE_ONLY_8DOT3
#error please implement this
#endif
buf = m_alloc(strlen(iname)+4+1); buf = m_alloc(strlen(iname)+4+1);
strcpy(stpcpy(buf,iname), mode==1 ? ".asc" : strcpy(stpcpy(buf,iname), mode==1 ? ".asc" :
mode==2 ? ".sig" : ".gpg"); mode==2 ? ".sig" : ".gpg");
@ -122,6 +130,9 @@ open_sigfile( const char *iname )
IOBUF a = NULL; IOBUF a = NULL;
size_t len; size_t len;
#ifdef USE_ONLY_8DOT3
#error please implement this
#endif
if( iname && !(*iname == '-' && !iname[1]) ) { if( iname && !(*iname == '-' && !iname[1]) ) {
len = strlen(iname); len = strlen(iname);
if( len > 4 && ( !strcmp(iname + len - 4, ".sig") if( len > 4 && ( !strcmp(iname + len - 4, ".sig")
@ -152,7 +163,7 @@ copy_options_file( const char *destdir )
int c; int c;
fname = m_alloc( strlen(datadir) + strlen(destdir) + 15 ); fname = m_alloc( strlen(datadir) + strlen(destdir) + 15 );
strcpy(stpcpy(fname, datadir), "/options.skel" ); strcpy(stpcpy(fname, datadir), "/options" SKELEXT );
src = fopen( fname, "r" ); src = fopen( fname, "r" );
if( !src ) { if( !src ) {
log_error(_("%s: can't open: %s\n"), fname, strerror(errno) ); log_error(_("%s: can't open: %s\n"), fname, strerror(errno) );

View File

@ -1397,15 +1397,28 @@ parse_user_id( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet )
{ {
byte *p; byte *p;
packet->pkt.user_id = m_alloc(sizeof *packet->pkt.user_id + pktlen - 1); packet->pkt.user_id = m_alloc(sizeof *packet->pkt.user_id + pktlen);
packet->pkt.user_id->len = pktlen; packet->pkt.user_id->len = pktlen;
p = packet->pkt.user_id->name; p = packet->pkt.user_id->name;
for( ; pktlen; pktlen--, p++ ) for( ; pktlen; pktlen--, p++ ) {
*p = iobuf_get_noeof(inp); *p = iobuf_get_noeof(inp);
/* 0xff is not a valid utf-8 encoding so we can use it to replace
* Nulls. This has the advantage that we can work with regular
* C strings. When exporting it, we change it back to Null
* the utf-8 functions know about this special convention.
* The advantage of this single character is that we can
* simple replace it. Problem is that we can't handle the 0xff
* character which may have been used by pref rfc2440 implementations
* I hope we can live with this. */
if( !*p )
*p = 0xff;
}
*p = 0;
if( list_mode ) { if( list_mode ) {
int n = packet->pkt.user_id->len; int n = packet->pkt.user_id->len;
printf(":user id packet: \""); printf(":user id packet: \"");
/* fixme: Hey why don't we replace this wioth print_string?? */
for(p=packet->pkt.user_id->name; n; p++, n-- ) { for(p=packet->pkt.user_id->name; n; p++, n-- ) {
if( *p >= ' ' && *p <= 'z' ) if( *p >= ' ' && *p <= 'z' )
putchar(*p); putchar(*p);