[svn] dirmngr - r299 - trunk/src

svn author marcus cvs at cvs.gnupg.org
Mon May 26 17:07:05 CEST 2008


Author: marcus
Date: 2008-05-26 17:07:04 +0200 (Mon, 26 May 2008)
New Revision: 299

Modified:
   trunk/src/ChangeLog
   trunk/src/dirmngr.c
Log:
2008-05-26  Marcus Brinkmann  <marcus at g10code.com>

	* dirmngr.c (main) [HAVE_W32_SYSTEM]: Switch to system
	configuration on gpgconf related commands, and make all options
	unchangeable.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2008-03-25 03:47:41 UTC (rev 298)
+++ trunk/src/ChangeLog	2008-05-26 15:07:04 UTC (rev 299)
@@ -1,3 +1,9 @@
+2008-05-26  Marcus Brinkmann  <marcus at g10code.com>
+
+	* dirmngr.c (main) [HAVE_W32_SYSTEM]: Switch to system
+	configuration on gpgconf related commands, and make all options
+	unchangeable.
+
 2008-03-25  Marcus Brinkmann  <marcus at g10code.de>
 
 	* dirmngr_ldap.c (print_ldap_entries): Add code alternative for

Modified: trunk/src/dirmngr.c
===================================================================
--- trunk/src/dirmngr.c	2008-03-25 03:47:41 UTC (rev 298)
+++ trunk/src/dirmngr.c	2008-05-26 15:07:04 UTC (rev 299)
@@ -694,6 +694,14 @@
 	  opt.system_service = 1;
 	  opt.system_daemon = 1;
 	}
+#ifdef HAVE_W32_SYSTEM
+      else if (pargs.r_opt == aGPGConfList || pargs.r_opt == aGPGConfTest)
+	/* We set this so we switch to the system configuration
+	   directory below.  This is a crutch to solve the problem
+	   that the user configuration is never used on Windows.  Also
+	   see below at aGPGConfList.  */
+        opt.system_daemon = 1;
+#endif
     }
 
   /* If --daemon has been given on the command line but not --homedir,
@@ -1142,6 +1150,7 @@
     dirmngr_exit (0);
   else if (cmd == aGPGConfList)
     {
+      unsigned long flags = 0;
       char *filename;
       char *filename_esc;
 
@@ -1160,7 +1169,17 @@
 /* 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)
+#define GC_OPT_FLAG_NO_CHANGE   (1UL <<7)
 
+#ifdef HAVE_W32_SYSTEM
+      /* On Windows systems, dirmngr always runs as system daemon, and
+	 the per-user configuration is never used.  So we short-cut
+	 everything to use the global system configuration of dirmngr
+	 above, and here we set the no change flag to make these
+	 read-only.  */
+      flags |= GC_OPT_FLAG_NO_CHANGE;
+#endif
+
       /* First the configuration file.  This is not an option, but it
 	 is vital information for GPG Conf.  */
       if (!opt.config_filename)
@@ -1172,11 +1191,11 @@
               GC_OPT_FLAG_DEFAULT, filename);
       xfree (filename);
 
