svn commit: samba r21638 - in branches: SAMBA_3_0/source/include SAMBA_3_0/source/smbd SAMBA_3_0_25/source/include SAMBA_3_0_25/source/smbd

jra at samba.org jra at samba.org
Thu Mar 1 21:01:22 GMT 2007


Author: jra
Date: 2007-03-01 21:01:22 +0000 (Thu, 01 Mar 2007)
New Revision: 21638

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=21638

Log:
Change POSIX_UNLINK to allow clients to differentiate
between unlink/rmdir calls.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/include/trans2.h
   branches/SAMBA_3_0/source/smbd/trans2.c
   branches/SAMBA_3_0_25/source/include/trans2.h
   branches/SAMBA_3_0_25/source/smbd/trans2.c


Changeset:
Modified: branches/SAMBA_3_0/source/include/trans2.h
===================================================================
--- branches/SAMBA_3_0/source/include/trans2.h	2007-03-01 20:52:14 UTC (rev 21637)
+++ branches/SAMBA_3_0/source/include/trans2.h	2007-03-01 21:01:22 UTC (rev 21638)
@@ -604,7 +604,7 @@
 
 #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 @@
 #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 @@
   [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

Modified: branches/SAMBA_3_0/source/smbd/trans2.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/trans2.c	2007-03-01 20:52:14 UTC (rev 21637)
+++ branches/SAMBA_3_0/source/smbd/trans2.c	2007-03-01 21:01:22 UTC (rev 21638)
@@ -5132,12 +5132,24 @@
 {
 	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,

Modified: branches/SAMBA_3_0_25/source/include/trans2.h
===================================================================
--- branches/SAMBA_3_0_25/source/include/trans2.h	2007-03-01 20:52:14 UTC (rev 21637)
+++ branches/SAMBA_3_0_25/source/include/trans2.h	2007-03-01 21:01:22 UTC (rev 21638)
@@ -589,7 +589,7 @@
 
 #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)
@@ -628,7 +628,7 @@
 #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
@@ -645,4 +645,12 @@
   [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

Modified: branches/SAMBA_3_0_25/source/smbd/trans2.c
===================================================================
--- branches/SAMBA_3_0_25/source/smbd/trans2.c	2007-03-01 20:52:14 UTC (rev 21637)
+++ branches/SAMBA_3_0_25/source/smbd/trans2.c	2007-03-01 21:01:22 UTC (rev 21638)
@@ -5132,12 +5132,24 @@
 {
 	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,



More information about the samba-cvs mailing list