From: Volker Lendecke Date: Tue, 4 Aug 2026 14:09:37 +0000 (+0200) Subject: smbd: Use smbd_server_guid() in the smb1 negprot reply X-Git-Tag: samba-4.25.0rc1~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a01074752413a4ae4cec083f6f72869d7e4d7af;p=thirdparty%2Fsamba.git smbd: Use smbd_server_guid() in the smb1 negprot reply Signed-off-by: Volker Lendecke Reviewed-by: Stefan Metzmacher --- diff --git a/source3/smbd/smb1_negprot.c b/source3/smbd/smb1_negprot.c index db96b3ffceb..f1c6b825910 100644 --- a/source3/smbd/smb1_negprot.c +++ b/source3/smbd/smb1_negprot.c @@ -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"));