summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-09-12 05:12:50 +0200
committerJeremy Allison <jra@samba.org>2011-09-14 12:37:02 -0700
commit555c626af83a2dc7bc81f012dd93d73045a3428f (patch)
treed5aad938d0f6d060b142e218c17abe2f8e9aa870
parentf261ac1932ecdae925b27301aa3e907757845a85 (diff)
downloadsamba-555c626af83a2dc7bc81f012dd93d73045a3428f.tar.gz
samba-555c626af83a2dc7bc81f012dd93d73045a3428f.tar.bz2
samba-555c626af83a2dc7bc81f012dd93d73045a3428f.zip
s3:smbd: remember the client unix capabilities on the connection
metze Signed-off-by: Jeremy Allison <jra@samba.org>
-rw-r--r--source3/smbd/globals.h7
-rw-r--r--source3/smbd/trans2.c80
2 files changed, 44 insertions, 43 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 92532c2d09..4d954534dc 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -532,6 +532,13 @@ struct smbd_server_connection {
} negprot;
struct {
+ uint16_t client_major;
+ uint16_t client_minor;
+ uint32_t client_cap_low;
+ uint32_t client_cap_high;
+ } unix_info;
+
+ struct {
bool done_sesssetup;
/*
* Size of data we can send to client. Set
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 881dced310..8d3482873a 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -3539,6 +3539,7 @@ static void call_trans2setfsinfo(connection_struct *conn,
char **ppdata, int total_data,
unsigned int max_data_bytes)
{
+ struct smbd_server_connection *sconn = req->sconn;
char *pdata = *ppdata;
char *params = *pparams;
uint16 info_level;
@@ -3579,54 +3580,47 @@ static void call_trans2setfsinfo(connection_struct *conn,
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;
-
- if (!lp_unix_extensions()) {
- reply_nterror(req,
- NT_STATUS_INVALID_LEVEL);
- return;
- }
+ if (!lp_unix_extensions()) {
+ reply_nterror(req,
+ NT_STATUS_INVALID_LEVEL);
+ return;
+ }
- /* There should be 12 bytes of capabilities set. */
- if (total_data < 8) {
- reply_nterror(
- req,
- NT_STATUS_INVALID_PARAMETER);
- return;
- }
- 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 ));
-
- /* Here is where we must switch to posix pathname processing... */
- if (client_unix_cap_low & CIFS_UNIX_POSIX_PATHNAMES_CAP) {
- lp_set_posix_pathnames();
- mangle_change_to_posix();
- }
+ /* There should be 12 bytes of capabilities set. */
+ if (total_data < 8) {
+ reply_nterror(
+ req,
+ NT_STATUS_INVALID_PARAMETER);
+ return;
+ }
+ sconn->smb1.unix_info.client_major = SVAL(pdata,0);
+ sconn->smb1.unix_info.client_minor = SVAL(pdata,2);
+ sconn->smb1.unix_info.client_cap_low = IVAL(pdata,4);
+ sconn->smb1.unix_info.client_cap_high = IVAL(pdata,8);
+ /* Just print these values for now. */
+ DEBUG(10,("call_trans2setfsinfo: set unix_info info. major = %u, minor = %u \
+cap_low = 0x%x, cap_highn",
+ (unsigned int)sconn->smb1.unix_info.client_major,
+ (unsigned int)sconn->smb1.unix_info.client_minor,
+ (unsigned int)sconn->smb1.unix_info.client_cap_low,
+ (unsigned int)sconn->smb1.unix_info.client_cap_high));
+
+ /* Here is where we must switch to posix pathname processing... */
+ if (sconn->smb1.unix_info.client_cap_low & CIFS_UNIX_POSIX_PATHNAMES_CAP) {
+ lp_set_posix_pathnames();
+ mangle_change_to_posix();
+ }
- if ((client_unix_cap_low & CIFS_UNIX_FCNTL_LOCKS_CAP) &&
- !(client_unix_cap_low & CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP)) {
- /* Client that knows how to do posix locks,
- * but not posix open/mkdir operations. Set a
- * default type for read/write checks. */
+ if ((sconn->smb1.unix_info.client_cap_low & CIFS_UNIX_FCNTL_LOCKS_CAP) &&
+ !(sconn->smb1.unix_info.client_cap_low & CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP)) {
+ /* Client that knows how to do posix locks,
+ * but not posix open/mkdir operations. Set a
+ * default type for read/write checks. */
- lp_set_posix_default_cifsx_readwrite_locktype(POSIX_LOCK);
+ lp_set_posix_default_cifsx_readwrite_locktype(POSIX_LOCK);
- }
- break;
}
+ break;
case SMB_REQUEST_TRANSPORT_ENCRYPTION:
{