]> arthur.barton.de Git - netatalk.git/commitdiff
Remove ADFLAGS_CREATE. Dont create adouble metadata when enumerating
authorFrank Lahm <franklahm@googlemail.com>
Wed, 15 Dec 2010 16:01:02 +0000 (17:01 +0100)
committerFrank Lahm <franklahm@googlemail.com>
Wed, 15 Dec 2010 16:01:02 +0000 (17:01 +0100)
etc/afpd/directory.c
etc/afpd/file.c
include/atalk/adouble.h
libatalk/adouble/ad_open.c

index 55918eaeb8ed2ef6b8fa8dd0e064d01bc6c0ebbb..5f683a48d29001b4d45f0ed12638ec846485a407 100644 (file)
@@ -1382,20 +1382,8 @@ int getdirparams(const struct vol *vol,
                    (1 << DIRPBIT_FINFO)))) {
 
         ad_init(&ad, vol->v_adouble, vol->v_ad_options);
-        if ( !ad_metadata( upath, ADFLAGS_CREATE|ADFLAGS_DIR, &ad) ) {
+        if ( !ad_metadata( upath, ADFLAGS_DIR, &ad) )
             isad = 1;
-            if (ad.ad_md->adf_flags & O_CREAT) {
-                /* We just created it */
-                ad_setname(&ad, s_path->m_name);
-                ad_setid( &ad,
-                          s_path->st.st_dev,
-                          s_path->st.st_ino,
-                          dir->d_did,
-                          dir->d_pdid,
-                          vol->v_stamp);
-                ad_flush( &ad);
-            }
-        }
     }
 
     pdid = dir->d_pdid;
index 100e439b3d42bb4d00517ae7ae84f5c2fee837cf..61914389228d315029e31cc1bfd3fbcc723ae396 100644 (file)
@@ -623,7 +623,7 @@ int getfilparams(struct vol *vol,
         adp = of_ad(vol, path, &ad);
         upath = path->u_name;
 
-        if ( ad_metadata( upath, flags|ADFLAGS_CREATE, adp) < 0 ) {
+        if ( ad_metadata( upath, flags, adp) < 0 ) {
             switch (errno) {
             case EACCES:
                 LOG(log_error, logtype_afpd, "getfilparams(%s): %s: check resource fork permission?",
index a1a2ecbd8047ba9346a4248c77ff458a2208f641..58b9f8d8fdd756c8da479ef9504267ffb1c64347 100644 (file)
@@ -210,7 +210,6 @@ struct adouble {
 #define ADFLAGS_NOHF      (1<<4)  /* not an error if no ressource fork */
 #define ADFLAGS_RDONLY    (1<<5)  /* don't try readwrite */
 #define ADFLAGS_OPENFORKS (1<<6)  /* check for open fork in ad_metadata function */
-#define ADFLAGS_CREATE    (1<<7)
 
 #define ADVOL_NODEV      (1 << 0)
 #define ADVOL_CACHE      (1 << 1)
index fd6e9f56afed07addc3d02e6ab1e97033cfedf28..057745694ac36f3c2893116004b56dcfe22af974 100644 (file)
@@ -1136,16 +1136,13 @@ int ad_open(const char *path, int adflags, int oflags, int mode, struct adouble
  * @brief open metadata, possibly as root
  *
  * Return only metadata but try very hard ie at first try as user, then try as root.
+ * Caller must pass ADFLAGS_DIR for directories.
  *
  * @param name  name of file/dir
  * @param flags ADFLAGS_DIR: name is a directory \n
- *              ADFLAGS_CREATE: force creation of header file, but only as user, not as root\n
  *              ADFLAGS_OPENFORKS: test if name is open by another afpd process
  *
  * @param adp   pointer to struct adouble
- *
- * @note caller MUST pass ADFLAGS_DIR for directories. Whether ADFLAGS_CREATE really creates
- *       a adouble file depends on various other volume options, eg. ADVOL_CACHE
  */
 int ad_metadata(const char *name, int flags, struct adouble *adp)
 {
@@ -1155,12 +1152,6 @@ int ad_metadata(const char *name, int flags, struct adouble *adp)
 
     dir = flags & ADFLAGS_DIR;
 
-    /* Check if we shall call ad_open with O_CREAT */
-    if ( (adp->ad_options & ADVOL_CACHE)
-         && ! (adp->ad_options & ADVOL_NOADOUBLE)
-         && (flags & ADFLAGS_CREATE) ) {
-        create = O_CREAT | O_RDWR;
-    }
     if ((ret = ad_open(name, ADFLAGS_HF | dir, create, 0666, adp)) < 0 && errno == EACCES) {
         uid = geteuid();
         if (seteuid(0)) {