From abca5f17c38f5ced2d03d66f99f91f895bf00851 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 13 Sep 2011 18:09:42 +0200 Subject: s3:libsmb: detect lock_read and write_unlock support metze --- source3/libsmb/cliconnect.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source3/libsmb') 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); } -- cgit