[svn] dirmngr - r302 - in trunk: doc src

svn author wk cvs at cvs.gnupg.org
Mon Jun 16 16:12:54 CEST 2008


Author: wk
Date: 2008-06-16 16:12:53 +0200 (Mon, 16 Jun 2008)
New Revision: 302

Modified:
   trunk/doc/dirmngr.texi
   trunk/src/ChangeLog
   trunk/src/get-path.c
Log:
[W32] Move /etc/and /var/lib dir


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2008-06-12 14:22:42 UTC (rev 301)
+++ trunk/src/ChangeLog	2008-06-16 14:12:53 UTC (rev 302)
@@ -1,3 +1,9 @@
+2008-06-16  Werner Koch  <wk at g10code.com>
+
+	* get-path.c (w32_commondir): New.
+	(dirmngr_sysconfdir): Use it here.
+	(dirmngr_datadir): Ditto.
+
 2008-06-12  Marcus Brinkmann  <marcus at g10code.de>
 
 	* Makefile.am (dirmngr_SOURCES): Add ldapserver.h and ldapserver.c.

Modified: trunk/doc/dirmngr.texi
===================================================================
--- trunk/doc/dirmngr.texi	2008-06-12 14:22:42 UTC (rev 301)
+++ trunk/doc/dirmngr.texi	2008-06-16 14:12:53 UTC (rev 302)
@@ -177,7 +177,7 @@
 This directory should be filled with certificates of Root CAs you are
 trusting in checking the CRLS and signing OCSP Reponses.  Usually these
 are the same certificates you use with the applications making use of
-dirmngr.  It is expected that each of these certificates files contain
+dirmngr.  It is expected that each of these certificate files contain
 exactly one @acronym{DER} encoded certificate in a file with the suffix
 @file{.crt}.  @command{dirmngr} reads those certificates on startup and
 when given a SIGHUP.  Certificates which are not readable or do not make

Modified: trunk/src/get-path.c
===================================================================
--- trunk/src/get-path.c	2008-06-12 14:22:42 UTC (rev 301)
+++ trunk/src/get-path.c	2008-06-16 14:12:53 UTC (rev 302)
@@ -285,6 +285,9 @@
 #ifndef CSIDL_LOCAL_APPDATA
 #define CSIDL_LOCAL_APPDATA 0x001c
 #endif
+#ifndef CSIDL_COMMON_APPDATA
+#define CSIDL_COMMON_APPDATA 0x0023
+#endif
 #ifndef CSIDL_FLAG_CREATE
 #define CSIDL_FLAG_CREATE 0x8000
 #endif
@@ -357,7 +360,7 @@
                   xfree (tmp);
                   tmp = NULL;
                 }
-              if (tmp)
+               if (tmp)
                 saved_dir = tmp;
             }
           
@@ -406,6 +409,35 @@
   /* Fallback to the hardwired value. */
   return DIRMNGR_LIBEXECDIR;
 }
+
+static const char *
+w32_commondir (void)
+{
+  static char *dir;
+
+  if (!dir)
+    {
+      char path[MAX_PATH];
+
+      if (w32_shgetfolderpath (NULL, CSIDL_COMMON_APPDATA, 
+                               NULL, 0, path) >= 0) 
+        {
+          char *tmp = xmalloc (strlen (path) + 4 +1);
+          strcpy (stpcpy (tmp, path), "\\GNU");
+          dir = tmp;
+          /* No auto create of the directory.  Either the installer or
+             the admin has to create these directories.  */
+        }
+      else
+        {
+          /* Ooops: Not defined - probably an old Windows version.
+             Use the installation directory instead.  */
+          dir = xstrdup (w32_rootdir ());
+        }
+    }
+  
+  return dir;
+}
 #endif /*HAVE_W32_SYSTEM*/
 
 
@@ -423,7 +455,7 @@
   if (!name)
     {
       const char *s1, *s2;
-      s1 = w32_rootdir ();
+      s1 = w32_commondir ();
       s2 = DIRSEP_S "etc" DIRSEP_S "dirmngr";
       name = xmalloc (strlen (s1) + strlen (s2) + 1);
       strcpy (stpcpy (name, s1), s2);
@@ -457,7 +489,7 @@
   if (!name)
     {
       const char *s1, *s2;
-      s1 = w32_rootdir (); /* FIXME: /var in windows? */
+      s1 = w32_commondir ();
       s2 = DIRSEP_S "lib" DIRSEP_S "dirmngr";
       name = xmalloc (strlen (s1) + strlen (s2) + 1);
       strcpy (stpcpy (name, s1), s2);
@@ -529,7 +561,10 @@
       const char *s2;
 
       /* We need something akin CSIDL_COMMON_PROGRAMS, but local
-	 (non-roaming).  */
+	 (non-roaming).  This is becuase the file needs to be on the
+	 local machine and makes only sense on that machine.
+	 CSIDL_WINDOWS seems to be the only location which guarantees
+	 that. */
       if (w32_shgetfolderpath (NULL, CSIDL_WINDOWS, NULL, 0, s1) < 0)
 	strcpy (s1, "C:\\WINDOWS");
       s2 = DIRSEP_S "S.dirmngr";




More information about the Gnupg-commits mailing list