-      printf ("verbose:%lu:\n", GC_OPT_FLAG_NONE);
-      printf ("quiet:%lu:\n", GC_OPT_FLAG_NONE);
-      printf ("debug-level:%lu:\"none\n", GC_OPT_FLAG_DEFAULT);
-      printf ("log-file:%lu:\n", GC_OPT_FLAG_NONE);
-      printf ("force:%lu:\n", GC_OPT_FLAG_NONE);
+      printf ("verbose:%lu:\n", flags | GC_OPT_FLAG_NONE);
+      printf ("quiet:%lu:\n", flags | GC_OPT_FLAG_NONE);
+      printf ("debug-level:%lu:\"none\n", flags | GC_OPT_FLAG_DEFAULT);
+      printf ("log-file:%lu:\n", flags | GC_OPT_FLAG_NONE);
+      printf ("force:%lu:\n", flags | GC_OPT_FLAG_NONE);
 
       /* --csh and --sh are mutually exclusive, something we can not
          express in GPG Conf.  --options is only usable from the
@@ -1195,28 +1214,28 @@
       xfree (filename);
 
       printf ("ldaptimeout:%lu:%u\n",
-              GC_OPT_FLAG_DEFAULT, DEFAULT_LDAP_TIMEOUT);
+              flags | GC_OPT_FLAG_DEFAULT, DEFAULT_LDAP_TIMEOUT);
       printf ("max-replies:%lu:%u\n",
-              GC_OPT_FLAG_DEFAULT, DEFAULT_MAX_REPLIES);
-      printf ("allow-ocsp:%lu:\n", GC_OPT_FLAG_NONE);
-      printf ("ocsp-responder:%lu:\n", GC_OPT_FLAG_NONE);
-      printf ("ocsp-signer:%lu:\n", GC_OPT_FLAG_NONE);
+              flags | GC_OPT_FLAG_DEFAULT, DEFAULT_MAX_REPLIES);
+      printf ("allow-ocsp:%lu:\n", flags | GC_OPT_FLAG_NONE);
+      printf ("ocsp-responder:%lu:\n", flags | GC_OPT_FLAG_NONE);
+      printf ("ocsp-signer:%lu:\n", flags | GC_OPT_FLAG_NONE);
 
-      printf ("faked-system-time:%lu:\n", GC_OPT_FLAG_NONE);
-      printf ("no-greeting:%lu:\n", GC_OPT_FLAG_NONE);
+      printf ("faked-system-time:%lu:\n", flags | GC_OPT_FLAG_NONE);
+      printf ("no-greeting:%lu:\n", flags | GC_OPT_FLAG_NONE);
 
-      printf ("disable-http:%lu:\n", GC_OPT_FLAG_NONE);
-      printf ("disable-ldap:%lu:\n", GC_OPT_FLAG_NONE);
-      printf ("honor-http-proxy:%lu\n", GC_OPT_FLAG_NONE);
-      printf ("http-proxy:%lu:\n", GC_OPT_FLAG_NONE);
-      printf ("ldap-proxy:%lu:\n", GC_OPT_FLAG_NONE);
-      printf ("only-ldap-proxy:%lu:\n", GC_OPT_FLAG_NONE);
-      printf ("ignore-ldap-dp:%lu:\n", GC_OPT_FLAG_NONE);
-      printf ("ignore-http-dp:%lu:\n", GC_OPT_FLAG_NONE);
-      printf ("ignore-ocsp-service-url:%lu:\n", GC_OPT_FLAG_NONE);
+      printf ("disable-http:%lu:\n", flags | GC_OPT_FLAG_NONE);
+      printf ("disable-ldap:%lu:\n", flags | GC_OPT_FLAG_NONE);
+      printf ("honor-http-proxy:%lu\n", flags | GC_OPT_FLAG_NONE);
+      printf ("http-proxy:%lu:\n", flags | GC_OPT_FLAG_NONE);
+      printf ("ldap-proxy:%lu:\n", flags | GC_OPT_FLAG_NONE);
+      printf ("only-ldap-proxy:%lu:\n", flags | GC_OPT_FLAG_NONE);
+      printf ("ignore-ldap-dp:%lu:\n", flags | GC_OPT_FLAG_NONE);
+      printf ("ignore-http-dp:%lu:\n", flags | GC_OPT_FLAG_NONE);
+      printf ("ignore-ocsp-service-url:%lu:\n", flags | GC_OPT_FLAG_NONE);
       /* Note: The next one is to fix a typo in gpgconf - should be
          removed eventually. */
-      printf ("ignore-ocsp-servic-url:%lu:\n", GC_OPT_FLAG_NONE);
+      printf ("ignore-ocsp-servic-url:%lu:\n", flags | GC_OPT_FLAG_NONE);
     }
   cleanup ();
   return !!rc;




More information about the Gnupg-commits mailing list