summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix/pvfs_resolve.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-12 05:10:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:49 -0500
commit52f525c104ae2d17901f104cbf482395dc803cc1 (patch)
tree1ccd6d3879a0d82311f8796cb15e958b1e77ab5a /source4/ntvfs/posix/pvfs_resolve.c
parentc7130b816b29cab981646482e57cb6923ae91b4f (diff)
downloadsamba-52f525c104ae2d17901f104cbf482395dc803cc1.tar.gz
samba-52f525c104ae2d17901f104cbf482395dc803cc1.tar.bz2
samba-52f525c104ae2d17901f104cbf482395dc803cc1.zip
r2927: imported the hash2 name mangling code from Samba3 into Samba4, but
heavily modified to suit the Samba4 architecture. Samba4 with posix backend now passes the BASE-MANGLE test (This used to be commit ed52d69e8a065b6a8df2fb73c89be67acfdbca65)
Diffstat (limited to 'source4/ntvfs/posix/pvfs_resolve.c')
-rw-r--r--source4/ntvfs/posix/pvfs_resolve.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/source4/ntvfs/posix/pvfs_resolve.c b/source4/ntvfs/posix/pvfs_resolve.c
index 5d6f270a42..5b1a5680ae 100644
--- a/source4/ntvfs/posix/pvfs_resolve.c
+++ b/source4/ntvfs/posix/pvfs_resolve.c
@@ -35,16 +35,18 @@
*/
static int component_compare(struct pvfs_state *pvfs, const char *comp, const char *name)
{
- char *shortname;
int ret;
- if (StrCaseCmp(comp, name) == 0) return 0;
+ ret = StrCaseCmp(comp, name);
- shortname = pvfs_short_name_component(pvfs, name);
-
- ret = StrCaseCmp(comp, shortname);
+ if (ret != 0) {
+ char *shortname = pvfs_short_name_component(pvfs, name);
+ if (shortname) {
+ ret = StrCaseCmp(comp, shortname);
+ talloc_free(shortname);
+ }
+ }
- talloc_free(shortname);
return ret;
}
@@ -95,6 +97,13 @@ static NTSTATUS pvfs_case_search(struct pvfs_state *pvfs, struct pvfs_filename *
char *test_name;
DIR *dir;
struct dirent *de;
+ char *long_component;
+
+ /* possibly remap from the short name cache */
+ long_component = pvfs_mangled_lookup(pvfs, name, components[i]);
+ if (long_component) {
+ components[i] = long_component;
+ }
test_name = talloc_asprintf(name, "%s/%s", partial_name, components[i]);
if (!test_name) {