summaryrefslogtreecommitdiff
path: root/source3/smbd/vfs.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-03-05 22:32:45 +0000
committerJeremy Allison <jra@samba.org>2004-03-05 22:32:45 +0000
commit48eb635f31a09fa0822d95d3e895255ef8a6d5e2 (patch)
tree9cbef9d76909afa468a296684199c121134ad29c /source3/smbd/vfs.c
parent474758956cd73be0b5eea1070f9259608c12a4e6 (diff)
downloadsamba-48eb635f31a09fa0822d95d3e895255ef8a6d5e2.tar.gz
samba-48eb635f31a09fa0822d95d3e895255ef8a6d5e2.tar.bz2
samba-48eb635f31a09fa0822d95d3e895255ef8a6d5e2.zip
Several mb tidyups - getting ready to address the XXX_sub function.
Jeremy. (This used to be commit 92c3ae3458177ec7f721598311a8ad04b2db5138)
Diffstat (limited to 'source3/smbd/vfs.c')
-rw-r--r--source3/smbd/vfs.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 284e24e7b1..4f3234775a 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -863,8 +863,8 @@ BOOL reduce_name(connection_struct *conn, pstring s, const char *dir)
DEBUG(3,("reduce_name [%s] [%s]\n",s,dir));
- /* remove any double slashes */
- all_string_sub(s,"//","/",0);
+ /* We know there are no double slashes as this comes from srvstr_get_path().
+ and has gone through check_path_syntax(). JRA */
pstrcpy(base_name,s);
p = strrchr_m(base_name,'/');
@@ -915,17 +915,19 @@ BOOL reduce_name(connection_struct *conn, pstring s, const char *dir)
{
size_t l = strlen(dir2);
- if (dir2[l-1] == '/')
+ char *last_slash = strrchr_m(dir2, '/');
+
+ if (last_slash && (last_slash[1] == '\0'))
l--;
if (strncmp(newname,dir2,l) != 0) {
vfs_ChDir(conn,wd);
- DEBUG(2,("Bad access attempt? s=%s dir=%s newname=%s l=%d\n",s,dir2,newname,(int)l));
+ DEBUG(2,("Bad access attempt: s=%s dir=%s newname=%s l=%d\n",s,dir2,newname,(int)l));
return(False);
}
if (!readlink_check(conn, dir, newname)) {
- DEBUG(2, ("Bad access attemt? %s is a symlink outside the share path", s));
+ DEBUG(2, ("Bad access attemt: %s is a symlink outside the share path", s));
return(False);
}
@@ -947,4 +949,3 @@ BOOL reduce_name(connection_struct *conn, pstring s, const char *dir)
return(True);
#endif
}
-