diff options
author | Jeremy Allison <jra@samba.org> | 1998-09-19 03:34:12 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1998-09-19 03:34:12 +0000 |
commit | fc82bd2914c5687c0d03636ed05280c3506cea0c (patch) | |
tree | aa63c119c0d27057352753baa7d5805bd0d96a81 /source3 | |
parent | ac875597290a4519d6bbb2c476c4ba7ad3cf51c3 (diff) | |
download | samba-fc82bd2914c5687c0d03636ed05280c3506cea0c.tar.gz samba-fc82bd2914c5687c0d03636ed05280c3506cea0c.tar.bz2 samba-fc82bd2914c5687c0d03636ed05280c3506cea0c.zip |
Small bit of paranioa. Ensure that if the incoming name to
unix_convert() was a single '\' (the base directory of the service)
that it gets translated to a '.', not a '\0'.
Jeremy.
(This used to be commit f74f39f45fa55c1768d6622a52c494328f22f50b)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/filename.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index caba4064d7..7cbb3392cb 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -150,7 +150,8 @@ static void stat_cache_add( char *full_orig_name, char *orig_translated_path) /* * Don't cache trivial valid directory entries. */ - if((strcmp(full_orig_name, ".") == 0) || (strcmp(full_orig_name, "..") == 0)) + if((*full_orig_name == '\0') || (strcmp(full_orig_name, ".") == 0) || + (strcmp(full_orig_name, "..") == 0)) return; /* @@ -245,7 +246,7 @@ static BOOL stat_cache_lookup( char *name, char *dirpath, char **start, SMB_STRU /* * Don't lookup trivial valid directory entries. */ - if((strcmp(name, ".") == 0) || (strcmp(name, "..") == 0)) { + if((*name == '\0') || (strcmp(name, ".") == 0) || (strcmp(name, "..") == 0)) { global_stat_cache_misses++; return False; } @@ -366,6 +367,17 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component, trim_string(name,"/","/"); /* + * If we trimmed down to a single '\0' character + * then we should use the "." directory to avoid + * searching the cache. + */ + + if(!*name) { + name[0] = '.'; + name[1] = '\0'; + } + + /* * Ensure saved_last_component is valid even if file exists. */ |