]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Allow to request SMB311 posix in source3/libsmb
authorVolker Lendecke <vl@samba.org>
Thu, 25 Aug 2022 10:20:26 +0000 (12:20 +0200)
committerRalph Boehme <slow@samba.org>
Fri, 2 Sep 2022 13:31:38 +0000 (13:31 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/include/client.h
source3/libsmb/cliconnect.c

index 14be20ef1e0cceca463c800c25e080873c7b658a..4939e1879cf7688bcc0e9da50d1c12ae028b67ec 100644 (file)
@@ -119,5 +119,6 @@ struct file_info {
 #define CLI_FULL_CONNECTION_FORCE_SMB1 0x0400
 #define CLI_FULL_CONNECTION_DISABLE_SMB1 0x0800
 #define CLI_FULL_CONNECTION_IPC          0x1000
+#define CLI_FULL_CONNECTION_REQUEST_POSIX 0x2000
 
 #endif /* _CLIENT_H */
index 34cbbd723a8d05311471e3172db01dbed1aef01e..0fb2b6ea45ae86d94b6b071892438415797c22be 100644 (file)
@@ -2776,6 +2776,7 @@ struct cli_start_connection_state {
        struct cli_state *cli;
        int min_protocol;
        int max_protocol;
+       struct smb2_negotiate_contexts *negotiate_contexts;
 };
 
 static void cli_start_connection_connected(struct tevent_req *subreq);
@@ -2827,6 +2828,26 @@ static struct tevent_req *cli_start_connection_send(
                                          state->min_protocol);
        }
 
+       state->negotiate_contexts = talloc_zero(
+               state, struct smb2_negotiate_contexts);
+       if (tevent_req_nomem(state->negotiate_contexts, req)) {
+               return tevent_req_post(req, ev);
+       }
+
+       if (flags & CLI_FULL_CONNECTION_REQUEST_POSIX) {
+               NTSTATUS status;
+
+               status = smb2_negotiate_context_add(
+                       state->negotiate_contexts,
+                       state->negotiate_contexts,
+                       SMB2_POSIX_EXTENSIONS_AVAILABLE,
+                       (const uint8_t *)SMB2_CREATE_TAG_POSIX,
+                       strlen(SMB2_CREATE_TAG_POSIX));
+               if (tevent_req_nterror(req, status)) {
+                       return tevent_req_post(req, ev);
+               }
+       }
+
        subreq = cli_connect_nb_send(state, ev, dest_host, dest_ss, port,
                                     0x20, my_name, signing_state, flags);
        if (tevent_req_nomem(subreq, req)) {
@@ -2858,7 +2879,7 @@ static void cli_start_connection_connected(struct tevent_req *subreq)
                state->min_protocol,
                state->max_protocol,
                WINDOWS_CLIENT_PURE_SMB2_NEGPROT_INITIAL_CREDIT_ASK,
-               NULL);
+               state->negotiate_contexts);
        if (tevent_req_nomem(subreq, req)) {
                return;
        }