From 11573b09c4a00c94107edd40ec84c7de4008151e Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 17 Jul 2007 18:11:24 +0000 Subject: [PATCH] Typo fixes. Made --default-key work for gpgsm Add --default-key and --encrypt-to to gpgconf. --- NEWS | 4 ++++ TODO | 2 +- agent/call-pinentry.c | 2 +- doc/ChangeLog | 4 ++++ doc/gpgsm.texi | 8 ++++++++ g10/ChangeLog | 6 ++++++ g10/card-util.c | 9 ++++++--- g10/gpg.c | 2 ++ sm/ChangeLog | 5 +++++ sm/gpgsm.c | 15 +++++++++++---- sm/sign.c | 10 +++++----- tools/ChangeLog | 5 +++++ tools/gpgconf-comp.c | 12 ++++++++++++ 13 files changed, 70 insertions(+), 14 deletions(-) diff --git a/NEWS b/NEWS index 62d3a00d8..c69879dc2 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,10 @@ Noteworthy changes in version 2.0.6 ------------------------------------------------ + * gpgsm does now grok --default-key. + + * gpgconf is now aware of --default-key and --encrypt-to. + Noteworthy changes in version 2.0.5 (2007-07-05) ------------------------------------------------ diff --git a/TODO b/TODO index 842676c01..f45dd83e9 100644 --- a/TODO +++ b/TODO @@ -59,7 +59,7 @@ * scd ** Application context vs. reader slot - We have 2 concurrent method of tracking whether a read is in use: + We have 2 concurrent method of tracking whether a reader is in use: Using the session_list in command.c and the lock_table in app.c. IT would be better to do this just at one place. First we need to see how we can support cards with multiple applications. diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c index ee01b4e15..4631eadea 100644 --- a/agent/call-pinentry.c +++ b/agent/call-pinentry.c @@ -1,4 +1,4 @@ -/* call-pinnetry.c - fork of the pinentry to query stuff from the user +/* call-pinentry.c - fork of the pinentry to query stuff from the user * Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc. * * This file is part of GnuPG. diff --git a/doc/ChangeLog b/doc/ChangeLog index ec629cbaa..b74589576 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2007-07-17 Werner Koch + + * gpgsm.texi (Input and Output): Document --default-key. + 2007-07-04 Werner Koch * gpl.texi: Updated to GPLv3. diff --git a/doc/gpgsm.texi b/doc/gpgsm.texi index b318ab877..23e88afeb 100644 --- a/doc/gpgsm.texi +++ b/doc/gpgsm.texi @@ -457,6 +457,14 @@ that @command{gpgsm} itself automagically imports any file with a passphrase encoded to the most commonly used encodings. +@item --default-key @var{user_id} +@opindex default-key +Use @var{user_id} as the standard key for signing. This key is used if +no other key has been defined as a signing key. Note, that the first +@option{--local-users} option also sets this key if it has not yet been +set; however @option{--default-key} always overrides this. + + @item --local-user @var{user_id} @item -u @var{user_id} @opindex local-user diff --git a/g10/ChangeLog b/g10/ChangeLog index 86d1da562..68b1eb1fb 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,9 @@ +2007-07-17 Werner Koch + + * gpg.c (gpgconf_list): Declare --encrypt-to and --default-key. + + * card-util.c (get_manufacturer): Add the unmanaged S/N range. + 2007-07-12 Werner Koch * gpg.c (main): Use translate_sys2libc_fd_int when passing an int diff --git a/g10/card-util.c b/g10/card-util.c index 751f700ea..d53edc55e 100644 --- a/g10/card-util.c +++ b/g10/card-util.c @@ -153,12 +153,15 @@ get_manufacturer (unsigned int no) /* Note: Make sure that there is no colon or linefeed in the string. */ switch (no) { - case 0: - case 0xffff: return "test card"; case 0x0001: return "PPC Card Systems"; case 0x0002: return "Prism"; case 0x0003: return "OpenFortress"; - default: return "unknown"; + /* 0x00000 and 0xFFFF are defined as test cards per spec, + 0xFFF00 to 0xFFFE are assigned for use with randomly created + serial numbers. */ + case 0x0000: + case 0xffff: return "test card"; + default: return (no & 0xff00) == 0xff00? "unmanaged S/N range":"unknown"; } } diff --git a/g10/gpg.c b/g10/gpg.c index 49c29c992..a0fc17694 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -1467,6 +1467,8 @@ gpgconf_list (const char *configfile) printf ("quiet:%lu:\n", GC_OPT_FLAG_NONE); printf ("keyserver:%lu:\n", GC_OPT_FLAG_NONE); printf ("reader-port:%lu:\n", GC_OPT_FLAG_NONE); + printf ("default-key:%lu:\n", GC_OPT_FLAG_NONE); + printf ("encrypt-to:%lu:\n", GC_OPT_FLAG_NONE); xfree (configfile_esc); } diff --git a/sm/ChangeLog b/sm/ChangeLog index 1736b6213..7b64d47f7 100644 --- a/sm/ChangeLog +++ b/sm/ChangeLog @@ -1,3 +1,8 @@ +2007-07-17 Werner Koch + + * gpgsm.c (main): Implement --default-key. + (main) : Declare --default-key and --encrypt-to. + 2007-07-16 Werner Koch * server.c (cmd_message): Use gnupg_fd_t to avoid dependecy on diff --git a/sm/gpgsm.c b/sm/gpgsm.c index 4e880c814..c00c01c9d 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -1101,8 +1101,11 @@ main ( int argc, char **argv) case oNoGreeting: nogreeting = 1; break; case oDefaultKey: - /* fixme:opt.def_secret_key = pargs.r.ret_str;*/ - log_info ("WARNING: --default-key has not yet been implemented\n"); + if (*pargs.r.ret_str) + { + xfree (opt.local_user); + opt.local_user = xstrdup (pargs.r.ret_str); + } break; case oDefRecipient: if (*pargs.r.ret_str) @@ -1139,9 +1142,9 @@ main ( int argc, char **argv) case oTextmodeShort: /*fixme:opt.textmode = 2;*/ break; case oTextmode: /*fixme:opt.textmode=1;*/ break; - case oUser: /* store the local users, the first one is the default */ + case oUser: /* Store the local users, the first one is the default */ if (!opt.local_user) - opt.local_user = pargs.r.ret_str; + opt.local_user = xstrdup (pargs.r.ret_str); add_to_strlist (&locusr, pargs.r.ret_str); break; @@ -1424,6 +1427,10 @@ main ( int argc, char **argv) GC_OPT_FLAG_DEFAULT ); printf ("p12-charset:%lu:\n", GC_OPT_FLAG_DEFAULT ); + printf ("default-key:%lu:\n", + GC_OPT_FLAG_DEFAULT ); + printf ("encrypt-to:%lu:\n", + GC_OPT_FLAG_DEFAULT ); } break; diff --git a/sm/sign.c b/sm/sign.c index 9c2be1f5a..a8908cf62 100644 --- a/sm/sign.c +++ b/sm/sign.c @@ -122,8 +122,9 @@ hash_and_copy_data (int fd, gcry_md_hd_t md, ksba_writer_t writer) } -/* Get the default certificate which is defined as the first cabable - of signing our keyDB returns and has a secret key available. */ +/* Get the default certificate which is defined as the first + certificate capable of signing returned by the keyDB and has a + secret key available. */ int gpgsm_get_default_cert (ctrl_t ctrl, ksba_cert_t *r_cert) { @@ -364,7 +365,7 @@ gpgsm_sign (ctrl_t ctrl, certlist_t signerlist, goto leave; } - /* If no list of signers is given, use a default one. */ + /* If no list of signers is given, use the default certificate. */ if (!signerlist) { ksba_cert_t cert = get_default_signer (ctrl); @@ -376,8 +377,7 @@ gpgsm_sign (ctrl_t ctrl, certlist_t signerlist, } /* Although we don't check for ambigious specification we will - check that the signer's certificate is is usable and - valid. */ + check that the signer's certificate is usable and valid. */ rc = gpgsm_cert_use_sign_p (cert); if (!rc) rc = gpgsm_validate_chain (ctrl, cert, NULL, 0, NULL, 0); diff --git a/tools/ChangeLog b/tools/ChangeLog index 2afcf51b7..c5acee5da 100644 --- a/tools/ChangeLog +++ b/tools/ChangeLog @@ -1,3 +1,8 @@ +2007-07-17 Werner Koch + + * gpgconf-comp.c: Add --encrypt-to and --default-key to gpg and + gpgsm. + 2007-07-16 Marcus Brinkmann * gpg-connect-agent.c (main): Bail out if write fails. diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c index ba147ad48..ae2902b94 100644 --- a/tools/gpgconf-comp.c +++ b/tools/gpgconf-comp.c @@ -616,6 +616,12 @@ static gc_option_t gc_options_gpg[] = { "Configuration", GC_OPT_FLAG_GROUP, GC_LEVEL_EXPERT, "gnupg", N_("Options controlling the configuration") }, + { "default-key", GC_OPT_FLAG_NONE, GC_LEVEL_BASIC, + "gnupg", N_("|NAME|use NAME as default secret key"), + GC_ARG_TYPE_STRING, GC_BACKEND_GPG }, + { "encrypt-to", GC_OPT_FLAG_NONE, GC_LEVEL_BASIC, + "gnupg", N_("|NAME|encrypt to user ID NAME as well"), + GC_ARG_TYPE_STRING, GC_BACKEND_GPG }, { "options", GC_OPT_FLAG_NONE, GC_LEVEL_EXPERT, "gnupg", "|FILE|read options from FILE", GC_ARG_TYPE_PATHNAME, GC_BACKEND_GPG }, @@ -672,6 +678,12 @@ static gc_option_t gc_options_gpgsm[] = { "Configuration", GC_OPT_FLAG_GROUP, GC_LEVEL_EXPERT, "gnupg", N_("Options controlling the configuration") }, + { "default-key", GC_OPT_FLAG_NONE, GC_LEVEL_BASIC, + "gnupg", N_("|NAME|use NAME as default secret key"), + GC_ARG_TYPE_STRING, GC_BACKEND_GPGSM }, + { "encrypt-to", GC_OPT_FLAG_NONE, GC_LEVEL_BASIC, + "gnupg", N_("|NAME|encrypt to user ID NAME as well"), + GC_ARG_TYPE_STRING, GC_BACKEND_GPGSM }, { "options", GC_OPT_FLAG_NONE, GC_LEVEL_EXPERT, "gnupg", "|FILE|read options from FILE", GC_ARG_TYPE_PATHNAME, GC_BACKEND_GPGSM },