summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-09-13 18:09:42 +0200
committerStefan Metzmacher <metze@samba.org>2011-09-15 12:12:25 +0200
commitabca5f17c38f5ced2d03d66f99f91f895bf00851 (patch)
tree9de49a65fbdac433da58d2154fde1b12642c1b74 /source3/libsmb
parent14e8ef14a0cf44476160d3c0a12d0166002987a0 (diff)
downloadsamba-abca5f17c38f5ced2d03d66f99f91f895bf00851.tar.gz
samba-abca5f17c38f5ced2d03d66f99f91f895bf00851.tar.bz2
samba-abca5f17c38f5ced2d03d66f99f91f895bf00851.zip
s3:libsmb: detect lock_read and write_unlock support
metze
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/cliconnect.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index e2d0a2b8bd..91e613affb 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -2600,6 +2600,7 @@ static void cli_negprot_done(struct tevent_req *subreq)
struct cli_negprot_state *state = tevent_req_data(
req, struct cli_negprot_state);
struct cli_state *cli = state->cli;
+ uint8_t flags;
uint8_t wct;
uint16_t *vwv;
uint32_t num_bytes;
@@ -2618,6 +2619,8 @@ static void cli_negprot_done(struct tevent_req *subreq)
uint16_t server_security_mode = 0;
bool server_readbraw = false;
bool server_writebraw = false;
+ bool server_lockread = false;
+ bool server_writeunlock = false;
enum protocol_types protocol;
status = cli_smb_recv(subreq, state, &inbuf, 1, &wct, &vwv,
@@ -2628,6 +2631,8 @@ static void cli_negprot_done(struct tevent_req *subreq)
return;
}
+ flags = CVAL(inbuf, smb_flg);
+
protnum = SVAL(vwv, 0);
if ((protnum >= ARRAY_SIZE(prots))
@@ -2645,6 +2650,11 @@ static void cli_negprot_done(struct tevent_req *subreq)
return;
}
+ if (flags & FLAG_SUPPORT_LOCKREAD) {
+ server_lockread = true;
+ server_writeunlock = true;
+ }
+
if (protocol >= PROTOCOL_NT1) {
struct timespec ts;
const char *client_signing = NULL;
@@ -2674,6 +2684,9 @@ static void cli_negprot_done(struct tevent_req *subreq)
server_readbraw = true;
server_writebraw = true;
}
+ if (server_capabilities & CAP_LOCK_AND_READ) {
+ server_lockread = true;
+ }
/* work out if they sent us a workgroup */
if (!(server_capabilities & CAP_EXTENDED_SECURITY) &&
smb_buflen(inbuf) > 8) {
@@ -2779,6 +2792,8 @@ static void cli_negprot_done(struct tevent_req *subreq)
cli->conn.smb1.server.readbraw = server_readbraw;
cli->conn.smb1.server.writebraw = server_writebraw;
+ cli->conn.smb1.server.lockread = server_lockread;
+ cli->conn.smb1.server.writeunlock = server_writeunlock;
tevent_req_done(req);
}