From 050b96f79077b1514829f49a89ce2a1acda0a483 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 16 Mar 2004 18:59:09 +0000 Subject: [PATCH] (main): Implemented --gpgconf-list. --- sm/ChangeLog | 4 ++++ sm/certlist.c | 1 + sm/gpgsm.c | 56 ++++++++++++++++++++++++++++++++++++++------------- 3 files changed, 47 insertions(+), 14 deletions(-) diff --git a/sm/ChangeLog b/sm/ChangeLog index 18431c11c..210448643 100644 --- a/sm/ChangeLog +++ b/sm/ChangeLog @@ -1,3 +1,7 @@ +2004-03-16 Werner Koch + + * gpgsm.c (main): Implemented --gpgconf-list. + 2004-03-15 Werner Koch * keylist.c (list_cert_colon): Hack to set the expired flag. diff --git a/sm/certlist.c b/sm/certlist.c index 8ee3c2caf..6e694b781 100644 --- a/sm/certlist.c +++ b/sm/certlist.c @@ -40,6 +40,7 @@ static const char oid_kp_clientAuth[] = "1.3.6.1.5.5.7.3.2"; static const char oid_kp_codeSigning[] = "1.3.6.1.5.5.7.3.3"; static const char oid_kp_emailProtection[]= "1.3.6.1.5.5.7.3.4"; static const char oid_kp_timeStamping[] = "1.3.6.1.5.5.7.3.8"; +static const char oid_kp_ocspSigning[] = "1.3.6.1.5.6.7.3.9"; /* Return 0 if the cert is usable for encryption. A MODE of 0 checks for signing a MODE of 1 checks for encryption, a MODE of 2 checks diff --git a/sm/gpgsm.c b/sm/gpgsm.c index ca7fbfcca..6b8a2ea49 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -690,6 +690,7 @@ main ( int argc, char **argv) CERTLIST recplist = NULL; CERTLIST signerlist = NULL; int do_not_setup_keys = 0; + char *config_filename = NULL; /* trap_unaligned ();*/ set_strusage (my_strusage); @@ -1116,7 +1117,8 @@ main ( int argc, char **argv) { fclose (configfp); configfp = NULL; - xfree (configname); + /* Keep a copy of the config filename. */ + config_filename = configname; configname = NULL; goto next_pass; } @@ -1259,21 +1261,47 @@ main ( int argc, char **argv) { case aGPGConfList: { /* List options and default values in the GPG Conf format. */ - char *filename; - /* First the default configuration file. This is not an - option, but it is vital information for GPG Conf. */ - filename = make_filename (opt.homedir, "gpgsm.conf", NULL); - printf ("gpgconf-gpgsm.conf:\"%s\n", filename); - xfree (filename); + /* The following list is taken from gnupg/tools/gpgconf-comp.c. */ + /* Option flags. YOU MUST NOT CHANGE THE NUMBERS OF THE EXISTING + FLAGS, AS THEY ARE PART OF THE EXTERNAL INTERFACE. */ +#define GC_OPT_FLAG_NONE 0UL + /* The RUNTIME flag for an option indicates that the option can be + changed at runtime. */ +#define GC_OPT_FLAG_RUNTIME (1UL << 3) + /* The DEFAULT flag for an option indicates that the option has a + default value. */ +#define GC_OPT_FLAG_DEFAULT (1UL << 4) + /* The DEF_DESC flag for an option indicates that the option has a + default, which is described by the value of the default field. */ +#define GC_OPT_FLAG_DEF_DESC (1UL << 5) + /* The NO_ARG_DESC flag for an option indicates that the argument has + a default, which is described by the value of the ARGDEF field. */ +#define GC_OPT_FLAG_NO_ARG_DESC (1UL << 6) + + printf ("gpgconf-gpgsm.conf:%lu:\"%s\"\n", + GC_OPT_FLAG_DEFAULT, + config_filename?config_filename:"/dev/null"); + + printf ("verbose:%lu:\n" + "quiet:%lu:\n" + "debug-level:%lu:\"none\":\n" + "log-file:%lu:\n", + GC_OPT_FLAG_NONE, + GC_OPT_FLAG_NONE, + GC_OPT_FLAG_DEFAULT, + GC_OPT_FLAG_NONE ); + printf ("disable-crl-checks:%lu:\n", + GC_OPT_FLAG_NONE ); + printf ("enable-ocsp:%lu:\n", + GC_OPT_FLAG_NONE ); + printf ("include-certs:%lu:1:\n", + GC_OPT_FLAG_DEFAULT ); + printf ("disable-policy-checks:%lu:\n", + GC_OPT_FLAG_NONE ); + printf ("auto-issuer-key-retrieve:%lu:\n", + GC_OPT_FLAG_NONE ); - printf ("verbose:\n" - "quiet:\n" - "debug-level:none\n" - "log-file:\n" - "force:\n" - "faked-system-time:\n" - "no-greeting:\n"); } break;