]> arthur.barton.de Git - netatalk.git/commitdiff
Make dot files visible by default with usedots, add invisibledots for the old behavio...
authordidg <didg>
Tue, 19 Sep 2006 02:24:03 +0000 (02:24 +0000)
committerdidg <didg>
Tue, 19 Sep 2006 02:24:03 +0000 (02:24 +0000)
config/AppleVolumes.default.tmpl
etc/afpd/catsearch.c
etc/afpd/directory.c
etc/afpd/file.c
etc/afpd/file.h
etc/afpd/volume.c
etc/afpd/volume.h
include/atalk/adouble.h
libatalk/adouble/ad_open.c

index 9d8c098dee0332ecb4941415c8ce3fdc16a2ec43..0980ef08c9ee4b3fc80eddc0f3599aa7333a14cc 100644 (file)
 # usedots             -> don't do :hex translation for dot files. note: when 
 #                        this option gets set, certain file names
 #                       become illegal. these are .Parent and
+#                       anything that starts with .Apple.
+# invisibledots       -> don't do :hex translation for dot files. note: when 
+#                        this option gets set, certain file names
+#                       become illegal. these are .Parent and
 #                       anything that starts with .Apple. also, dot
 #                       files created on the unix side are marked
 #                       invisible. 
index 2c0a6a3d810141071adde345088995718e68e354..d4476628bb4eecc5e15c21858af11b97f896be11 100644 (file)
@@ -233,12 +233,13 @@ static struct finderinfo *unpack_buffer(struct finderinfo *finfo, char *buffer)
 
 /* -------------------- */
 static struct finderinfo *
-unpack_finderinfo(char *upath, struct adouble *adp, struct finderinfo *finfo)
+unpack_finderinfo(struct vol *vol, struct path *path, struct adouble **adp, struct finderinfo *finfo)
 {
        packed_finder  buf;
        void           *ptr;
        
-       ptr = get_finderinfo(upath, adp, &buf);
+    *adp = adl_lkup(vol, path, *adp);
+       ptr = get_finderinfo(vol, path->u_name, *adp, &buf);
        return unpack_buffer(finfo, ptr);
 }
 
