]> arthur.barton.de Git - netatalk.git/commitdiff
remove case insensitive option
authordidg <didg>
Sun, 31 Aug 2008 13:25:57 +0000 (13:25 +0000)
committerdidg <didg>
Sun, 31 Aug 2008 13:25:57 +0000 (13:25 +0000)
etc/afpd/directory.c
etc/afpd/directory.h
etc/afpd/filedir.c
etc/afpd/volume.c
etc/afpd/volume.h

index 1f2eda1f9f0be9f73e5cb504e9f809d3962807c2..17f9c754ebfa498019586f6a31e9a510bbd18bbe 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: directory.c,v 1.85 2008-05-23 06:35:49 didg Exp $
+ * $Id: directory.c,v 1.86 2008-08-31 13:25:57 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -601,86 +601,6 @@ struct dir *dir;
     return pdir;
 }
 
-#define ENUMVETO "./../Network Trash Folder/TheVolumeSettingsFolder/TheFindByContentFolder/:2eDS_Store/Contents/Desktop Folder/Trash/Benutzer/"
-
-int
-caseenumerate(const struct vol *vol, struct path *path, struct dir *dir)
-{
-    DIR               *dp;
-    struct dirent     *de;
-    int               ret;
-    static u_int32_t  did = 0;
-    static char              cname[MAXPATHLEN];
-    static char              lname[MAXPATHLEN];
-    ucs2_t           u2_path[MAXPATHLEN];
-    ucs2_t           u2_dename[MAXPATHLEN];
-    char             *tmp, *savepath;
-
-    if (veto_file(ENUMVETO, path->u_name))
-       return -1;
-
-    savepath = path->u_name;
-
-    /* very simple cache */
-    if ( dir->d_did == did && strcmp(lname, path->u_name) == 0) {
-        path->u_name = cname;
-        path->d_dir = NULL;
-        if (of_stat( path ) == 0 ) {
-            return 0;
-        }
-        /* something changed, we cannot stat ... */
-        did = 0;
-    }
-
-    if (NULL == ( dp = opendir( "." )) ) {
-        LOG(log_debug, logtype_afpd, "caseenumerate: opendir failed: %s", dir->d_u_name);
-        return -1;
-    }
-
-
-    /* LOG(log_debug, logtype_afpd, "caseenumerate: for %s", path->u_name); */
-    if ((size_t) -1 == convert_string(vol->v_volcharset, CH_UCS2, path->u_name, strlen(path->u_name), u2_path, sizeof(u2_path)) ) 
-        LOG(log_debug, logtype_afpd, "caseenumerate: conversion failed for %s", path->u_name);
-
-    /*LOG(log_debug, logtype_afpd, "caseenumerate: dir: %s, path: %s", dir->d_u_name, path->u_name); */
-    ret = -1;
-    for ( de = readdir( dp ); de != NULL; de = readdir( dp )) {
-        if (NULL == check_dirent(vol, de->d_name))
-            continue;
-
-        if ((size_t) -1 == convert_string(vol->v_volcharset, CH_UCS2, de->d_name, strlen(de->d_name), u2_dename, sizeof(u2_dename)) )
-            continue;
-
-        if (strcasecmp_w( u2_path, u2_dename) == 0) {
-            tmp = path->u_name;
-            strlcpy(cname, de->d_name, sizeof(cname));
-            path->u_name = cname;
-            path->d_dir = NULL;
-            if (of_stat( path ) == 0 ) {
-                LOG(log_debug, logtype_afpd, "caseenumerate: using dir: %s, path: %s", de->d_name, path->u_name);
-                strlcpy(lname, tmp, sizeof(lname));
-                did = dir->d_did;
-                ret = 0;
-                break;
-            }
-            else 
-                path->u_name = tmp;
-        }
-
-    }
-    closedir(dp);
-
-    if (ret) {
-        /* invalidate cache */
-        memset(cname, 0, sizeof(cname));
-        did = 0;
-        path->u_name = savepath;
-    }
-    /* LOG(log_debug, logtype_afpd, "caseenumerate: path on ret: %s", path->u_name); */
-    return ret;
-}
-
-
 /*
  * attempt to extend the current dir. tree to include path
  * as a side-effect, movecwd to that point and return the new dir
@@ -698,10 +618,7 @@ struct path *path;
         return NULL;
     }
     if (of_stat( path ) != 0 ) {
-        if (!(vol->v_flags & AFPVOL_CASEINSEN))
-            return NULL;
-       else if(caseenumerate(vol, path, dir) != 0)
-            return(NULL);
+        return NULL;
     }
 
     if (!S_ISDIR(path->st.st_mode)) {
@@ -1252,7 +1169,7 @@ const struct vol  *vol;
 struct dir     *dir;
 char   **cpath;
 {
-    struct dir            *cdir, *scdir=NULL;
+    struct dir            *cdir;
     static char                   path[ MAXPATHLEN + 1];
     static struct path ret;
 
@@ -1384,51 +1301,19 @@ char    **cpath;
             }
         }
         if ( !extend ) {
-            ucs2_t *tmpname;
-            cdir = dir->d_child;
-            scdir = NULL;
-           if ( cdir && (vol->v_flags & AFPVOL_CASEINSEN) &&
-                    (size_t)-1 != convert_string_allocate(((ret.m_type == 3)?CH_UTF8_MAC:vol->v_maccharset), 
-                                                          CH_UCS2, path, strlen(path), (char **)&tmpname) )
-            {
-                while (cdir) {
-                    if (!cdir->d_m_name_ucs2) {
-                        LOG(log_error, logtype_afpd, "cname: no UCS2 name for %s (did %u)!!!", cdir->d_m_name, ntohl(cdir->d_did) );
-                        /* this shouldn't happen !!!! */
-                        goto noucsfallback;
-                    }
-
-                    if ( strcmp_w( cdir->d_m_name_ucs2, tmpname ) == 0 ) {
-                         break;
-                    }
-                    if ( strcasecmp_w( cdir->d_m_name_ucs2, tmpname ) == 0 ) {
-                         scdir = cdir;
-                    }
-                    cdir = (cdir == dir->d_child->d_prev) ? NULL :cdir->d_next;
-                }
-                free(tmpname);
-            }
-            else {
-noucsfallback:
-                if (dir->d_did == DIRDID_ROOT_PARENT) {
+            if (dir->d_did == DIRDID_ROOT_PARENT) {
                     /* root parent has only one child and d_m_name is *NOT* utm (d_u_name)
                      * d_m_name is the Mac volume name
                      * d_u_name is the volume unix directory name
                      *
                     */
-                    cdir = NULL;
-                    if (!strcmp(vol->v_dir->d_m_name, ret.m_name)) {
+                cdir = NULL;
+                if (!strcmp(vol->v_dir->d_m_name, ret.m_name)) {
                        cdir = vol->v_dir;
-                    }
-                }
-               else {
-                    cdir = dirsearch_byname(vol, dir, ret.u_name);
                 }
             }
-
-            if (cdir == NULL && scdir != NULL) {
-                cdir = scdir;
-                /* LOG(log_debug, logtype_afpd, "cname: using casediff for %s, (%s = %s)", fullpathname(cdir->d_u_name), cdir->d_m_name, path ); */
+            else {
+                cdir = dirsearch_byname(vol, dir, ret.u_name);
             }
 
             if ( cdir == NULL ) {
index 8e39051fabd3f24d5d1fbbf0c96cc7a2074ac4a2..94db14d26652b8f76ad341826afce40cbf021693 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: directory.h,v 1.20 2008-05-23 06:35:49 didg Exp $
+ * $Id: directory.h,v 1.21 2008-08-31 13:25:58 didg Exp $
  *
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
  * All Rights Reserved.
@@ -206,8 +206,6 @@ extern int file_access   __P((struct path *path, int mode));
 extern int netatalk_rmdir __P((const char *name));
 extern int netatalk_unlink __P((const char *name));
 
-extern int caseenumerate __P((const struct vol *, struct path *, struct dir *));
-
 extern hash_t *dirhash __P((void));
 /* from enumerate.c */
 extern char *check_dirent __P((const struct vol *, char *));
index 8e03cbcc0403db67c45515e20ad9ff7730bea338..ac6f2d5e0396ad54019c33fec70dd38c035a3160 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: filedir.c,v 1.50 2005-06-02 12:32:17 didg Exp $
+ * $Id: filedir.c,v 1.51 2008-08-31 13:25:58 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -406,14 +406,14 @@ int         isdir;
         if (strcmp(oldname, newname) == 0)
             return AFP_OK;
 
-        if (stat(upath, st) == 0 || caseenumerate(vol, &path, curdir) == 0) {
+        if (stat(upath, st) == 0 ) {
             if (!stat(p, &nst) && !(nst.st_dev == st->st_dev && nst.st_ino == st->st_ino) ) {
                 /* not the same file */
                 return AFPERR_EXIST;
             }
             errno = 0;
         }
-    } else if (stat(upath, st ) == 0 || caseenumerate(vol, &path, curdir) == 0)
+    } else if (stat(upath, st ) == 0)
         return AFPERR_EXIST;
 
     if ( !isdir ) {
index 7d3809f49884eb6f33087064498b23ab586e4018..fac12624cbc7976c26d2b535dfecbae9228e7ff5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.c,v 1.70 2008-05-16 04:19:42 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}
@@ -485,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)
index c6695f3f31134fef12fd923df31710222375a1f3..7e0d5727e4c0ab418cc04f015d577becda1c0b09 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: volume.h,v 1.24 2006-09-19 23:00:50 didg Exp $
+ * $Id: volume.h,v 1.25 2008-08-31 13:26:00 didg Exp $
  *
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -122,7 +122,7 @@ this is going away. */
                                      * help if device number is notconsistent across reboot 
                                      * NOTE symlink to a different device will return an ACCESS error
                                      */
-#define AFPVOL_CASEINSEN (1 << 19)  /* volume is case insensitive */
+#define AFPVOL_RESERVED  (1 << 19)  /* was AFPVOL_CASEINSEN, volume is case insensitive */
 #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 -*/