X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=cproxy.c;h=4f9a3ffa591c8b00833d0f6b24c69f83ca64ec06;hb=510f49e405e71ba5c97875e7a019364e1ef5fac9;hp=bf5eed5de4739b1493907a90daac058dc72a98d9;hpb=eb4bb72cc6017a20f2dd2242cf03208ab011f564;p=PuTTY.git diff --git a/cproxy.c b/cproxy.c index bf5eed5d..4f9a3ffa 100644 --- a/cproxy.c +++ b/cproxy.c @@ -21,7 +21,7 @@ static void hmacmd5_chap(const unsigned char *challenge, int challen, void *hmacmd5_ctx; int pwlen; - hmacmd5_ctx = hmacmd5_make_context(); + hmacmd5_ctx = hmacmd5_make_context(NULL); pwlen = strlen(passwd); if (pwlen>64) { @@ -130,7 +130,8 @@ int proxy_socks5_handlechap (Proxy_Socket p) outbuf[2] = 0x04; /* Response */ outbuf[3] = 0x10; /* Length */ hmacmd5_chap(data, p->chap_current_datalen, - p->cfg.proxy_password, &outbuf[4]); + conf_get_str(p->conf, CONF_proxy_password), + &outbuf[4]); sk_write(p->sub_socket, (char *)outbuf, 20); break; case 0x11: @@ -159,7 +160,9 @@ int proxy_socks5_handlechap (Proxy_Socket p) int proxy_socks5_selectchap(Proxy_Socket p) { - if (p->cfg.proxy_username[0] || p->cfg.proxy_password[0]) { + char *username = conf_get_str(p->conf, CONF_proxy_username); + char *password = conf_get_str(p->conf, CONF_proxy_password); + if (username[0] || password[0]) { char chapbuf[514]; int ulen; chapbuf[0] = '\x01'; /* Version */ @@ -169,11 +172,12 @@ int proxy_socks5_selectchap(Proxy_Socket p) chapbuf[4] = '\x85'; /* ...and it's HMAC-MD5, the core one */ chapbuf[5] = '\x02'; /* Second attribute - username */ - ulen = strlen(p->cfg.proxy_username); - if (ulen > 255) ulen = 255; if (ulen < 1) ulen = 1; + ulen = strlen(username); + if (ulen > 255) ulen = 255; + if (ulen < 1) ulen = 1; chapbuf[6] = ulen; - memcpy(chapbuf+7, p->cfg.proxy_username, ulen); + memcpy(chapbuf+7, username, ulen); sk_write(p->sub_socket, chapbuf, ulen + 7); p->chap_num_attributes = 0;