]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/volume.c
remove case insensitive option
[netatalk.git] / etc / afpd / volume.c
index fd87c57a2261ecac412d7e301adb905ab91a48e6..fac12624cbc7976c26d2b535dfecbae9228e7ff5 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.71 2008-08-31 13:25:59 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -172,7 +172,6 @@ static const _vol_opt_name vol_opt_names[] = {
                                          * maybe because it will be mounted later in preexec */
     {AFPVOL_UNIX_PRIV,  "UNIXPRIV"},    /* support unix privileges */
     {AFPVOL_NODEV,      "NODEV"},       /* always use 0 for device number in cnid calls */
-    {AFPVOL_CASEINSEN,  "CASEINSENSITIVE"}, /* volume is case insensitive */
     {AFPVOL_EILSEQ,     "ILLEGALSEQ"},     /* encode illegal sequence */
     {AFPVOL_CACHE,      "CACHEID"},     /* Use adouble v2 CNID caching, default don't use it */
     {0, NULL}
@@ -315,7 +314,11 @@ static char *volxlate(AFPObj *obj, char *dest, size_t destlen,
             } else
                 q = obj->options.hostname;
         } else if (is_var(p, "$u")) {
-            q = obj->username;
+            char* sep = NULL;
+            if ( obj->options.ntseparator && (sep = strchr(obj->username, obj->options.ntseparator[0])) != NULL)
+                q = sep+1;
+            else
+                q = obj->username;
         } else if (is_var(p, "$v")) {
             if (volname) {
                 q = volname;
@@ -436,6 +439,8 @@ static void volset(struct vol_option *options, struct vol_option *save,
             options[VOLOPT_ADOUBLE].i_value = AD_VERSION2_OSX;
         else if (strcasecmp(val + 1, "ads") == 0)
             options[VOLOPT_ADOUBLE].i_value = AD_VERSION1_ADS;
+        else if (strcasecmp(val + 1, "sfm") == 0)
+            options[VOLOPT_ADOUBLE].i_value = AD_VERSION1_SFM;
 #endif
     } else if (optionok(tmp, "options:", val)) {
         char *p;
@@ -458,6 +463,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" */
@@ -477,8 +484,6 @@ static void volset(struct vol_option *options, struct vol_option *save,
                 options[VOLOPT_FLAGS].i_value |= AFPVOL_UNIX_PRIV;
             else if (strcasecmp(p, "nodev") == 0)
                 options[VOLOPT_FLAGS].i_value |= AFPVOL_NODEV;
-            else if (strcasecmp(p, "caseinsensitive") == 0)
-                options[VOLOPT_FLAGS].i_value |= AFPVOL_CASEINSEN;
             else if (strcasecmp(p, "illegalseq") == 0)
                 options[VOLOPT_FLAGS].i_value |= AFPVOL_EILSEQ;
             else if (strcasecmp(p, "cachecnid") == 0)
@@ -624,6 +629,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);
@@ -1233,7 +1240,7 @@ int               *buflen;
         isad = 0;
         vol->v_ctime = AD_DATE_FROM_UNIX(st->st_mtime);
 
-    } else if (ad_get_HF_flags( &ad ) & O_CREAT) {
+    } else if (ad_get_MD_flags( &ad ) & O_CREAT) {
         slash = strrchr( vol->v_path, '/' );
         if(slash)
             slash++;
@@ -1245,7 +1252,7 @@ int               *buflen;
                ad_getentrylen( &ad, ADEID_NAME ));
         }
         vol_setdate(vol->v_vid, &ad, st->st_mtime);
-        ad_flush_metadata(&ad);
+        ad_flush(&ad);
     }
     else {
         if (ad_getdate(&ad, AD_DATE_CREATE, &aint) < 0)
@@ -1593,6 +1600,7 @@ int       ibuflen _U_, *rbuflen;
     char        path[ MAXPATHLEN + 1];
     char        *vol_uname;
     char        *vol_mname;
+    char        *volname_tmp;
 
     ibuf += 2;
     memcpy(&bitmap, ibuf, sizeof( bitmap ));
@@ -1605,6 +1613,10 @@ int      ibuflen _U_, *rbuflen;
 
     len = (unsigned char)*ibuf++;
     volname = obj->oldtmp;
+
+    if ((volname_tmp = strchr(volname,'+')) != NULL)
+        volname = volname_tmp+1;
+
     namelen = convert_string( (utf8_encoding()?CH_UTF8_MAC:obj->options.maccharset), CH_UCS2,
                               ibuf, len, volname, sizeof(obj->oldtmp));
     if ( namelen <= 0){
@@ -2083,7 +2095,7 @@ int       ibuflen _U_, *rbuflen;
 
     memcpy(&aint, ibuf, sizeof(aint));
     ad_setdate(&ad, AD_DATE_BACKUP, aint);
-    ad_flush(&ad, ADFLAGS_HF);
+    ad_flush(&ad);
     ad_close(&ad, ADFLAGS_HF);
     return( AFP_OK );
 }
@@ -2194,7 +2206,7 @@ static int create_special_folder (const struct vol *vol, const struct _special_f
                        memcpy(ad_entry(&ad, ADEID_FINDERI) + FINDERINFO_FRFLAGOFF,&attr, sizeof(attr));
                }
 
-               ad_flush( &ad, ADFLAGS_HF );
+               ad_flush( &ad );
                ad_close( &ad, ADFLAGS_HF );
        }
        free(p);
@@ -2273,6 +2285,9 @@ static int savevoloptions (const struct vol *vol)
         case AD_VERSION1_ADS:
             strlcat(buf, "ADOUBLE_VER:ads\n", sizeof(buf));
             break;
+        case AD_VERSION1_SFM:
+            strlcat(buf, "ADOUBLE_VER:sfm\n", sizeof(buf));
+            break;
     }
 
     strlcat(buf, "CNIDBACKEND:", sizeof(buf));