Author: jra Date: 2005-06-21 05:18:09 +0000 (Tue, 21 Jun 2005) New Revision: 7796
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7796 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: branches/SAMBA_3_0/source/include/trans2.h branches/SAMBA_3_0/source/smbd/trans2.c Changeset: Modified: branches/SAMBA_3_0/source/include/trans2.h =================================================================== --- branches/SAMBA_3_0/source/include/trans2.h 2005-06-21 04:33:24 UTC (rev 7795) +++ branches/SAMBA_3_0/source/include/trans2.h 2005-06-21 05:18:09 UTC (rev 7796) @@ -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: branches/SAMBA_3_0/source/smbd/trans2.c =================================================================== --- branches/SAMBA_3_0/source/smbd/trans2.c 2005-06-21 04:33:24 UTC (rev 7795) +++ branches/SAMBA_3_0/source/smbd/trans2.c 2005-06-21 05:18:09 UTC (rev 7796) @@ -2433,7 +2433,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)) { @@ -2449,25 +2449,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*/ @@ -2481,7 +2510,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 */ @@ -2494,7 +2523,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 */ @@ -2509,6 +2538,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", @@ -2517,14 +2554,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; }
