summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-09-21 05:29:07 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:00:56 -0500
commitc209219d062830aa95e39cd97ac988244f1fc49b (patch)
treedbe0d424f5ee9c91720dd502545a171f249a8e0b /source3/smbd
parent3bddf16b1f61930f58b49070f1ca8a1c7df50886 (diff)
downloadsamba-c209219d062830aa95e39cd97ac988244f1fc49b.tar.gz
samba-c209219d062830aa95e39cd97ac988244f1fc49b.tar.bz2
samba-c209219d062830aa95e39cd97ac988244f1fc49b.zip
r18773: Change negprot_spnego to return a blob
(This used to be commit 28fa772721640a6d3a0f6a30fb56fde18b5f5616)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/negprot.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index b583623a4b..bbd1013050 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -169,7 +169,7 @@ static int reply_lanman2(char *inbuf, char *outbuf)
Generate the spnego negprot reply blob. Return the number of bytes used.
****************************************************************************/
-static int negprot_spnego(char *p)
+static DATA_BLOB negprot_spnego(void)
{
DATA_BLOB blob;
nstring dos_name;
@@ -180,7 +180,6 @@ static int negprot_spnego(char *p)
OID_NTLMSSP,
NULL};
const char *OIDs_plain[] = {OID_NTLMSSP, NULL};
- int len;
global_spnego_negotiated = True;
@@ -222,11 +221,7 @@ static int negprot_spnego(char *p)
SAFE_FREE(host_princ_s);
}
- memcpy(p, blob.data, blob.length);
- len = blob.length;
- data_blob_free(&blob);
-
- return len;
+ return blob;
}
/****************************************************************************
@@ -332,10 +327,17 @@ static int reply_nt1(char *inbuf, char *outbuf)
STR_UNICODE|STR_TERMINATE|STR_NOALIGN);
DEBUG(3,("not using SPNEGO\n"));
} else {
- int len = negprot_spnego(p);
-
+ DATA_BLOB spnego_blob = negprot_spnego();
+
+ if (spnego_blob.data == NULL) {
+ return ERROR_NT(NT_STATUS_NO_MEMORY);
+ }
+
+ memcpy(p, spnego_blob.data, spnego_blob.length);
+ p += spnego_blob.length;
+ data_blob_free(&spnego_blob);
+
SCVAL(outbuf,smb_vwv16+1, 0);
- p += len;
DEBUG(3,("using SPNEGO\n"));
}