]> arthur.barton.de Git - netatalk.git/commitdiff
don't create an adouble file in ad_metadata for noadouble volume
authordidg <didg>
Fri, 27 Nov 2009 12:37:24 +0000 (12:37 +0000)
committerdidg <didg>
Fri, 27 Nov 2009 12:37:24 +0000 (12:37 +0000)
etc/afpd/catsearch.c
etc/afpd/desktop.c
etc/afpd/directory.c
etc/afpd/extattrs.c
etc/afpd/file.c
etc/afpd/filedir.c
libatalk/adouble/ad_open.c

index 1197ecd9eca6d574136876348771fae212233977..28fe3411faa625143c74d3a66a038323faffd3b4 100644 (file)
@@ -215,7 +215,7 @@ static struct adouble *adl_lkup(struct vol *vol, struct path *path, struct adoub
                adp = &ad;
        } 
 
-    if ( ad_metadata( path->u_name, ((isdir)?ADFLAGS_DIR:0), adp) < 0 ) {
+    if ( ad_metadata( path->u_name, vol_noadouble(vol) | ((isdir)?ADFLAGS_DIR:0), adp) < 0 ) {
         adp = NULL; /* FIXME without resource fork adl_lkup will be call again */
     }
     
index 9ce7ad2aaeaa888ea65cc578f9dce9765947dff3..a679cf7d8180983cce9c86daa55ea900c83f6e54 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: desktop.c,v 1.46 2009-11-09 01:36:18 didg Exp $
+ * $Id: desktop.c,v 1.47 2009-11-27 12:37:24 didg Exp $
  *
  * See COPYRIGHT.
  *
@@ -766,7 +766,7 @@ static int ad_getcomment(struct vol *vol, struct path *path, char *rbuf, size_t
     } else
         adp = of->of_ad;
         
-    if ( ad_metadata( upath,( isadir) ? ADFLAGS_DIR : 0, adp) < 0 ) {
+    if ( ad_metadata( upath,vol_noadouble(vol) | ((isadir) ? ADFLAGS_DIR : 0), adp) < 0 ) {
         return( AFPERR_NOITEM );
     }
 
index a7362e0b8ab8f54eceb46a4191d2854e8d19bfad..d6845297a855ccfc55c340dcb007c7ace517ff91 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: directory.c,v 1.120 2009-11-26 18:17:12 franklahm Exp $
+ * $Id: directory.c,v 1.121 2009-11-27 12:37:24 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -1645,7 +1645,7 @@ int getdirparams(const struct vol *vol,
                    (1 << DIRPBIT_FINFO)))) {
 
         ad_init(&ad, vol->v_adouble, vol->v_ad_options);
-        if ( !ad_metadata( upath, ADFLAGS_DIR, &ad) ) {
+        if ( !ad_metadata( upath, vol_noadouble(vol) | ADFLAGS_DIR, &ad) ) {
             isad = 1;
         }
     }
@@ -2576,7 +2576,8 @@ int deletecurdir(struct vol *vol)
     fdir = curdir;
 
     ad_init(&ad, vol->v_adouble, vol->v_ad_options);
-    if ( ad_metadata( ".", ADFLAGS_DIR, &ad) == 0 ) {
+    /* we never want to create a resource fork here, we are going to delete it */
+    if ( ad_metadata( ".", ADFLAGS_NOADOUBLE | ADFLAGS_DIR, &ad) == 0 ) {
 
         ad_getattr(&ad, &ashort);
         ad_close( &ad, ADFLAGS_HF );
index 5a8bdad66b6eaf4e4035ffd7d037055aa6069dea..13e27a03bb836b7a7eee6e42e729af2cb81b30ce 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  $Id: extattrs.c,v 1.27 2009-11-17 18:10:48 franklahm Exp $
+  $Id: extattrs.c,v 1.28 2009-11-27 12:37:24 didg Exp $
   Copyright (c) 2009 Frank Lahm <franklahm@gmail.com>
 
   This program is free software; you can redistribute it and/or modify
@@ -150,7 +150,7 @@ int afp_listextattr(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf,
         if (S_ISDIR(st->st_mode))
             adflags = ADFLAGS_DIR;
 
-        if ( ad_metadata( uname, adflags, adp) < 0 ) {
+        if ( ad_metadata( uname, vol_noadouble(vol) | adflags, adp) < 0 ) {
             switch (errno) {
             case ENOENT:
                 adp = NULL;
index 050450a2b10a765082b979b9da56086c4df962cd..6cac22b27f0852593f5ca2b46df4a9f737501710 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: file.c,v 1.123 2009-11-26 15:02:58 franklahm Exp $
+ * $Id: file.c,v 1.124 2009-11-27 12:37:24 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -531,7 +531,7 @@ int getfilparams(struct vol *vol,
         adp = of_ad(vol, path, &ad);
         upath = path->u_name;
 
-        if ( ad_metadata( upath, flags, adp) < 0 ) {
+        if ( ad_metadata( upath, vol_noadouble(vol) | flags, adp) < 0 ) {
             switch (errno) {
             case EACCES:
                 LOG(log_error, logtype_afpd, "getfilparams(%s): %s: check resource fork permission?",
@@ -1498,7 +1498,11 @@ int deletefile(const struct vol *vol, char *file, int checkAttrib)
     if (checkAttrib) {
         /* was EACCESS error try to get only metadata */
         ad_init(&ad, vol->v_adouble, vol->v_ad_options);
-        if ( ad_metadata( file , ADFLAGS_OPENFORKS, &ad) == 0 ) {
+        /* we never want to create a resource fork here, we are going to delete it 
+         * moreover sometimes deletefile is called with a no existent file and 
+         * ad_open would create a 0 byte resource fork
+        */
+        if ( ad_metadata( file , ADFLAGS_NOADOUBLE | ADFLAGS_OPENFORKS, &ad) == 0 ) {
             ad_close( &ad, adflags );
             if ((err = check_attrib(&ad))) {
                return err;
index 8930293c562c128f2c270cecdfba611ea98d0df5..5db262dfe461493fbd1009ed1ec237cc2143d449 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: filedir.c,v 1.64 2009-10-29 13:38:15 didg Exp $
+ * $Id: filedir.c,v 1.65 2009-11-27 12:37:24 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -360,7 +360,7 @@ static int moveandrename(const struct vol *vol, struct dir *sdir, char *oldname,
      * we are in the dest folder so we need to use p for ad_open
     */
     
-    if (!ad_metadata(p, adflags, adp)) {
+    if (!ad_metadata(p, vol_noadouble(vol) | adflags, adp)) {
         u_int16_t bshort;
 
         ad_getattr(adp, &bshort);
index b8312258528f5c3d8562c91708023f20329e6303..a3043866c2051d85191c767150f6baa6216aa6f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ad_open.c,v 1.59 2009-11-12 09:44:59 didg Exp $
+ * $Id: ad_open.c,v 1.60 2009-11-27 12:37:25 didg Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu)
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -1472,10 +1472,15 @@ int ad_metadata(const char *name, int flags, struct adouble *adp)
     uid_t uid;
     int   ret, err;
     int   dir = flags & ADFLAGS_DIR;
-
+    int   adouble = 0;
+    
+    if (!(flags & ADFLAGS_NOADOUBLE)) {
+      adouble = O_CREAT;
+    }
+    
     /* Open with O_CREAT, thus enumarating a dir will create missing adouble files, see: */
     /* http://marc.info/?l=netatalk-devel&m=124039156832408&w=2 */
-    if ((ret = ad_open(name, ADFLAGS_HF | dir, O_RDWR | O_CREAT, 0666, adp)) < 0 && errno == EACCES) {
+    if ((ret = ad_open(name, ADFLAGS_HF | dir, O_RDWR | adouble, 0666, adp)) < 0 && errno == EACCES) {
         uid = geteuid();
         if (seteuid(0)) {
             LOG(log_error, logtype_default, "ad_metadata(%s): seteuid failed %s", name, strerror(errno));