]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/directory.c
Fix test348 and 349
[netatalk.git] / etc / afpd / directory.c
index ef736f1c45d14857d522ce0431e8a3ac81991356..db531cf78bee798f3813054e4e6c1da7654fa548 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: directory.c,v 1.131.2.2 2010-02-01 12:59:09 franklahm Exp $
+ * $Id: directory.c,v 1.131.2.4 2010-02-01 16:13:52 franklahm Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -53,6 +53,7 @@ extern void addir_inherit_acl(const struct vol *vol);
  * o setdirparams doesn't change parent mdate anymore
  * o catsearch doesn't work, see FIXMEs in catsearch.c
  * o curdir per volume caching is gone
+ * o directory offspring count calculation probably broken
  */
 
 
@@ -282,8 +283,6 @@ static int cname_mtouname(const struct vol *vol, const struct dir *dir, struct p
     char *t;
     cnid_t fileid;
 
-    LOG(log_maxdebug, logtype_afpd, "cname_mtouname('%s', toUTF8:%u)", ret->m_name, toUTF8);
-
     if (afp_version >= 30) {
         if (toUTF8) {
             if (dir->d_did == DIRDID_ROOT_PARENT) {
@@ -308,6 +307,9 @@ static int cname_mtouname(const struct vol *vol, const struct dir *dir, struct p
 
         /* check for OS X mangled filename :( */
         t = demangle_osx(vol, ret->m_name, dir->d_did, &fileid);
+        LOG(log_maxdebug, logtype_afpd, "cname_mtouname('%s',did:%u) {demangled:'%s', fileid:%u}",
+            ret->m_name, ntohl(dir->d_did), t, ntohl(fileid));
+
         if (t != ret->m_name) {
             ret->u_name = t;
             /* duplicate work but we can't reuse all convert_char we did in demangle_osx
@@ -361,8 +363,16 @@ static struct path *path_from_dir(struct vol *vol, struct dir *dir, struct path
         }
 
         ret->d_dir = dir;
+#if 0
         ret->st_valid = 1;
         ret->st_errno = EACCES;
+#endif
+
+        LOG(log_debug, logtype_afpd, "cname(AFPERR_ACCESS:'%s') {path-from-dir: curdir:'%s', path:'%s'}",
+            cfrombstring(dir->d_fullpath),
+            cfrombstring(curdir->d_fullpath),
+            ret->u_name);
+
         return ret;
 
     case AFPERR_NOOBJ:
@@ -377,8 +387,10 @@ static struct path *path_from_dir(struct vol *vol, struct dir *dir, struct path
             memcpy(ret->u_name, cfrombstring(dir->d_u_name), blength(dir->d_u_name) + 1);
         }
 
+#if 0
         ret->st_valid = 1;
         ret->st_errno = ENOENT;
+#endif
         ret->d_dir = NULL;
         dir_remove(vol, dir);
         return ret;
@@ -2071,22 +2083,20 @@ int afp_createdir(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_
         return err;
     }
 
-    LOG(log_debug, logtype_afpd, "afp_createdir: alive1");
-
     if (of_stat(s_path) < 0) {
         return AFPERR_MISC;
     }
-    LOG(log_debug, logtype_afpd, "afp_createdir: alive2");
+
     curdir->offcnt++;
-    LOG(log_debug, logtype_afpd, "afp_createdir: alive3");
+
     if ((dir = dir_add(vol, curdir, s_path, strlen(s_path->u_name))) == NULL) {
         return AFPERR_MISC;
     }
-    LOG(log_debug, logtype_afpd, "afp_createdir: alive4");
+
     if ( movecwd( vol, dir ) < 0 ) {
         return( AFPERR_PARAM );
     }
-    LOG(log_debug, logtype_afpd, "afp_createdir: alive5");
+
     ad_init(&ad, vol->v_adouble, vol->v_ad_options);
     if (ad_open_metadata( ".", ADFLAGS_DIR, O_CREAT, &ad ) < 0)  {
         if (vol_noadouble(vol))