]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Remove creating the server_guid from negprot_spnego master
authorVolker Lendecke <vl@samba.org>
Tue, 4 Aug 2026 15:50:50 +0000 (17:50 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 10 Aug 2026 07:49:11 +0000 (07:49 +0000)
To me this was very confusing and hidden behind an API that does
something different.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Aug 10 07:49:11 UTC 2026 on atb-devel-224

source3/smbd/smb1_negprot.c
source3/smbd/smb2_negprot.c

index f1c6b825910f4f3723a6f753064a0f1c9e479666..08b792760eb2ea5a7af0b45526e7ed90c94fb9a2 100644 (file)
@@ -340,16 +340,10 @@ static NTSTATUS reply_nt1(struct smb_request *req, uint16_t choice)
                        return NT_STATUS_NO_MEMORY;
                }
 
-               if (spnego_blob.length < 16) {
-                       reply_nterror(req, NT_STATUS_INTERNAL_ERROR);
-                       return NT_STATUS_INTERNAL_ERROR;
-               }
-
                ret = message_push_blob(&req->outbuf,
                                        (DATA_BLOB){
-                                               .data = spnego_blob.data + 16,
-                                               .length = spnego_blob.length -
-                                                         16,
+                                               .data = spnego_blob.data,
+                                               .length = spnego_blob.length,
                                        });
                data_blob_free(&spnego_blob);
                if (ret == -1) {
index f104e2b6305b33cb8791c7701e736ae347b234ba..32a2e5e63f6d467c3db7b599e6d083d842c2bbc5 100644 (file)
@@ -385,16 +385,11 @@ NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req)
        in_transport_caps =  smb2_negotiate_context_find(&in_c,
                                        SMB2_TRANSPORT_CAPABILITIES);
 
-       /* negprot_spnego() returns the server guid in the first 16 bytes */
        negprot_spnego_blob = negprot_spnego(req, xconn);
        if (negprot_spnego_blob.data == NULL) {
                return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
        }
 
-       if (negprot_spnego_blob.length < 16) {
-               return smbd_smb2_request_error(req, NT_STATUS_INTERNAL_ERROR);
-       }
-
        security_mode = SMB2_NEGOTIATE_SIGNING_ENABLED;
        if (xconn->smb2.signing_mandatory) {
                security_mode |= SMB2_NEGOTIATE_SIGNING_REQUIRED;
@@ -748,8 +743,7 @@ NTSTATUS smbd_smb2_request_process_negprot(struct smbd_smb2_request *req)
 
        security_offset = SMB2_HDR_BODY + 0x40;
 
-       security_buffer = data_blob_const(negprot_spnego_blob.data + 16,
-                                         negprot_spnego_blob.length - 16);
+       security_buffer = negprot_spnego_blob;
 
        if (posix) {
                /* Client correctly negotiated SMB2 unix extensions. */
@@ -1002,9 +996,6 @@ static void smbd_smb2_request_process_negprot_mc_done(struct tevent_req *subreq)
 DATA_BLOB negprot_spnego(TALLOC_CTX *ctx, struct smbXsrv_connection *xconn)
 {
        DATA_BLOB blob = data_blob_null;
-       DATA_BLOB blob_out = data_blob_null;
-       nstring dos_name;
-       fstring unix_name;
        NTSTATUS status;
        struct gensec_security *gensec_security;
 
@@ -1053,24 +1044,7 @@ DATA_BLOB negprot_spnego(TALLOC_CTX *ctx, struct smbXsrv_connection *xconn)
                return data_blob_null;
        }
 
-       blob_out = data_blob_talloc(ctx, NULL, 16 + blob.length);
-       if (blob_out.data == NULL) {
-               data_blob_free(&blob);
-               return data_blob_null;
-       }
-
-       memset(blob_out.data, '\0', 16);
-
-       checked_strlcpy(unix_name, lp_netbios_name(), sizeof(unix_name));
-       (void)strlower_m(unix_name);
-       push_ascii_nstring(dos_name, unix_name);
-       strlcpy((char *)blob_out.data, dos_name, 17);
-
-       memcpy(&blob_out.data[16], blob.data, blob.length);
-
-       data_blob_free(&blob);
-
-       return blob_out;
+       return blob;
 }
 
 void smbd_server_guid(struct GUID *server_guid)