]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/file.c
with cnid the default replace dirsearch with dirlookup. dirsearch doesn't work
[netatalk.git] / etc / afpd / file.c
index 310fcdd7a2105b58d9912b0b39338298328ab2e5..9f8ca89a74f8cbc27d0a4bc4934b0b1b2fdbd342 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: file.c,v 1.57 2002-09-06 04:23:45 didg Exp $
+ * $Id: file.c,v 1.62 2002-10-05 14:04:47 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -59,11 +59,6 @@ char *strchr (), *strrchr ();
 #include "filedir.h"
 #include "globals.h"
 
-/* check for mtab DID code */
-#ifdef DID_MTAB
-#include "parse_mtab.h"
-#endif /* DID_MTAB */
-
 /* the format for the finderinfo fields (from IM: Toolbox Essentials):
  * field         bytes        subfield    bytes
  * 
@@ -263,11 +258,7 @@ int getmetadata(struct vol *vol,
                 aint = htonl(( st->st_dev << 16 ) | (st->st_ino & 0x0000ffff));
 #else /* USE_LASTDID */
                 lstp = lstat(upath, &lst) < 0 ? st : &lst;
-#ifdef DID_MTAB
-                aint = htonl( afpd_st_cnid ( lstp ) );
-#else /* DID_MTAB */
                 aint = htonl(CNID(lstp, 1));
-#endif /* DID_MTAB */
 #endif /* USE_LASTDID */
             }
 
@@ -370,7 +361,7 @@ int getfilparams(struct vol *vol,
     u_int16_t          attrbits = 0;
     int rc;    
 #ifdef DEBUG
-    LOG(log_info, logtype_default, "begin getfilparams:");
+    LOG(log_info, logtype_afpd, "begin getfilparams:");
 #endif /* DEBUG */
 
     upath = mtoupath(vol, path);
@@ -424,7 +415,7 @@ int         ibuflen, *rbuflen;
     struct adouble     ad, *adp;
     struct vol         *vol;
     struct dir         *dir;
-    struct ofork        *of;
+    struct ofork        *of = NULL;
     char               *path, *upath;
     int                        creatf, did, openf, retvalue = AFP_OK;
     u_int16_t          vid;
@@ -450,7 +441,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 );
     }
 
@@ -554,7 +545,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 );
     }
 
@@ -911,7 +902,7 @@ int         ibuflen, *rbuflen;
 
     memcpy(&sdid, ibuf, sizeof( sdid ));
     ibuf += sizeof( sdid );
-    if (( dir = dirsearch( vol, sdid )) == NULL ) {
+    if (( dir = dirlookup( vol, sdid )) == NULL ) {
         return( AFPERR_PARAM );
     }
 
@@ -933,13 +924,13 @@ int               ibuflen, *rbuflen;
      *      and locks need to stay coherent. as a result,
      *      we just balk if the file is opened already. */
 
+    newname = obj->newtmp;
+    strcpy( newname, path );
+
     upath = mtoupath(vol, newname );
     if (of_findname(upath, NULL))
         return AFPERR_DENYCONF;
 
-    newname = obj->newtmp;
-    strcpy( newname, path );
-
     p = ctoupath( vol, curdir, newname );
 #ifdef FORCE_UIDGID
     /* FIXME svid != dvid && dvid's user can't read svid */
@@ -951,7 +942,7 @@ int         ibuflen, *rbuflen;
     if (vol->v_flags & AFPVOL_RO)
         return AFPERR_VLOCK;
 
-    if (( dir = dirsearch( vol, ddid )) == NULL ) {
+    if (( dir = dirlookup( vol, ddid )) == NULL ) {
         return( AFPERR_PARAM );
     }
 
@@ -976,15 +967,14 @@ int               ibuflen, *rbuflen;
             return( AFPERR_PARAM );
         }
     }
-
-    if ( (err = copyfile(p, mtoupath(vol, newname), 
-                            newname, vol_noadouble(vol))) < 0 ) {
+    upath = mtoupath(vol, newname);
+    if ( (err = copyfile(p, upath , newname, vol_noadouble(vol))) < 0 ) {
         return err;
     }
 
 #ifdef DROPKLUDGE
     if (vol->v_flags & AFPVOL_DROPBOX) {
-        retvalue=matchfile2dirperms(newname, vol, sdid);
+        retvalue=matchfile2dirperms(upath, vol, ddid); /* FIXME sdir or ddid */
     }
 #endif /* DROPKLUDGE */
 
@@ -1403,7 +1393,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 );
     }
 
@@ -1675,7 +1665,7 @@ int               ibuflen, *rbuflen;
     ibuf += sizeof(did);
 
     /* source file */
-    if ((dir = dirsearch( vol, sid )) == NULL ) {
+    if ((dir = dirlookup( vol, sid )) == NULL ) {
         return( AFPERR_PARAM );
     }
 
@@ -1720,7 +1710,7 @@ int               ibuflen, *rbuflen;
                       slen = strlen(supath));
 #endif /* CNID_DB */
 
-    if (( dir = dirsearch( vol, did )) == NULL ) {
+    if (( dir = dirlookup( vol, did )) == NULL ) {
         return( AFPERR_PARAM );
     }