From 540911001d1bf25d9534b72b90a32fc7e5efc4b0 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 8 Mar 2007 23:54:57 +0000 Subject: r21768: Fix the client dfs code such that smbclient can process deep dfs links (ie. links that go to non root parts of a share). Make the directory handling conanonical in POSIX and Windows pathname processing. dfs should not be fully working in client tools. Please bug me if not. Jeremy. (This used to be commit 1c9e10569cd97ee41de39f9f012bea4e4c932b5d) --- source3/lib/util.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index b29f459c02..aa8aaa0628 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -579,6 +579,13 @@ void dos_clean_name(char *s) /* remove any double slashes */ all_string_sub(s, "\\\\", "\\", 0); + /* Remove leading .\\ characters */ + if(strncmp(s, ".\\", 2) == 0) { + trim_string(s, ".\\", NULL); + if(*s == 0) + pstrcpy(s,".\\"); + } + while ((p = strstr_m(s,"\\..\\")) != NULL) { pstring s1; @@ -593,7 +600,6 @@ void dos_clean_name(char *s) } trim_string(s,NULL,"\\.."); - all_string_sub(s, "\\.\\", "\\", 0); } @@ -631,6 +637,13 @@ void unix_clean_name(char *s) } trim_string(s,NULL,"/.."); + all_string_sub(s, "/./", "/", 0); +} + +void clean_name(char *s) +{ + dos_clean_name(s); + unix_clean_name(s); } /******************************************************************* -- cgit