diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2013-12-08 02:22:12 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2013-12-08 02:22:12 +0100 |
commit | c940e986302d16d6e09d61c908d45730b3873766 (patch) | |
tree | db9bb3d842efea1e9a99d51a47649c66262b3952 /sys/src/cmd/ip | |
parent | d7f90a909637fcf12f564fa65b53a1416bef1f6c (diff) |
experimental ntlmv2 server authenticaion support for cifsd
extending factotums and the auth servers mschap implementation
to handle variable length NT response for NTLMv2.
fix some minor bugs.
only tested with cifs so far.
Diffstat (limited to 'sys/src/cmd/ip')
-rw-r--r-- | sys/src/cmd/ip/cifsd/smb.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/src/cmd/ip/cifsd/smb.c b/sys/src/cmd/ip/cifsd/smb.c index 145266a42..9e6f9cf3c 100644 --- a/sys/src/cmd/ip/cifsd/smb.c +++ b/sys/src/cmd/ip/cifsd/smb.c @@ -99,22 +99,25 @@ smbsessionsetupandx(Req *r, uchar *h, uchar *p, uchar *e) logit("ignoring bad session key"); while(!remoteuser){ if(needauth){ - MSchapreply mcr; + MSchapreply *mcr; if(smbcs == nil || strlen(user) == 0) break; - memset(&mcr, 0, sizeof(mcr)); - if((lme - lm) == sizeof(mcr.LMresp)) - memmove(mcr.LMresp, lm, lme - lm); - if((nte - nt) == sizeof(mcr.NTresp)) - memmove(mcr.NTresp, nt, nte - nt); smbcs->user = user; - smbcs->resp = &mcr; - smbcs->nresp = sizeof(mcr); + smbcs->nresp = (nte - nt)+sizeof(*mcr)-sizeof(mcr->NTresp); + if(smbcs->nresp < sizeof(*mcr)) + smbcs->nresp = sizeof(*mcr); + smbcs->resp = mallocz(smbcs->nresp, 1); + mcr = (MSchapreply*)smbcs->resp; + if((lme - lm) <= sizeof(mcr->LMresp)) + memmove(mcr->LMresp, lm, lme - lm); + if((nte - nt) > 0) + memmove(mcr->NTresp, nt, nte - nt); if((ai = auth_response(smbcs)) == nil) logit("auth_response: %r"); auth_freechal(smbcs); smbcs = nil; + free(mcr); if(ai == nil) break; if(auth_chuid(ai, nil) < 0) |