From 8e2aa47b3fb159ce17ea9cd7f8d88a59386c0d84 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 23 Jul 2007 19:46:48 +0000 Subject: r24009: Revert to the 3.0.25 logic for parsing the client's protocols. hpisgr8 with gcc still gives timeouts which worry me. Volker (This used to be commit c30835b4f0416b2b2b7d77d31b0fca0606f2387a) --- source3/smbd/negprot.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c index 7602490c2d..a8578d56b5 100644 --- a/source3/smbd/negprot.c +++ b/source3/smbd/negprot.c @@ -511,6 +511,7 @@ void reply_negprot(connection_struct *conn, struct smb_request *req) int choice= -1; int protocol; char *p; + int bcc = SVAL(smb_buf(req->inbuf),-2); int arch = ARCH_ALL; int num_cliprotos; char **cliprotos; @@ -533,23 +534,14 @@ void reply_negprot(connection_struct *conn, struct smb_request *req) return; } - p = smb_buf(req->inbuf); + p = smb_buf(req->inbuf) + 1; num_cliprotos = 0; cliprotos = NULL; - while (smb_bufrem(req->inbuf, p) > 0) { - char **tmp; - - if (p[0] != 0x02) { - DEBUG(3, ("Invalid string specifier %x, expected " - "0x02\n", (int)p[0])); - reply_nterror(req, NT_STATUS_INVALID_PARAMETER); - END_PROFILE(SMBnegprot); - return; - } + while (p < (smb_buf(req->inbuf) + bcc)) { - p += 1; /* Skip the "0x02" */ + char **tmp; tmp = TALLOC_REALLOC_ARRAY(tmp_talloc_ctx(), cliprotos, char *, num_cliprotos+1); @@ -576,7 +568,7 @@ void reply_negprot(connection_struct *conn, struct smb_request *req) cliprotos[num_cliprotos])); num_cliprotos += 1; - p += strlen(p) + 1; + p += strlen(p) + 2; } for (i=0; i