diff options
Diffstat (limited to 'source4/ntvfs/posix')
-rw-r--r-- | source4/ntvfs/posix/pvfs_resolve.c | 18 | ||||
-rw-r--r-- | source4/ntvfs/posix/pvfs_shortname.c | 15 | ||||
-rw-r--r-- | source4/ntvfs/posix/vfs_posix.c | 1 | ||||
-rw-r--r-- | source4/ntvfs/posix/vfs_posix.h | 3 |
4 files changed, 27 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; |