]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Use smbd_server_guid() in the smb1 negprot reply
authorVolker Lendecke <vl@samba.org>
Tue, 4 Aug 2026 14:09:37 +0000 (16:09 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 10 Aug 2026 06:45:28 +0000 (06:45 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/smbd/smb1_negprot.c

index db96b3ffceb01eec635130852505cceb9801f50d..f1c6b825910f4f3723a6f753064a0f1c9e479666 100644 (file)
@@ -317,14 +317,40 @@ static NTSTATUS reply_nt1(struct smb_request *req, uint16_t choice)
                }
                DEBUG(3,("not using SPNEGO\n"));
        } else {
-               DATA_BLOB spnego_blob = negprot_spnego(req, xconn);
+               struct GUID server_guid = {};
+               struct GUID_ndr_buf guid_buf = {};
+               DATA_BLOB spnego_blob = {};
+
+               smbd_server_guid(&server_guid);
+               GUID_to_ndr_buf(&server_guid, &guid_buf);
+               ret = message_push_blob(&req->outbuf,
+                                       (DATA_BLOB){
+                                               .data = guid_buf.buf,
+                                               .length = sizeof(guid_buf.buf),
+                                       });
+               if (ret == -1) {
+                       DEBUG(0, ("Could not push server guid blob\n"));
+                       reply_nterror(req, NT_STATUS_NO_MEMORY);
+                       return NT_STATUS_NO_MEMORY;
+               }
 
+               spnego_blob = negprot_spnego(req, xconn);
                if (spnego_blob.data == NULL) {
                        reply_nterror(req, NT_STATUS_NO_MEMORY);
                        return NT_STATUS_NO_MEMORY;
                }
 
-               ret = message_push_blob(&req->outbuf, spnego_blob);
+               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_blob_free(&spnego_blob);
                if (ret == -1) {
                        DEBUG(0, ("Could not push spnego blob\n"));