]> arthur.barton.de Git - netatalk.git/commitdiff
backport from head
authordidg <didg>
Mon, 12 May 2003 14:27:15 +0000 (14:27 +0000)
committerdidg <didg>
Mon, 12 May 2003 14:27:15 +0000 (14:27 +0000)
etc/afpd/catsearch.c
etc/afpd/directory.c

index 6432ed5bd2e47c94a41bcb4e72f0ae9f5f220ac2..a908e135b048ed4bc350d7e7ac38b62348da335c 100644 (file)
@@ -257,7 +257,7 @@ static struct adouble *adl_lkup(struct path *path)
                adp = &ad;
        } 
 
-       if ( ad_open( path->u_name, ADFLAGS_HF | (isdir)?ADFLAGS_DIR:0, O_RDONLY, 0, adp) < 0 ) {
+       if ( ad_open( path->u_name, ADFLAGS_HF | ((isdir)?ADFLAGS_DIR:0), O_RDONLY, 0, adp) < 0 ) {
                return NULL;
        } 
        return adp;     
@@ -684,6 +684,7 @@ int catsearch_afp(AFPObj *obj, char *ibuf, int ibuflen,
 {
     struct vol *vol;
     u_int16_t   vid;
+    u_int16_t   spec_len;
     u_int32_t   rmatches, reserved;
     u_int32_t  catpos[4];
     u_int32_t   pdid = 0;
@@ -729,32 +730,29 @@ int catsearch_afp(AFPObj *obj, char *ibuf, int ibuflen,
            return AFPERR_BITMAP;
     }
 
-    if ( ext)
-           ibuf++;
+    if ( ext) {
+        memcpy(&spec_len, ibuf, sizeof(spec_len));
+        spec_len = ntohs(spec_len);
+    }
+    else {
+        spec_len = *(unsigned char*)ibuf;
+    }
 
     /* Parse file specifications */
     spec1 = ibuf;
-    spec2 = ibuf + ibuf[0] + 2;
-    
-    if (ext)
-    {
-       spec1++; bspec1 = spec1;
-       spec2++; bspec2 = spec2;
-    }
-    else
-    {
-       spec1 += 2; bspec1 = spec1;
-       spec2 += 2; bspec2 = spec2;
-    }
+    spec2 = ibuf + spec_len + 2;
+
+    spec1 += 2; 
+    spec2 += 2; 
 
+    bspec1 = spec1;
+    bspec2 = spec2;
     /* File attribute bits... */
     if (c1.rbitmap & (1 << FILPBIT_ATTR)) {
-           memcpy(&c1.attr, ibuf, sizeof(c1.attr));
+           memcpy(&c1.attr, spec1, sizeof(c1.attr));
            spec1 += sizeof(c1.attr);
-           c1.attr = ntohs(c1.attr);
-           memcpy(&c2.attr, ibuf, sizeof(c2.attr));
+           memcpy(&c2.attr, spec2, sizeof(c2.attr));
            spec2 += sizeof(c1.attr);
-           c2.attr = ntohs(c2.attr);
     }
 
     /* Parent DID */
@@ -797,7 +795,7 @@ int catsearch_afp(AFPObj *obj, char *ibuf, int ibuflen,
     }
 
     /* Finder info */
-    if (c1.rbitmap * (1 << FILPBIT_FINFO)) {
+    if (c1.rbitmap & (1 << FILPBIT_FINFO)) {
            memcpy(&c1.finfo, spec1, sizeof(c1.finfo));
            spec1 += sizeof(c1.finfo);
            memcpy(&c2.finfo, spec2, sizeof(c2.finfo));
index 9bb902875a63482dc8ddd1e7eeab87f5b341bb0a..bad91d454a5d33c8c90b06b3cd05b613db2a3267 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: directory.c,v 1.71.2.1 2003-05-10 10:33:16 didg Exp $
+ * $Id: directory.c,v 1.71.2.2 2003-05-12 14:27:15 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -156,7 +156,7 @@ struct dir *dir;
         if ( strcmp( dir->d_u_name, name ) == 0 ) {
             break;
         }
-        dir = (dir == curdir->d_child->d_prev) ? NULL : dir->d_next;
+        dir = (dir == cdir->d_child->d_prev) ? NULL : dir->d_next;
     }
     return dir;
 }