summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@centraldogma>2012-01-15 22:24:50 +0100
committercinap_lenrek <cinap_lenrek@centraldogma>2012-01-15 22:24:50 +0100
commitb15accceac5f79106bb6a115985eed63284171cf (patch)
treed488c2ac1d43324b3471e70c4ce2eb5164ad4519
parent413ab7785f7bbbfbbfdffef964f90569708f6d48 (diff)
downloadplan9front-b15accceac5f79106bb6a115985eed63284171cf.tar.xz
cifsd: send SMB_COM_NEGOTIATE response like NT
-rw-r--r--sys/src/cmd/ip/cifsd/smb.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/src/cmd/ip/cifsd/smb.c b/sys/src/cmd/ip/cifsd/smb.c
index bcb8a28fd..50894b5d9 100644
--- a/sys/src/cmd/ip/cifsd/smb.c
+++ b/sys/src/cmd/ip/cifsd/smb.c
@@ -17,7 +17,7 @@ static int negotiated;
void
smbnegotiate(Req *r, uchar *h, uchar *p, uchar *e)
{
- uchar *d, *de, *c, *ce;
+ uchar *d, *de, *c, *ce, dom[256];
int i, x, mode;
char *s;
@@ -53,11 +53,19 @@ err:
} else
logit("auth_challenge: %r");
}
- if(!pack(r->rh, r->rp, r->re, "#0b{*2wbwwllllvw#2b}#1w{[]f}.",
+
+ /*
+ * <89> Section 2.2.4.52.2: Windows NT servers always send the DomainName
+ * field in Unicode characters and never add a padding byte for alignment.
+ * Windows clients ignore the DomainName field in the server response.
+ */
+ d = dom;
+ de = dom + smbstrpack16(d, d, d + sizeof(dom), domain);
+ if(!pack(r->rh, r->rp, r->re, "#0b{*2wbwwllllvw#2b}#1w{[][]}.",
x, mode, 50, 1, BUFFERSIZE, 0x10000, sessionkey,
CAP_UNICODE | CAP_LARGEFILES |
CAP_NT_FIND | CAP_NT_SMBS | CAP_NT_STATUS,
- tofiletime(time(0)), -tzoff/60, c, ce, r->o->strpack, domain, &r->rp))
+ tofiletime(time(0)), -tzoff/60, c, ce, d, de, &r->rp))
goto err;
negotiated = 1;
r->respond(r, 0);