]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmbclient: Fix negotiating posix_extensions
authorAndreas Schneider <asn@samba.org>
Tue, 25 Nov 2025 18:06:48 +0000 (19:06 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 9 Dec 2025 18:30:34 +0000 (18:30 +0000)
Without this, smbc_setOptionPosixExtensions() does nothing.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15960

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/libsmb/libsmb_server.c

index f9b52e1f05a6ccae17815e6d5882c31962c16da9..7b1def05f0b7980d257cc1ba6644140913680fb0 100644 (file)
@@ -547,6 +547,10 @@ SMBC_server_internal(TALLOC_CTX *ctx,
                signing_state = SMB_SIGNING_REQUIRED;
        }
 
+       if (context->internal->posix_extensions) {
+               flags |= CLI_FULL_CONNECTION_REQUEST_POSIX;
+       }
+
        if (nts.num_transports != 0 && ots.num_transports != 0) {
                if (share == NULL || *share == '\0' || is_ipc) {
                        /*
@@ -554,15 +558,15 @@ SMBC_server_internal(TALLOC_CTX *ctx,
                         */
                        ts = &ots;
 
-                       status = cli_connect_nb(NULL,
-                                               server_n,
-                                               NULL,
-                                               &nts,
-                                               0x20,
-                                               smbc_getNetbiosName(context),
-                                               signing_state,
-                                               flags,
-                                               &c);
+                       status = cli_start_connection(
+                               context->internal->mem_ctx,
+                               &c,
+                               smbc_getNetbiosName(context),
+                               server_n,
+                               NULL, /* dest_ss */
+                               &nts, /* transports */
+                               signing_state,
+                               flags);
                }
        }
 
@@ -570,15 +574,14 @@ SMBC_server_internal(TALLOC_CTX *ctx,
                /*
                 * No IPC$ or 139 did not work
                 */
-               status = cli_connect_nb(NULL,
-                                       server_n,
-                                       NULL,
-                                       ts,
-                                       0x20,
-                                       smbc_getNetbiosName(context),
-                                       signing_state,
-                                       flags,
-                                       &c);
+               status = cli_start_connection(context->internal->mem_ctx,
+                                             &c,
+                                             smbc_getNetbiosName(context),
+                                             server_n,
+                                             NULL, /* dest_ss */
+                                             ts, /* transports */
+                                             signing_state,
+                                             flags);
        }
 
        if (!NT_STATUS_IS_OK(status)) {
@@ -592,24 +595,6 @@ SMBC_server_internal(TALLOC_CTX *ctx,
 
        cli_set_timeout(c, smbc_getTimeout(context));
 
-       status = smbXcli_negprot(c->conn,
-                                c->timeout,
-                                lp_client_min_protocol(),
-                                lp_client_max_protocol(),
-                                NULL,
-                                NULL,
-                                NULL);
-       if (!NT_STATUS_IS_OK(status)) {
-               cli_shutdown(c);
-               errno = map_errno_from_nt_status(status);
-               return NULL;
-       }
-
-       if (smbXcli_conn_protocol(c->conn) >= PROTOCOL_SMB2_02) {
-               /* Ensure we ask for some initial credits. */
-               smb2cli_conn_set_max_credits(c->conn, DEFAULT_SMB2_MAX_CREDITS);
-       }
-
        username_used = *pp_username;
        password_used = *pp_password;