summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-02-25 00:48:17 +0000
committerJeremy Allison <jra@samba.org>2004-02-25 00:48:17 +0000
commit7b51df1e5400a188b7f3d69b973774d35c952d27 (patch)
treefbe08b3079ccc8e15ad47a48edea5044d1f908c5 /source3/smbd
parentc09049d25b22d843524ba54ceeb69295487b2de6 (diff)
downloadsamba-7b51df1e5400a188b7f3d69b973774d35c952d27.tar.gz
samba-7b51df1e5400a188b7f3d69b973774d35c952d27.tar.bz2
samba-7b51df1e5400a188b7f3d69b973774d35c952d27.zip
More gentest fixes.
Jeremy. (This used to be commit fc9811693933327a15b7dbe4893219c7ef44d1e8)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/reply.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 0fe3be0752..d0888fc682 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1309,7 +1309,7 @@ static NTSTATUS can_rename(char *fname,connection_struct *conn, SMB_STRUCT_STAT
Check if a user is allowed to delete a file.
********************************************************************/
-static NTSTATUS can_delete(char *fname,connection_struct *conn, int dirtype)
+static NTSTATUS can_delete(char *fname,connection_struct *conn, int dirtype, BOOL bad_path)
{
SMB_STRUCT_STAT sbuf;
int fmode;
@@ -1323,8 +1323,15 @@ static NTSTATUS can_delete(char *fname,connection_struct *conn, int dirtype)
if (!CAN_WRITE(conn))
return NT_STATUS_MEDIA_WRITE_PROTECTED;
- if (SMB_VFS_LSTAT(conn,fname,&sbuf) != 0)
- return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ if (SMB_VFS_LSTAT(conn,fname,&sbuf) != 0) {
+ if(errno == ENOENT) {
+ if (bad_path)
+ return NT_STATUS_OBJECT_PATH_NOT_FOUND;
+ else
+ return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ }
+ return map_nt_error_from_unix(errno);
+ }
fmode = dos_mode(conn,fname,&sbuf);
@@ -1421,7 +1428,7 @@ NTSTATUS unlink_internals(connection_struct *conn, int dirtype, char *name)
if (!has_wild) {
pstrcat(directory,"/");
pstrcat(directory,mask);
- error = can_delete(directory,conn,dirtype);
+ error = can_delete(directory,conn,dirtype,bad_path);
if (!NT_STATUS_IS_OK(error))
return error;
@@ -1457,7 +1464,7 @@ NTSTATUS unlink_internals(connection_struct *conn, int dirtype, char *name)
continue;
slprintf(fname,sizeof(fname)-1, "%s/%s",directory,dname);
- error = can_delete(fname,conn,dirtype);
+ error = can_delete(fname,conn,dirtype,bad_path);
if (!NT_STATUS_IS_OK(error))
continue;
if (SMB_VFS_UNLINK(conn,fname) == 0)
@@ -3639,7 +3646,8 @@ directory = %s, newname = %s, newname_last_component = %s, is_8_3 = %d\n",
dirptr = OpenDir(conn, directory, True);
if (dirptr) {
- error = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ error = NT_STATUS_NO_SUCH_FILE;
+/* Was error = NT_STATUS_OBJECT_NAME_NOT_FOUND; - gentest fix. JRA */
if (strequal(mask,"????????.???"))
pstrcpy(mask,"*");
@@ -3649,6 +3657,9 @@ directory = %s, newname = %s, newname_last_component = %s, is_8_3 = %d\n",
pstrcpy(fname,dname);
+ if((strcmp(fname, ".") == 0) || (strcmp(fname, "..")==0))
+ continue;
+
if(!mask_match(fname, mask, case_sensitive))
continue;