]> arthur.barton.de Git - netatalk.git/commitdiff
Make dot files visible by default with usedots, add invisibledots for the old behavio... before_sfm
authordidg <didg>
Tue, 19 Sep 2006 23:00:49 +0000 (23:00 +0000)
committerdidg <didg>
Tue, 19 Sep 2006 23:00:49 +0000 (23:00 +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 11aad1149bc982e0f6c5115ba2b0c1ccc640a060..ded1f6fa961b47b55b9832315c093d486e29738e 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 b20dcba9811d5c7dbc95a0149e413c23e4dc20a8..99636cba6aca95469ebb5015b37de3215c34277e 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);
 }
 
@@ -374,8 +375,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;
        }
@@ -383,8 +383,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;
@@ -393,8 +392,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)
@@ -404,8 +402,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 d4fc05f19b2feaa69b073ea4765176b2707a2400..224f397973e7500aacaf5c60049d4f7a1d9e262c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: directory.c,v 1.82 2005-09-28 09:43:04 didg Exp $
+ * $Id: directory.c,v 1.83 2006-09-19 23:00:49 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -1601,6 +1601,12 @@ int dirreenumerate(struct dir *dir, struct stat *st)
     return st->st_ctime == dir->ctime && (dir->d_flags & DIRF_CNID);
 }
 
+/* --------------------- */
+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
@@ -1654,8 +1660,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;
@@ -1698,12 +1703,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 ca06032f21ffc09f7c8cc9b73f28ef943af146b3..523cda413805db91ce38ae5af138c4208aedc3b9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: file.c,v 1.101 2006-09-15 00:09:23 didg Exp $
+ * $Id: file.c,v 1.102 2006-09-19 23:00:49 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);
@@ -284,7 +284,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;
@@ -338,7 +338,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 fe9bd8e6848ddf57c495b6d4b9a759881126689d..dba239505ee116462f02586c0a1901348d3daf15 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: file.h,v 1.18 2005-04-28 20:49:42 bfernhomberg Exp $
+ * $Id: file.h,v 1.19 2006-09-19 23:00:50 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 fd87c57a2261ecac412d7e301adb905ab91a48e6..56a6d6fd4ad63dceb64d6381246bbda28632db1e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.c,v 1.66 2006-09-15 00:05:51 didg Exp $
+ * $Id: volume.c,v 1.67 2006-09-19 23:00:50 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -458,6 +458,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" */
@@ -624,6 +626,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 1d0d742f8275e6a479379d8e4ab9581e069f7af6..c6695f3f31134fef12fd923df31710222375a1f3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.h,v 1.23 2005-06-02 12:32:18 didg Exp $
+ * $Id: volume.h,v 1.24 2006-09-19 23:00:50 didg Exp $
  *
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -94,8 +94,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)
@@ -126,7 +126,8 @@ this is going away. */
 #define AFPVOL_EILSEQ    (1 << 20)  /* encode illegal sequence 'asis' UCS2, ex "\217-", which is not 
                                        a valid SHIFT-JIS char, is encoded  as U\217 -*/
 
-#define AFPVOL_CACHE     (1 << 21)  /* Use adouble v2 CNID caching, default don't use it */
+#define AFPVOL_CACHE     (1 << 21)   /* Use adouble v2 CNID caching, default don't use it */
+#define AFPVOL_INV_DOTS  (1 << 22)   /* dots files are invisible */
 
 /* FPGetSrvrParms options */
 #define AFPSRVR_CONFIGINFO     (1 << 0)
@@ -188,6 +189,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 271d59eaac27cbb067f2ff769248f92ba8a2cbe4..d71eb05a18cf6bc1e54d8592873091f1ed3509a0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: adouble.h,v 1.29 2005-09-28 09:46:37 didg Exp $
+ * $Id: adouble.h,v 1.30 2006-09-19 23:00:50 didg Exp $
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
  * All Rights Reserved.
  *
@@ -280,6 +280,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 9451efff6da80463bba6d89a84476494be6c51a8..4d5a2850b1419ae21ef3e24e43afb53532cd2b42 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ad_open.c,v 1.35 2005-05-25 18:24:24 didg Exp $
+ * $Id: ad_open.c,v 1.36 2006-09-19 23:00:50 didg Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu)
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -1296,12 +1296,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) {