diff options
author | Jeremy Allison <jra@samba.org> | 2003-08-13 00:31:23 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2003-08-13 00:31:23 +0000 |
commit | a9975acc9255f1e047f680e424607479fcca6516 (patch) | |
tree | 95ec47022a206ad948f3686ac3f31ba28470a27c /source3 | |
parent | 5faf3ba9af1bc00db78f8743374acaff93879ff7 (diff) | |
download | samba-a9975acc9255f1e047f680e424607479fcca6516.tar.gz samba-a9975acc9255f1e047f680e424607479fcca6516.tar.bz2 samba-a9975acc9255f1e047f680e424607479fcca6516.zip |
Ensure we pass the Samba4 unlink test !
Jeremy.
(This used to be commit 73aaf8094c2fed76b6650afbd8ff4f050f5e52d2)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/reply.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 4ea1792885..dcb07ab509 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1215,6 +1215,9 @@ static NTSTATUS can_delete(char *fname,connection_struct *conn, int dirtype) int access_mode; files_struct *fsp; + DEBUG(10,("can_delete: %s, dirtype = %d\n", + fname, dirtype )); + if (!CAN_WRITE(conn)) return NT_STATUS_MEDIA_WRITE_PROTECTED; @@ -1226,8 +1229,13 @@ static NTSTATUS can_delete(char *fname,connection_struct *conn, int dirtype) return NT_STATUS_OBJECT_NAME_NOT_FOUND; fmode = dos_mode(conn,fname,&sbuf); + + /* Can't delete a directory. */ if (fmode & aDIR) return NT_STATUS_FILE_IS_A_DIRECTORY; + else if (dirtype & aDIR) /* Asked for a directory and it isn't. */ + return NT_STATUS_OBJECT_NAME_INVALID; + if (!lp_delete_readonly(SNUM(conn))) { if (fmode & aRONLY) return NT_STATUS_CANNOT_DELETE; @@ -1333,7 +1341,7 @@ NTSTATUS unlink_internals(connection_struct *conn, int dirtype, char *name) */ if (dirptr) { - error = NT_STATUS_OBJECT_NAME_NOT_FOUND; + error = NT_STATUS_NO_SUCH_FILE; if (strequal(mask,"????????.???")) pstrcpy(mask,"*"); |