/*
- * $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.
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
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)) {
struct dir *dir;
char **cpath;
{
- struct dir *cdir, *scdir=NULL;
+ struct dir *cdir;
static char path[ MAXPATHLEN + 1];
static struct path ret;
}
}
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 ) {
/*
- * $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.
* 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}
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)