summaryrefslogtreecommitdiff
path: root/source3/smbd/server.c
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-01-13 19:41:08 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-01-13 19:41:08 +0000
commit586c6276ec78c9ee276e3d01ba017db14c30e0ce (patch)
tree0c5dc4caaef1604ac1a173753ddab8def9781afe /source3/smbd/server.c
parent4f78f67d5f19d657e1ebf13d0ff936a95c67c846 (diff)
downloadsamba-586c6276ec78c9ee276e3d01ba017db14c30e0ce.tar.gz
samba-586c6276ec78c9ee276e3d01ba017db14c30e0ce.tar.bz2
samba-586c6276ec78c9ee276e3d01ba017db14c30e0ce.zip
Added an extra parameter for unix_convert. If present this is the
last component of the modified pathname before modification. This is needed due to an exceptional condition in reply_mv when the filesystem is case preserving, but not case sensitive and the user wants to change the case of a filename. Code for this is also added to reply.c Jeremy (jra@cygnus.com). (This used to be commit cdafa35f9dba6eb0073700e3a214348c432a3e84)
Diffstat (limited to 'source3/smbd/server.c')
-rw-r--r--source3/smbd/server.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 75e7279e6d..623a3fb2bd 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -378,14 +378,21 @@ for this service.
The function will return False if some part of the name except for the last
part cannot be resolved
+
+If the saved_last_component != 0, then the unmodified last component
+of the pathname is returned there. This is used in an exceptional
+case in reply_mv (so far). If saved_last_component == 0 then nothing
+is returned there.
****************************************************************************/
-BOOL unix_convert(char *name,int cnum)
+BOOL unix_convert(char *name,int cnum,pstring saved_last_component)
{
struct stat st;
char *start, *end;
pstring dirpath;
*dirpath = 0;
+ if(saved_last_component)
+ *saved_last_component = 0;
/* convert to basic unix format - removing \ chars and cleaning it up */
unix_format(name);
@@ -415,6 +422,17 @@ BOOL unix_convert(char *name,int cnum)
return(True);
}
+ /*
+ * Ensure saved_last_component is valid even if file exists.
+ */
+ if(saved_last_component) {
+ end = strrchr(name, '/');
+ if(end)
+ strcpy(saved_last_component, end + 1);
+ else
+ strcpy(saved_last_component, name);
+ }
+
/* stat the name - if it exists then we are all done! */
if (sys_stat(name,&st) == 0)
return(True);
@@ -442,7 +460,10 @@ BOOL unix_convert(char *name,int cnum)
end = strchr(start, '/');
/* chop the name at this point */
- if (end) *end = 0;
+ if (end) *end = 0;
+
+ if(saved_last_component != 0)
+ strcpy(saved_last_component, end ? end + 1 : start);
/* check if the name exists up to this point */
if (sys_stat(name, &st) == 0)
@@ -467,7 +488,6 @@ BOOL unix_convert(char *name,int cnum)
later */
if (end) strcpy(rest,end+1);
-
/* try to find this part of the path in the directory */
if (strchr(start,'?') || strchr(start,'*') ||
!scan_directory(dirpath, start, SNUM(cnum), end?True:False))