summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-26 00:59:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:04:43 -0500
commitd5fd12648e004b47bbe5ed2623838866fedcbeb0 (patch)
tree837c57d7a2da2d3b61684c562541971721fb6e8a
parentbf3f9757e58625decd78d0b1d761e35593f2922a (diff)
downloadsamba-d5fd12648e004b47bbe5ed2623838866fedcbeb0.tar.gz
samba-d5fd12648e004b47bbe5ed2623838866fedcbeb0.tar.bz2
samba-d5fd12648e004b47bbe5ed2623838866fedcbeb0.zip
r3227: added a per-share option "case insensitive filesystem", that tells the
backend that the underlying filesystem is case insensitive, so it can bypass the directory search if the name is not found. (This used to be commit d84ade90ce7e03ec749d6ae8dcdcb41de85d836e)
-rw-r--r--source4/ntvfs/posix/pvfs_resolve.c18
-rw-r--r--source4/ntvfs/posix/pvfs_shortname.c15
-rw-r--r--source4/ntvfs/posix/vfs_posix.c1
-rw-r--r--source4/ntvfs/posix/vfs_posix.h3
-rw-r--r--source4/param/loadparm.c9
5 files changed, 36 insertions, 10 deletions
diff --git a/source4/ntvfs/posix/pvfs_resolve.c b/source4/ntvfs/posix/pvfs_resolve.c
index 5d98274511..271dbc2b9a 100644
--- a/source4/ntvfs/posix/pvfs_resolve.c
+++ b/source4/ntvfs/posix/pvfs_resolve.c
@@ -125,6 +125,18 @@ static NTSTATUS pvfs_case_search(struct pvfs_state *pvfs, struct pvfs_filename *
}
continue;
}
+
+ /* the filesystem might be case insensitive, in which
+ case a search is pointless unless the name is
+ mangled */
+ if ((pvfs->flags & PVFS_FLAG_CI_FILESYSTEM) &&
+ !pvfs_is_mangled_component(pvfs, components[i])) {
+ if (i < num_components-1) {
+ return NT_STATUS_OBJECT_PATH_NOT_FOUND;
+ }
+ partial_name = test_name;
+ continue;
+ }
dir = opendir(partial_name);
if (!dir) {
@@ -319,12 +331,6 @@ NTSTATUS pvfs_resolve_name(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx,
return pvfs_fill_dos_info(pvfs, *name);
}
- /* the filesystem might be case insensitive, in which
- case a search is pointless */
- if (pvfs->flags & PVFS_FLAG_CI_FILESYSTEM) {
- return NT_STATUS_OK;
- }
-
/* search for a matching filename */
status = pvfs_case_search(pvfs, *name);
diff --git a/source4/ntvfs/posix/pvfs_shortname.c b/source4/ntvfs/posix/pvfs_shortname.c
index c3c33fbc98..f80e532762 100644
--- a/source4/ntvfs/posix/pvfs_shortname.c
+++ b/source4/ntvfs/posix/pvfs_shortname.c
@@ -237,7 +237,7 @@ static BOOL is_mangled(struct pvfs_mangle_context *ctx, const char *name)
}
/* and the last part ... */
- return is_mangled_component(ctx, s,strlen(s));
+ return is_mangled_component(ctx, s, strlen(s));
}
@@ -301,7 +301,8 @@ static BOOL is_8_3(struct pvfs_mangle_context *ctx,
/* the length are all OK. Now check to see if the characters themselves are OK */
for (i=0; name[i]; i++) {
/* note that we may allow wildcard petterns! */
- if (!FLAG_CHECK(name[i], FLAG_ASCII|(allow_wildcards ? FLAG_WILDCARD : 0)) && name[i] != '.') {
+ if (!FLAG_CHECK(name[i], FLAG_ASCII|(allow_wildcards ? FLAG_WILDCARD : 0)) &&
+ name[i] != '.') {
return False;
}
}
@@ -686,3 +687,13 @@ BOOL pvfs_is_reserved_name(struct pvfs_state *pvfs, const char *name)
{
return is_reserved_name(pvfs->mangle_ctx, name);
}
+
+
+/*
+ see if a component of a filename could be a mangled name from our
+ mangling code
+*/
+BOOL pvfs_is_mangled_component(struct pvfs_state *pvfs, const char *name)
+{
+ return is_mangled_component(pvfs->mangle_ctx, name, strlen(name));
+}
diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c
index 64f0e09f59..cd41bf2329 100644
--- a/source4/ntvfs/posix/vfs_posix.c
+++ b/source4/ntvfs/posix/vfs_posix.c
@@ -41,6 +41,7 @@ static void pvfs_setup_options(struct pvfs_state *pvfs)
if (lp_readonly(snum)) pvfs->flags |= PVFS_FLAG_READONLY;
if (lp_strict_sync(snum)) pvfs->flags |= PVFS_FLAG_STRICT_SYNC;
if (lp_strict_locking(snum)) pvfs->flags |= PVFS_FLAG_STRICT_LOCKING;
+ if (lp_ci_filesystem(snum)) pvfs->flags |= PVFS_FLAG_CI_FILESYSTEM;
pvfs->share_name = talloc_strdup(pvfs, lp_servicename(snum));
}
diff --git a/source4/ntvfs/posix/vfs_posix.h b/source4/ntvfs/posix/vfs_posix.h
index 656ac85380..48a2ba9288 100644
--- a/source4/ntvfs/posix/vfs_posix.h
+++ b/source4/ntvfs/posix/vfs_posix.h
@@ -94,8 +94,7 @@ struct pvfs_search_state {
struct pvfs_dir *dir;
};
-/* open file state - this is a temporary implementation
- to allow some tests to work */
+/* open file state */
struct pvfs_file {
struct pvfs_file *next, *prev;
int fd;
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 59e6fa911a..62d30365c2 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -272,6 +272,7 @@ typedef struct
BOOL bMSDfsRoot;
BOOL bShareModes;
BOOL bStrictSync;
+ BOOL bCIFileSystem;
struct param_opt *param_opt;
char dummy[3]; /* for alignment */
@@ -330,6 +331,7 @@ static service sDefault = {
False, /* bMSDfsRoot */
True, /* bShareModes */
False, /* bStrictSync */
+ False, /* bCIFileSystem */
NULL, /* Parametric options */
"" /* dummy */
@@ -623,6 +625,7 @@ static struct parm_struct parm_table[] = {
{"name cache timeout", P_INTEGER, P_GLOBAL, &Globals.name_cache_timeout, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"strict sync", P_BOOL, P_LOCAL, &sDefault.bStrictSync, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
+ {"case insensitive filesystem", P_BOOL, P_LOCAL, &sDefault.bCIFileSystem, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
{"Printing Options", P_SEP, P_SEPARATOR},
@@ -1253,6 +1256,7 @@ FN_LOCAL_BOOL(lp_locking, bLocking)
FN_LOCAL_BOOL(lp_strict_locking, bStrictLocking)
FN_LOCAL_BOOL(lp_posix_locking, bPosixLocking)
FN_LOCAL_BOOL(lp_strict_sync, bStrictSync)
+FN_LOCAL_BOOL(lp_ci_filesystem, bCIFileSystem)
FN_LOCAL_BOOL(lp_share_modes, bShareModes)
FN_LOCAL_BOOL(lp_oplocks, bOpLocks)
FN_LOCAL_BOOL(lp_level2_oplocks, bLevel2OpLocks)
@@ -2444,6 +2448,11 @@ BOOL lp_set_cmdline(const char *pszParmName, const char *pszParmValue)
return lp_do_parameter_parametric(-1, pszParmName, pszParmValue, FLAG_CMDLINE);
}
+ if (parmnum < 0) {
+ DEBUG(0,("Unknown option '%s'\n", pszParmName));
+ return False;
+ }
+
/* reset the CMDLINE flag in case this has been called before */
parm_table[parmnum].flags &= ~FLAG_CMDLINE;