[svn] GnuPG - r4168 - trunk/g10
svn author dshaw
cvs at cvs.gnupg.org
Fri Jun 23 00:56:57 CEST 2006
Author: dshaw
Date: 2006-06-23 00:56:54 +0200 (Fri, 23 Jun 2006)
New Revision: 4168
Modified:
trunk/g10/ChangeLog
trunk/g10/gpg.c
trunk/g10/keygen.c
trunk/g10/options.h
Log:
* options.h, gpg.c (main), keygen.c (keygen_upd_std_prefs,
keygen_add_std_prefs, proc_parameter_file): Add --default-keyserver-url to
specify a keyserver URL at key generation time, and "Keyserver:" keyword
for doing the same through a batch file.
Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog 2006-06-22 19:17:21 UTC (rev 4167)
+++ trunk/g10/ChangeLog 2006-06-22 22:56:54 UTC (rev 4168)
@@ -1,5 +1,11 @@
2006-06-22 David Shaw <dshaw at jabberwocky.com>
+ * options.h, gpg.c (main), keygen.c (keygen_upd_std_prefs,
+ keygen_add_std_prefs, proc_parameter_file): Add
+ --default-keyserver-url to specify a keyserver URL at key
+ generation time, and "Keyserver:" keyword for doing the same
+ through a batch file.
+
* sign.c (do_sign): Accept a truncated hash even for DSA1 keys (be
liberal in what you accept, etc).
Modified: trunk/g10/gpg.c
===================================================================
--- trunk/g10/gpg.c 2006-06-22 19:17:21 UTC (rev 4167)
+++ trunk/g10/gpg.c 2006-06-22 22:56:54 UTC (rev 4168)
@@ -333,6 +333,7 @@
oNoAutoCheckTrustDB,
oPreservePermissions,
oDefaultPreferenceList,
+ oDefaultKeyserverURL,
oPersonalCipherPreferences,
oPersonalDigestPreferences,
oPersonalCompressPreferences,
@@ -667,6 +668,7 @@
{ aRebuildKeydbCaches, "rebuild-keydb-caches", 256, "@"},
{ oPreservePermissions, "preserve-permissions", 0, "@"},
{ oDefaultPreferenceList, "default-preference-list", 2, "@"},
+ { oDefaultKeyserverURL, "default-keyserver-url", 2, "@"},
{ oPersonalCipherPreferences, "personal-cipher-preferences", 2, "@"},
{ oPersonalDigestPreferences, "personal-digest-preferences", 2, "@"},
{ oPersonalCompressPreferences, "personal-compress-preferences", 2, "@"},
@@ -2652,6 +2654,19 @@
case oDefaultPreferenceList:
opt.def_preference_list = pargs.r.ret_str;
break;
+ case oDefaultKeyserverURL:
+ {
+ struct keyserver_spec *keyserver;
+ keyserver=parse_keyserver_uri(pargs.r.ret_str,1,
+ configname,configlineno);
+ if(!keyserver)
+ log_error(_("could not parse keyserver URL\n"));
+ else
+ free_keyserver_spec(keyserver);
+
+ opt.def_keyserver_url = pargs.r.ret_str;
+ }
+ break;
case oPersonalCipherPreferences:
pers_cipher_list=pargs.r.ret_str;
break;
Modified: trunk/g10/keygen.c
===================================================================
--- trunk/g10/keygen.c 2006-06-22 19:17:21 UTC (rev 4167)
+++ trunk/g10/keygen.c 2006-06-22 22:56:54 UTC (rev 4168)
@@ -41,6 +41,7 @@
#include "status.h"
#include "i18n.h"
#include "cardglue.h"
+#include "keyserver-internal.h"
#define MAX_PREFS 30
@@ -66,7 +67,8 @@
pPASSPHRASE_S2K,
pSERIALNO,
pBACKUPENCDIR,
- pHANDLE
+ pHANDLE,
+ pKEYSERVER
};
struct para_data_s {
@@ -655,6 +657,7 @@
/* Make sure that the MDC feature flag is set if needed */
add_feature_mdc (sig,mdc_available);
add_keyserver_modify (sig,ks_modify);
+ keygen_add_keyserver_url(sig,NULL);
return 0;
}
@@ -673,6 +676,7 @@
do_add_key_flags (sig, pk->pubkey_usage);
keygen_add_key_expire( sig, opaque );
keygen_upd_std_prefs (sig, opaque);
+ keygen_add_keyserver_url(sig,NULL);
return 0;
}
@@ -682,6 +686,9 @@
{
const char *url=opaque;
+ if(!url)
+ url=opt.def_keyserver_url;
+
if(url)
build_sig_subpkt(sig,SIGSUBPKT_PREF_KS,url,strlen(url));
else
@@ -2238,6 +2245,25 @@
/* Set preferences, if any. */
keygen_set_std_prefs(get_parameter_value( para, pPREFERENCES ), 0);
+ /* Set keyserver, if any. */
+ s1=get_parameter_value( para, pKEYSERVER );
+ if(s1)
+ {
+ struct keyserver_spec *spec;
+
+ spec=parse_keyserver_uri(s1,1,NULL,0);
+ if(spec)
+ {
+ free_keyserver_spec(spec);
+ opt.def_keyserver_url=s1;
+ }
+ else
+ {
+ log_error("%s:%d: invalid keyserver url\n", fname, r->lnr );
+ return -1;
+ }
+ }
+
/* Set revoker, if any. */
if (parse_revocation_key (fname, para, pREVOKER))
return -1;
@@ -2330,6 +2356,7 @@
{ "Preferences", pPREFERENCES },
{ "Revoker", pREVOKER },
{ "Handle", pHANDLE },
+ { "Keyserver", pKEYSERVER },
{ NULL, 0 }
};
IOBUF fp;
Modified: trunk/g10/options.h
===================================================================
--- trunk/g10/options.h 2006-06-22 19:17:21 UTC (rev 4167)
+++ trunk/g10/options.h 2006-06-22 22:56:54 UTC (rev 4168)
@@ -154,7 +154,8 @@
unsigned int export_options;
unsigned int list_options;
unsigned int verify_options;
- char *def_preference_list;
+ const char *def_preference_list;
+ const char *def_keyserver_url;
prefitem_t *personal_cipher_prefs;
prefitem_t *personal_digest_prefs;
prefitem_t *personal_compress_prefs;
More information about the Gnupg-commits
mailing list