diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-08-24 03:40:40 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:02:31 -0500 |
commit | 3b3bfed2c3964a6c5e8299d0a7871f412e03fa67 (patch) | |
tree | 4eb898565dce44de240eebe3c7c0ab646c03258a /source4/ntvfs | |
parent | 09672f7e4ab15d20fe5702bef8d0550464e44cab (diff) | |
download | samba-3b3bfed2c3964a6c5e8299d0a7871f412e03fa67.tar.gz samba-3b3bfed2c3964a6c5e8299d0a7871f412e03fa67.tar.bz2 samba-3b3bfed2c3964a6c5e8299d0a7871f412e03fa67.zip |
r24646: fixed the handling of case insensitive paths with wildcards
(This used to be commit 066bcd8420045f095130674e32bdee97cb1471be)
Diffstat (limited to 'source4/ntvfs')
-rw-r--r-- | source4/ntvfs/posix/pvfs_resolve.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/source4/ntvfs/posix/pvfs_resolve.c b/source4/ntvfs/posix/pvfs_resolve.c index 94fa0263ad..fae5ec432c 100644 --- a/source4/ntvfs/posix/pvfs_resolve.c +++ b/source4/ntvfs/posix/pvfs_resolve.c @@ -480,8 +480,40 @@ NTSTATUS pvfs_resolve_name(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx, return status; } - /* if it has a wildcard then no point doing a stat() */ + /* if it has a wildcard then no point doing a stat() of the + full name. Instead We need check if the directory exists + */ if ((*name)->has_wildcard) { + const char *p; + char *dir_name, *saved_name; + p = strrchr((*name)->full_name, '/'); + if (p == NULL) { + /* root directory wildcard is OK */ + return NT_STATUS_OK; + } + dir_name = talloc_strndup(*name, (*name)->full_name, (p-(*name)->full_name)); + if (stat(dir_name, &(*name)->st) == 0) { + talloc_free(dir_name); + return NT_STATUS_OK; + } + /* we need to search for a matching name */ + saved_name = (*name)->full_name; + (*name)->full_name = dir_name; + status = pvfs_case_search(pvfs, *name); + if (!NT_STATUS_IS_OK(status)) { + /* the directory doesn't exist */ + (*name)->full_name = saved_name; + return status; + } + /* it does exist, but might need a case change */ + if (dir_name != (*name)->full_name) { + (*name)->full_name = talloc_asprintf(*name, "%s%s", + (*name)->full_name, p); + NT_STATUS_HAVE_NO_MEMORY((*name)->full_name); + } else { + (*name)->full_name = saved_name; + talloc_free(dir_name); + } return NT_STATUS_OK; } |