]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
r21638: Change POSIX_UNLINK to allow clients to differentiate
authorJeremy Allison <jra@samba.org>
Thu, 1 Mar 2007 21:01:22 +0000 (21:01 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:18:19 +0000 (12:18 -0500)
between unlink/rmdir calls.
Jeremy.

source/include/trans2.h
source/smbd/trans2.c

index fb8e7716abe99d15f7a11a352b03e4c9245dc615..89227c39d9b851495177f9861a116615a1310c9a 100644 (file)
@@ -604,7 +604,7 @@ number of entries sent will be zero.
 
 #define SMB_POSIX_IGNORE_ACE_ENTRIES   0xFFFF
 
-/* Definition of parameter block of SMB_SET_POSIX_LOCK */
+/* Definition of data block of SMB_SET_POSIX_LOCK */
 /*
   [2 bytes] lock_type - 0 = Read, 1 = Write, 2 = Unlock
   [2 bytes] lock_flags - 1 = Wait (only valid for setlock)
@@ -643,7 +643,7 @@ number of entries sent will be zero.
 #define SMB_O_NOFOLLOW                 0x400
 #define SMB_O_DIRECT                   0x800
 
-/* Definition of request parameter block for SMB_POSIX_PATH_OPEN */
+/* Definition of request data block for SMB_POSIX_PATH_OPEN */
 /*
   [4 bytes] flags (as smb_ntcreate_Flags).
   [4 bytes] open_mode
@@ -660,4 +660,12 @@ number of entries sent will be zero.
   [n bytes] - info level reply  - if available.
 */
 
+/* Definition of request data block for SMB_POSIX_UNLINK */
+/*
+  [2 bytes] flags (defined below).
+*/
+
+#define SMB_POSIX_UNLINK_FILE_TARGET 0
+#define SMB_POSIX_UNLINK_DIRECTORY_TARGET 1
+
 #endif
index 5bbd618231b5336d529fad09dcbeafe2f4ba0a4a..2952c9b1dcedc703e3d469b9c792d721857b10f7 100644 (file)
@@ -5132,12 +5132,24 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
 {
        NTSTATUS status = NT_STATUS_OK;
        files_struct *fsp = NULL;
+       uint16 flags = 0;
        int info = 0;
 
+       if (total_data < 2) {
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       flags = SVAL(pdata,0);
+
        if (!VALID_STAT(*psbuf)) {
                return NT_STATUS_OBJECT_NAME_NOT_FOUND;
        }
 
+       if ((flags == SMB_POSIX_UNLINK_DIRECTORY_TARGET) &&
+                       !VALID_STAT_OF_DIR(*psbuf)) {
+               return NT_STATUS_NOT_A_DIRECTORY;
+       }
+
        if (VALID_STAT_OF_DIR(*psbuf)) {
                status = open_directory(conn,
                                        fname,