]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
* Fix path canonicalization on the server, enabling bos getlog with a
authorRuss Allbery <rra@debian.org>
Thu, 16 Nov 2006 00:15:05 +0000 (00:15 +0000)
committerRuss Allbery <rra@debian.org>
Thu, 16 Nov 2006 00:15:05 +0000 (00:15 +0000)
  simple log name to work properly against a Debian bosserver.

debian/changelog
src/util/dirpath.c

index 51c5ffbe8462d97c73cbac8a9d85a8a3603190a2..5577145b423daa39c998dc35cb34f601a76ea828 100644 (file)
@@ -3,6 +3,8 @@ openafs (1.4.2-3) unstable; urgency=low
   * No longer pass explicit cache tuning options to afsd and instead let
     OpenAFS automatically choose tuning based on the cache size.
   * Accept trailing whitespace in ThisCell.
+  * Fix path canonicalization on the server, enabling bos getlog with a
+    simple log name to work properly against a Debian bosserver.
   * Change the documentation of afsd -shutdown to be less dire and more
     accurate.  Thanks, Daniel J. Priem.  (Closes: #394990)
   * Document (at least partially) AFS's mapping of Kerberos v5 principal
@@ -10,7 +12,7 @@ openafs (1.4.2-3) unstable; urgency=low
     J. Priem.  (Closes: #394832)
   * Document that aklog -setpag may not always work.
 
- -- Russ Allbery <rra@debian.org>  Wed, 15 Nov 2006 15:31:28 -0800
+ -- Russ Allbery <rra@debian.org>  Wed, 15 Nov 2006 16:14:52 -0800
 
 openafs (1.4.2-2) unstable; urgency=low
 
index 092271b29bb4991f3286946d9f416970bf90c92e..a3e9effbed44f0c9091cb2a8b6cadc3886c4517b 100644 (file)
@@ -420,17 +420,25 @@ getDirPath(afsdir_id_t string_id)
 /*
  * LocalizePathHead() -- Make path relative to local part
  *
- * ConstructLocalPath takes a path  and a directory that path should
- * be considered relative to.   This  function checks the given path
- * for   a prefix  that represents a canonical path.  If such a prefix
- * is found,  the path is adjusted to remove the prefix and the path
- * is considered  relative to the local version of that path.
+ * ConstructLocalPath takes a path and a directory that path should
+ * be considered relative to.  There are two possible cases:
+ *
+ * The path is an absolute path.  In this case, the relative path
+ * is ignored.  We check the path for a prefix that represents a
+ * canonical path, and if one is found, we adjust the path to remove
+ * the prefix and adjust the directory to which it should be
+ * considered relative to be the local version of that canonical path.
+ *
+ * The path is a relative path.  In this case, we check to see if the
+ * directory to which it is relative represents a canonical path, and
+ * if so, we adjust that directory to be the local version of that
+ * canonical path.  The relative path itself is left unchanged.
  */
 
 /* The following array  maps cannonical parts to local parts.  It
  * might  seem reasonable to  simply construct an array in parallel to
  * dirpatharray  but it turns out you don't want translations for all
- local paths.
local paths.
 */
 
 struct canonmapping {
@@ -448,15 +456,25 @@ static struct canonmapping CanonicalTranslations[] = {
 static void
 LocalizePathHead(const char **path, const char **relativeTo)
 {
-    struct canonmapping *current;
-    for (current = CanonicalTranslations; current->local != NULL; current++) {
-       int canonlength = strlen(current->canonical);
-       if (strncmp(*path, current->canonical, canonlength) == 0) {
-           (*path) += canonlength;
-           if (**path == '/')
-               (*path)++;
-           *relativeTo = current->local;
-           return;
+    struct canonmapping *map;
+
+    if (**path == '/') {
+       for (map = CanonicalTranslations; map->local != NULL; map++) {
+           int canonlength = strlen(map->canonical);
+           if (strncmp(*path, map->canonical, canonlength) == 0) {
+               (*path) += canonlength;
+               if (**path == '/')
+                   (*path)++;
+               *relativeTo = map->local;
+               return;
+           }
+       }
+    } else {
+       for (map = CanonicalTranslations; map->local != NULL; map++) {
+           if (strcmp(*relativeTo, map->canonical) == 0) {
+               *relativeTo = map->local;
+               return;
+           }
        }
     }
 }