summaryrefslogtreecommitdiff
path: root/source3/smbd/vfs.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-03-05 22:32:43 +0000
committerJeremy Allison <jra@samba.org>2004-03-05 22:32:43 +0000
commit443865396b9f7b98123cb81104fa0604ec4ca202 (patch)
treeafca921d4dc328040ee21f31a3a2d04e9be8d07e /source3/smbd/vfs.c
parent21c4e30fccbf7207ccad28fb188839e0635290ba (diff)
downloadsamba-443865396b9f7b98123cb81104fa0604ec4ca202.tar.gz
samba-443865396b9f7b98123cb81104fa0604ec4ca202.tar.bz2
samba-443865396b9f7b98123cb81104fa0604ec4ca202.zip
Several mb tidyups - getting ready to address the XXX_sub function.
Jeremy. (This used to be commit 13edba472a0a5eb56586458a2432d53f495d0129)
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
}
-