@@ -372,8 +373,7 @@ static int crit_check(struct vol *vol, struct path *path) {
 
         /* Check file type ID */
        if ((c1.rbitmap & (1<<DIRPBIT_FINFO)) && c2.finfo.f_type != 0) {
-               adp = adl_lkup(vol, path, adp);
-           finfo = unpack_finderinfo(path->u_name, adp, &finderinfo);
+           finfo = unpack_finderinfo(vol, path, &adp, &finderinfo);
                if (finfo->f_type != c1.finfo.f_type)
                        goto crit_check_ret;
        }
@@ -381,8 +381,7 @@ static int crit_check(struct vol *vol, struct path *path) {
        /* Check creator ID */
        if ((c1.rbitmap & (1<<DIRPBIT_FINFO)) && c2.finfo.creator != 0) {
                if (!finfo) {
-               adp = adl_lkup(vol, path, adp);
-                       finfo = unpack_finderinfo(path->u_name, adp, &finderinfo);
+                       finfo = unpack_finderinfo(vol, path, &adp, &finderinfo);
                }
                if (finfo->creator != c1.finfo.creator)
                        goto crit_check_ret;
@@ -391,8 +390,7 @@ static int crit_check(struct vol *vol, struct path *path) {
        /* Check finder info attributes */
        if ((c1.rbitmap & (1<<DIRPBIT_FINFO)) && c2.finfo.attrs != 0) {
                if (!finfo) {
-               adp = adl_lkup(vol, path, adp);
-                       finfo = unpack_finderinfo(path->u_name, adp, &finderinfo);
+                       finfo = unpack_finderinfo(vol, path, &adp, &finderinfo);
                }
 
                if ((finfo->attrs & c2.finfo.attrs) != c1.finfo.attrs)
@@ -402,8 +400,7 @@ static int crit_check(struct vol *vol, struct path *path) {
        /* Check label */
        if ((c1.rbitmap & (1<<DIRPBIT_FINFO)) && c2.finfo.label != 0) {
                if (!finfo) {
-               adp = adl_lkup(vol, path, adp);
-                       finfo = unpack_finderinfo(path->u_name, adp, &finderinfo);
+                       finfo = unpack_finderinfo(vol, path, &adp, &finderinfo);
                }
                if ((finfo->label & c2.finfo.label) != c1.finfo.label)
                        goto crit_check_ret;
index af57b41751eb878dd86ba96c7ed728f603b01e50..8253958078bba32447ccadd65423c0738f5ac709 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: directory.c,v 1.71.2.4.2.15.2.8 2005-09-27 10:40:41 didg Exp $
+ * $Id: directory.c,v 1.71.2.4.2.15.2.9 2006-09-19 02:24:04 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -1290,6 +1290,12 @@ struct maccess ma;
 
 }
 
+/* --------------------- */
+static int invisible_dots(const struct vol *vol, const char *name)
+{ 
+  return vol_inv_dots(vol) && *name  == '.' && strcmp(name, ".") && strcmp(name, "..");
+}
+
 /* ------------------------------ 
    (".", curdir)
    (name, dir) with curdir:name == dir, from afp_enumerate
@@ -1343,8 +1349,7 @@ int getdirparams(const struct vol *vol,
         case DIRPBIT_ATTR :
             if ( isad ) {
                 ad_getattr(&ad, &ashort);
-            } else if (*dir->d_u_name == '.' && strcmp(dir->d_u_name, ".") 
-                        && strcmp(dir->d_u_name, "..")) {
+            } else if (invisible_dots(vol, dir->d_u_name)) {
                 ashort = htons(ATTRBIT_INVISIBLE);
             } else
                 ashort = 0;
@@ -1387,12 +1392,10 @@ int getdirparams(const struct vol *vol,
                 ashort = htons(FINDERINFO_CLOSEDVIEW);
                 memcpy(data + FINDERINFO_FRVIEWOFF, &ashort, sizeof(ashort));
 
-                /* dot files are by default invisible */
-                if (*dir->d_u_name  == '.' && strcmp(dir->d_u_name , ".") &&
-                        strcmp(dir->d_u_name , "..")) {
+                /* dot files are by default visible */
+                if (invisible_dots(vol, dir->d_u_name)) {
                     ashort = htons(FINDERINFO_INVISIBLE);
-                    memcpy(data + FINDERINFO_FRFLAGOFF,
-                           &ashort, sizeof(ashort));
+                    memcpy(data + FINDERINFO_FRFLAGOFF, &ashort, sizeof(ashort));
                 }
             }
             data += 32;
index 83f6e49af10d51c5f92872e9fb6457fc637c2961..c7130b8df9bff656a64d1fe0bfe68f98cda17d84 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: file.c,v 1.92.2.2.2.31.2.17 2006-09-11 18:54:13 didg Exp $
+ * $Id: file.c,v 1.92.2.2.2.31.2.18 2006-09-19 02:24:04 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -89,7 +89,7 @@ static int default_type(void *finder)
 }
 
 /* FIXME path : unix or mac name ? (for now it's unix name ) */
-void *get_finderinfo(const char *upath, struct adouble *adp, void *data)
+void *get_finderinfo(const struct vol *vol, const char *upath, struct adouble *adp, void *data)
 {
     struct extmap      *em;
     void                *ad_finder = NULL;
@@ -107,7 +107,7 @@ void *get_finderinfo(const char *upath, struct adouble *adp, void *data)
     else {
         memcpy(data, ufinderi, ADEDLEN_FINDERI);
         chk_ext = 1;
-        if (*upath == '.') { /* make it invisible */
+        if (vol_inv_dots(vol) && *upath == '.') { /* make it invisible */
             u_int16_t ashort;
             
             ashort = htons(FINDERINFO_INVISIBLE);
@@ -282,7 +282,7 @@ int getmetadata(struct vol *vol,
         case FILPBIT_ATTR :
             if ( adp ) {
                 ad_getattr(adp, &ashort);
-            } else if (*upath == '.') {
+            } else if (vol_inv_dots(vol) && *upath == '.') {
                 ashort = htons(ATTRBIT_INVISIBLE);
             } else
                 ashort = 0;
@@ -336,7 +336,7 @@ int getmetadata(struct vol *vol,
             break;
 
         case FILPBIT_FINFO :
-           get_finderinfo(upath, adp, (char *)data);
+           get_finderinfo(vol, upath, adp, (char *)data);
             data += ADEDLEN_FINDERI;
             break;
 
index 68df03e10767a136020ff0bb6e5fe909c3734263..80600998e9969fa9dfb4990f4f9bb5c4aa314cd0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: file.h,v 1.16.2.2.2.3.2.3 2005-01-30 20:56:21 didg Exp $
+ * $Id: file.h,v 1.16.2.2.2.3.2.4 2006-09-19 02:24:05 didg Exp $
  *
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
  * All Rights Reserved.
@@ -133,7 +133,7 @@ extern int renamefile   __P((const struct vol *, char *, char *, char *, struct
 extern int copyfile     __P((const struct vol *, const struct vol *, char *, char *, char *, struct adouble *));
 extern int deletefile   __P((const struct vol *, char *, int));
 
-extern void *get_finderinfo __P((const char *, struct adouble *, void *));
+extern void *get_finderinfo __P((const struct vol *, const char *, struct adouble *, void *));
 
 extern size_t mtoUTF8   __P((const struct vol *, const char *, size_t , char *, size_t ));
 extern int  copy_path_name __P((const struct vol *, char *, char *i));
index c6547086eda3a5c96316fb0e52d9047e67f52eb5..b5728628360a3dc5b946c5b911bed5f6b24ce8ea 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.c,v 1.51.2.7.2.33.2.12 2006-09-11 07:47:14 didg Exp $
+ * $Id: volume.c,v 1.51.2.7.2.33.2.13 2006-09-19 02:24:05 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -452,6 +452,8 @@ static void volset(struct vol_option *options, struct vol_option *save,
                 options[VOLOPT_FLAGS].i_value |= AFPVOL_NOHEX;
             else if (strcasecmp(p, "usedots") == 0)
                 options[VOLOPT_FLAGS].i_value |= AFPVOL_USEDOTS;
+            else if (strcasecmp(p, "invisibledots") == 0)
+                options[VOLOPT_FLAGS].i_value |= AFPVOL_USEDOTS | AFPVOL_INV_DOTS;
             else if (strcasecmp(p, "limitsize") == 0)
                 options[VOLOPT_FLAGS].i_value |= AFPVOL_LIMITSIZE;
             /* support for either "dropbox" or "dropkludge" */
@@ -642,6 +644,8 @@ static int creatvol(AFPObj *obj, struct passwd *pwd,
             volume->v_ad_options |= ADVOL_CACHE;
         if ((volume->v_flags & AFPVOL_UNIX_PRIV))
             volume->v_ad_options |= ADVOL_UNIXPRIV;
+        if ((volume->v_flags & AFPVOL_INV_DOTS))
+            volume->v_ad_options |= ADVOL_INVDOTS;
 
         if (options[VOLOPT_PASSWORD].c_value)
             volume->v_password = strdup(options[VOLOPT_PASSWORD].c_value);
index 35dcab17e6728ae65da29e4b92d599b4586a054e..71400f855c2d75574facb97f6c8354e0a67ff672 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.h,v 1.19.2.5.2.7.2.2 2005-06-02 12:49:41 didg Exp $
+ * $Id: volume.h,v 1.19.2.5.2.7.2.3 2006-09-19 02:24:06 didg Exp $
  *
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -88,8 +88,8 @@ typedef u_int64_t VolSpace;
 #endif /* NO_LARGE_VOL_SUPPORT */
 
 #define AFPVOL_OPEN    (1<<0)
-#define AFPVOL_DT      (1<<1)
 
+/* flags  for AFS and quota 0xxx0 */
 #define AFPVOL_GVSMASK (7<<2)
 #define AFPVOL_NONE    (0<<2)
 #define AFPVOL_AFSGVS  (1<<2)
@@ -117,6 +117,7 @@ this is going away. */
                                      * NOTE symlink to a different device will return an ACCESS error
                                      */
 #define AFPVOL_CACHE      (1 << 19)  /* Use adouble v2 CNID caching, default don't use it */
+#define AFPVOL_INV_DOTS   (1 << 20)  /* dots files are invisible */
 
 /* FPGetSrvrParms options */
 #define AFPSRVR_CONFIGINFO     (1 << 0)
@@ -178,6 +179,8 @@ int wincheck(const struct vol *vol, const char *path);
 
 #define vol_unix_priv(vol) (afp_version >= 30 && ((vol)->v_flags & AFPVOL_UNIX_PRIV))
 
+#define vol_inv_dots(vol) (((vol)->v_flags & AFPVOL_INV_DOTS) ? 1 : 0)
+
 extern struct vol      *getvolbyvid __P((const u_int16_t));
 extern int              ustatfs_getvolspace __P((const struct vol *,
             VolSpace *, VolSpace *,
index 13451cf0f5db427ccc48284f9150e59b527a18c2..b4a3ec0c94f09960b7445a02e50b30de86b0ec47 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: adouble.h,v 1.21.6.20.2.5 2005-09-28 09:38:57 didg Exp $
+ * $Id: adouble.h,v 1.21.6.20.2.6 2006-09-19 02:24:06 didg Exp $
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
  * All Rights Reserved.
  *
@@ -277,6 +277,8 @@ struct adouble {
 #define ADVOL_CACHE      (1 << 1)
 /* adouble unix priv */
 #define ADVOL_UNIXPRIV   (1 << 2)   
+/* dot files (.DS_Store) are invisible) */
+#define ADVOL_INVDOTS    (1 << 3)   
 
 /* lock flags */
 #define ADLOCK_CLR      (0)
index 0e3b07517f2319e91220f77ab9730ce9e098d053..20cfcbb31ab81a4d506965449be3a7610739a7be 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ad_open.c,v 1.30.6.18.2.5 2005-05-26 11:49:56 didg Exp $
+ * $Id: ad_open.c,v 1.30.6.18.2.6 2006-09-19 02:24:06 didg Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu)
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -1194,12 +1194,11 @@ static int new_rfork(const char *path, struct adouble *ad, int adflags)
     }
 
     /* make things invisible */
-    if ((*path == '.') && strcmp(path, ".") && strcmp(path, "..")) {
+    if ((ad->ad_options & ADVOL_INVDOTS) && (*path == '.') && strcmp(path, ".") && strcmp(path, "..")) {
         ashort = htons(ATTRBIT_INVISIBLE);
        ad_setattr(ad, ashort);
        ashort = htons(FINDERINFO_INVISIBLE);
-       memcpy(ad_entry(ad, ADEID_FINDERI) + FINDERINFO_FRFLAGOFF,
-                    &ashort, sizeof(ashort));
+       memcpy(ad_entry(ad, ADEID_FINDERI) + FINDERINFO_FRFLAGOFF, &ashort, sizeof(ashort));
     }
 
     if (stat(path, &st) < 0) {