]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/directory.c
Back-port from HEAD: Do directory name matching using strcmp(), not
[netatalk.git] / etc / afpd / directory.c
index 6be7cb999bb04d98d15f98764d3245afa9b045d5..43fb6d150312f4bd118e4b9d6677b50626c511e0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: directory.c,v 1.39 2002-08-30 19:32:40 didg Exp $
+ * $Id: directory.c,v 1.41.2.2 2002-11-07 17:10:02 srittau Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -135,7 +135,8 @@ u_int32_t   did;
     char *ptr;
     static char buffer[12 + MAXPATHLEN + 1];
     int buflen = 12 + MAXPATHLEN + 1;
-
+    char *mpath;
+    
     ret = dirsearch(vol, did);
     if (ret != NULL)
         return ret;
@@ -145,10 +146,11 @@ u_int32_t did;
         return NULL;
     }
     ptr = path + MAXPATHLEN;
-    len = strlen(upath);
+    mpath = utompath(vol, upath);
+    len = strlen(mpath);
     pathlen = len;          /* no 0 in the last part */
     len++;
-    strcpy(ptr - len, upath);
+    strcpy(ptr - len, mpath);
     ptr -= len;
     while (1) {
         ret = dirsearch(vol,id);
@@ -157,11 +159,12 @@ u_int32_t did;
         }
         if ((upath = cnid_resolve(vol->v_db, &id, buffer, buflen)) == NULL)
             return NULL;
-        len = strlen(upath) + 1;
+        mpath = utompath(vol, upath);
+        len = strlen(mpath) + 1;
         pathlen += len;
         if (pathlen > 255)
             return NULL;
-        strcpy(ptr - len, upath);
+        strcpy(ptr - len, mpath);
         ptr -= len;
     }
     /* fill the cache */
@@ -862,7 +865,7 @@ char        **cpath;
             if ( !extend ) {
                 cdir = dir->d_child;
                 while (cdir) {
-                    if ( strcasecmp( cdir->d_name, path ) == 0 ) {
+                    if ( strcmp( cdir->d_name, path ) == 0 ) {
                         break;
                     }
                     cdir = (cdir == dir->d_child->d_prev) ? NULL :
@@ -878,7 +881,8 @@ char        **cpath;
                        /* dir is not valid anymore 
                           we delete dir from the cache and abort.
                        */
-                       dir_invalidate(vol, dir);
+                       if ( dir->d_did != DIRDID_ROOT_PARENT) 
+                           dir_invalidate(vol, dir);
                         return( NULL );
                     }
                     cdir = extenddir( vol, dir, path );
@@ -1171,7 +1175,7 @@ int               ibuflen, *rbuflen;
     memcpy( &did, ibuf, sizeof( did ));
     ibuf += sizeof( int );
 
-    if (( dir = dirsearch( vol, did )) == NULL ) {
+    if (( dir = dirlookup( vol, did )) == NULL ) {
         return( AFPERR_NOOBJ );
     }
 
@@ -1532,7 +1536,7 @@ int               ibuflen, *rbuflen;
 
     memcpy( &did, ibuf, sizeof( did ));
     ibuf += sizeof( did );
-    if (( dir = dirsearch( vol, did )) == NULL ) {
+    if (( dir = dirlookup( vol, did )) == NULL ) {
         return( AFPERR_NOOBJ );
     }
 
@@ -1961,7 +1965,7 @@ int               ibuflen, *rbuflen;
 
     memcpy( &did, ibuf, sizeof( did ));
     ibuf += sizeof( did );
-    if (( dir = dirsearch( vol, did )) == NULL ) {
+    if (( dir = dirlookup( vol, did )) == NULL ) {
         return( AFPERR_PARAM );
     }
 
@@ -1997,7 +2001,7 @@ int               ibuflen, *rbuflen;
     memcpy(&did, ibuf, sizeof(did));
     ibuf += sizeof(did);
 
-    if (( parentdir = dirsearch( vol, did )) == NULL ) {
+    if (( parentdir = dirlookup( vol, did )) == NULL ) {
         return( AFPERR_NOOBJ );
     }