svn commit: samba r7797 - in trunk/source: include smbd

jra at samba.org jra at samba.org
Tue Jun 21 05:18:15 GMT 2005


Author: jra
Date: 2005-06-21 05:18:13 +0000 (Tue, 21 Jun 2005)
New Revision: 7797

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

Log:
Prepare for client setting capabilities to select posix pathnames on
the wire. Jerry do not merge this please. New SMB_SET_FS_INFO - level
0x200 - as was discussed on the mailing list.
Jeremy.

Modified:
   trunk/source/include/trans2.h
   trunk/source/smbd/trans2.c


Changeset:
Modified: trunk/source/include/trans2.h
===================================================================
--- trunk/source/include/trans2.h	2005-06-21 05:18:09 UTC (rev 7796)
+++ trunk/source/include/trans2.h	2005-06-21 05:18:13 UTC (rev 7797)
@@ -450,11 +450,13 @@
 /*
  Info level for TRANS2_QFSINFO - returns version of CIFS UNIX extensions, plus
  64-bits worth of capability fun :-).
+ Use the same info level for TRANS2_SETFSINFO
 */
 
 #define SMB_QUERY_CIFS_UNIX_INFO      0x200
+#define SMB_SET_CIFS_UNIX_INFO        0x200
 
-/* Returns the following.
+/* Returns or sets the following.
 
   UINT16             major version number
   UINT16             minor version number
@@ -474,13 +476,7 @@
 						(chflags) and lsattr */
 #define CIFS_UNIX_POSIX_PATHNAMES_CAP	   0x10 /* Use POSIX pathnames on the wire. */
 
-/*
- Info level for TRANSACT2_SETFSINFO - takes 64-bits of capabilies in the data section.
-*/
 
-#define SMB_SET_CIFS_UNIX_INFO      0x200
-
-
 #define SMB_QUERY_POSIX_FS_INFO     0x201
 
 /* Returns FILE_SYSTEM_POSIX_INFO struct as follows

Modified: trunk/source/smbd/trans2.c
===================================================================
--- trunk/source/smbd/trans2.c	2005-06-21 05:18:09 UTC (rev 7796)
+++ trunk/source/smbd/trans2.c	2005-06-21 05:18:13 UTC (rev 7797)
@@ -2435,7 +2435,7 @@
 	
 	ZERO_STRUCT(quotas);
 
-	DEBUG(10,("call_trans2setfsinfo: SET_FS_QUOTA: for service [%s]\n",lp_servicename(SNUM(conn))));
+	DEBUG(10,("call_trans2setfsinfo: for service [%s]\n",lp_servicename(SNUM(conn))));
 
 	/* access check */
 	if ((current_user.uid != 0)||!CAN_WRITE(conn)) {
@@ -2451,25 +2451,54 @@
 		return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
 	}
 
-	fsp = file_fsp(params,0);
+	info_level = SVAL(params,2);
 
-	if (!CHECK_NTQUOTA_HANDLE_OK(fsp,conn)) {
-		DEBUG(3,("TRANSACT_GET_USER_QUOTA: no valid QUOTA HANDLE\n"));
-		return ERROR_NT(NT_STATUS_INVALID_HANDLE);
-	}
+	switch(info_level) {
+		case SMB_SET_CIFS_UNIX_INFO:
+			{
+				uint16 client_unix_major;
+				uint16 client_unix_minor;
+				uint32 client_unix_cap_low;
+				uint32 client_unix_cap_high;
 
-	info_level = SVAL(params,2);
+				if (!lp_unix_extensions()) {
+					return ERROR_DOS(ERRDOS,ERRunknownlevel);
+				}
 
-	switch(info_level) {
+				/* There should be 12 bytes of capabilities set. */
+				if (total_data < 8) {
+					return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+				}
+				client_unix_major = SVAL(pdata,0);
+				client_unix_minor = SVAL(pdata,2);
+				client_unix_cap_low = IVAL(pdata,4);
+				client_unix_cap_high = IVAL(pdata,8);
+				/* Just print these values for now. */
+				DEBUG(10,("call_trans2setfsinfo: set unix info. major = %u, minor = %u\
+cap_low = 0x%x, cap_high = 0x%x\n",
+					(unsigned int)client_unix_major,
+					(unsigned int)client_unix_minor,
+					(unsigned int)client_unix_cap_low,
+					(unsigned int)client_unix_cap_high ));
+
+				outsize = set_message(outbuf,0,0,True);
+				break;
+			}
 		case SMB_FS_QUOTA_INFORMATION:
 			/* note: normaly there're 48 bytes,
 			 * but we didn't use the last 6 bytes for now 
 			 * --metze 
 			 */
+			fsp = file_fsp(params,0);
+			if (!CHECK_NTQUOTA_HANDLE_OK(fsp,conn)) {
+				DEBUG(3,("TRANSACT_GET_USER_QUOTA: no valid QUOTA HANDLE\n"));
+				return ERROR_NT(NT_STATUS_INVALID_HANDLE);
+			}
+
 			if (total_data < 42) {
 				DEBUG(0,("call_trans2setfsinfo: SET_FS_QUOTA: requires total_data(%d) >= 42 bytes!\n",
 					total_data));
-				return ERROR_DOS(ERRDOS,ERRunknownlevel);
+				return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
 			}
 			
 			/* unknown_1 24 NULL bytes in pdata*/
@@ -2483,7 +2512,7 @@
 				((quotas.softlim != 0xFFFFFFFF)||
 				(IVAL(pdata,28)!=0xFFFFFFFF))) {
 				/* more than 32 bits? */
-				return ERROR_DOS(ERRDOS,ERRunknownlevel);
+				return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
 			}
 #endif /* LARGE_SMB_OFF_T */
 		
@@ -2496,7 +2525,7 @@
 				((quotas.hardlim != 0xFFFFFFFF)||
 				(IVAL(pdata,36)!=0xFFFFFFFF))) {
 				/* more than 32 bits? */
-				return ERROR_DOS(ERRDOS,ERRunknownlevel);
+				return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
 			}
 #endif /* LARGE_SMB_OFF_T */
 		
@@ -2511,6 +2540,14 @@
 				return ERROR_DOS(ERRSRV,ERRerror);
 			}
 			
+			/* 
+			 * sending this reply works fine, 
+			 * but I'm not sure it's the same 
+			 * like windows do...
+			 * --metze
+			 */ 
+			outsize = set_message(outbuf,10,0,True);
+
 			break;
 		default:
 			DEBUG(3,("call_trans2setfsinfo: unknown level (0x%X) not implemented yet.\n",
@@ -2519,14 +2556,6 @@
 			break;
 	}
 
-	/* 
-	 * sending this reply works fine, 
-	 * but I'm not sure it's the same 
-	 * like windows do...
-	 * --metze
-	 */ 
-	outsize = set_message(outbuf,10,0,True);
-
 	return outsize;
 }
 



More information about the samba-cvs mailing list