summaryrefslogtreecommitdiff
path: root/source3/smbd/filename.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-03-03 20:55:59 +0000
committerJeremy Allison <jra@samba.org>2004-03-03 20:55:59 +0000
commitfba5a722497c1e4577aa463921a0fec5f6d5fe55 (patch)
tree15df1942a8929c34b86df0a1bf1042700d0e7f85 /source3/smbd/filename.c
parent7ac1750de20edf1b315feb8648f292ff82e92c21 (diff)
downloadsamba-fba5a722497c1e4577aa463921a0fec5f6d5fe55.tar.gz
samba-fba5a722497c1e4577aa463921a0fec5f6d5fe55.tar.bz2
samba-fba5a722497c1e4577aa463921a0fec5f6d5fe55.zip
Use a common function to parse all pathnames from the wire. This allows
much closer emulation of Win2k3 error return codes. Jeremy. (This used to be commit c9f31fafeda6ad79e590276f36e03ecd2e93f818)
Diffstat (limited to 'source3/smbd/filename.c')
-rw-r--r--source3/smbd/filename.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index 643e315c06..a71e8a806c 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -114,29 +114,30 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen
DEBUG(5, ("unix_convert called on file \"%s\"\n", name));
/*
- * Convert to basic unix format - removing \ chars and cleaning it up.
+ * Conversion to basic unix format is already done in check_path_syntax().
*/
- unix_format(name);
- unix_clean_name(name);
-
/*
- * Names must be relative to the root of the service - trim any leading /.
- * also trim trailing /'s.
+ * Names must be relative to the root of the service - any leading /.
+ * and trailing /'s should have been trimmed by check_path_syntax().
*/
- trim_char(name,'/','/');
+#ifdef DEVELOPER
+ SMB_ASSERT(*name != '/');
+#endif
/*
* If we trimmed down to a single '\0' character
* then we should use the "." directory to avoid
* searching the cache, but not if we are in a
* printing share.
+ * As we know this is valid we can return true here.
*/
if (!*name) {
name[0] = '.';
name[1] = '\0';
+ return(True);
}
/*
@@ -154,19 +155,7 @@ BOOL unix_convert(pstring name,connection_struct *conn,char *saved_last_componen
if (!case_sensitive && (!case_preserve || (mangle_is_8_3(name, False) && !short_case_preserve)))
strnorm(name);
- /*
- * If we trimmed down to a single '\0' character
- * then we will be using the "." directory.
- * As we know this is valid we can return true here.
- */
-
- if(!*name)
- return(True);
-
start = name;
- while (start[0] == '.' && start[1] == '/')
- start += 2;
-
pstrcpy(orig_path, name);
if(!case_sensitive && stat_cache_lookup(conn, name, dirpath, &start, &st)) {