mirror of
https://github.com/moparisthebest/curl
synced 2025-03-11 07:39:50 -04:00
Dan Winship's patch added that makes use of DOMAIN\USER or DOMAIN/USER
for the user field. I changed it slightly to stay with strchr() only instead of strpbrk() for portability reasons.
This commit is contained in:
parent
938f1d1da7
commit
b036986b3e
@ -376,19 +376,27 @@ CURLcode Curl_output_ntlm(struct connectdata *conn)
|
|||||||
#ifdef USE_NTRESPONSES
|
#ifdef USE_NTRESPONSES
|
||||||
unsigned char ntresp[0x18]; /* fixed-size */
|
unsigned char ntresp[0x18]; /* fixed-size */
|
||||||
#endif
|
#endif
|
||||||
int userlen = strlen(data->state.user);
|
const char *user;
|
||||||
|
int userlen;
|
||||||
|
|
||||||
|
user = strchr(data->state.user, '\\');
|
||||||
|
if(!user)
|
||||||
|
user = strchr(data->state.user, '/');
|
||||||
|
|
||||||
|
if (user) {
|
||||||
|
domain = data->state.user;
|
||||||
|
domlen = user - domain;
|
||||||
|
user++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
user = data->state.user;
|
||||||
|
userlen = strlen(user);
|
||||||
|
|
||||||
mkhash(data->state.passwd, &data->state.ntlm.nonce[0], lmresp
|
mkhash(data->state.passwd, &data->state.ntlm.nonce[0], lmresp
|
||||||
#ifdef USE_NTRESPONSES
|
#ifdef USE_NTRESPONSES
|
||||||
, ntresp
|
, ntresp
|
||||||
#endif
|
#endif
|
||||||
|
);
|
||||||
);
|
|
||||||
|
|
||||||
/* these are going unicode */
|
|
||||||
domlen *= 2;
|
|
||||||
userlen *= 2;
|
|
||||||
hostlen *= 2;
|
|
||||||
|
|
||||||
domoff = 64; /* always */
|
domoff = 64; /* always */
|
||||||
useroff = domoff + domlen;
|
useroff = domoff + domlen;
|
||||||
@ -478,7 +486,10 @@ CURLcode Curl_output_ntlm(struct connectdata *conn)
|
|||||||
size=64;
|
size=64;
|
||||||
ntlm[62]=ntlm[63]=0;
|
ntlm[62]=ntlm[63]=0;
|
||||||
|
|
||||||
memcpy(&ntlm[size], data->state.user, userlen);
|
memcpy(&ntlm[size], domain, domlen);
|
||||||
|
size += domlen;
|
||||||
|
|
||||||
|
memcpy(&ntlm[size], user, userlen);
|
||||||
size += userlen;
|
size += userlen;
|
||||||
|
|
||||||
/* we append the binary hashes to the end of the blob */
|
/* we append the binary hashes to the end of the blob */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user