1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

HTTP DIGEST AUTH: fix wrong sizeof(), patch by Vitaly Lavrov (added to

AUTHORS). Close bug 769.
This commit is contained in:
Laurent MONIN 2006-07-05 15:07:48 +02:00 committed by Laurent MONIN
parent 2f82a708db
commit c2ca89cab1
2 changed files with 9 additions and 6 deletions

View File

@ -556,6 +556,9 @@ Unai Uribarri <unai@telecable.es>
Varga Balázs <vinnui@ent.hu>
Hungarian translation updates
Vitaly Lavrov <lve@guap.ru>
Fix for http digest authentification
Wiktor Grebla <greblus@poczta.onet.pl>
Keybinding for toggling of document.browse.links.numbering

View File

@ -23,7 +23,7 @@ convert_to_md5_digest_hex_T(md5_digest_bin_T bin, md5_digest_hex_T hex)
{
int i;
for (i = 0; i < sizeof(bin); i++) {
for (i = 0; i < sizeof(md5_digest_bin_T); i++) {
int j = i * 2;
hex[j] = hx(bin[i] >> 4 & 0xF);
@ -108,18 +108,18 @@ init_response_digest(md5_digest_hex_T response, struct auth_entry *entry,
init_uri_method_digest(Ha2_hex, uri);
MD5_Init(&MD5Ctx);
MD5_Update(&MD5Ctx, ha1, sizeof(ha1));
MD5_Update(&MD5Ctx, ha1, sizeof(md5_digest_hex_T));
MD5_Update(&MD5Ctx, ":", 1);
if (entry->nonce)
MD5_Update(&MD5Ctx, entry->nonce, strlen(entry->nonce));
MD5_Update(&MD5Ctx, ":", 1);
MD5_Update(&MD5Ctx, "00000001", 8);
MD5_Update(&MD5Ctx, ":", 1);
MD5_Update(&MD5Ctx, cnonce, sizeof(cnonce));
MD5_Update(&MD5Ctx, cnonce, sizeof(md5_digest_hex_T));
MD5_Update(&MD5Ctx, ":", 1);
MD5_Update(&MD5Ctx, "auth", 4);
MD5_Update(&MD5Ctx, ":", 1);
MD5_Update(&MD5Ctx, Ha2_hex, sizeof(Ha2_hex));
MD5_Update(&MD5Ctx, Ha2_hex, sizeof(md5_digest_hex_T));
MD5_Final(Ha2, &MD5Ctx);
convert_to_md5_digest_hex_T(Ha2, response);
@ -155,10 +155,10 @@ get_http_auth_digest_response(struct auth_entry *entry, struct uri *uri)
add_to_string(&string, "\", ");
add_to_string(&string, "qop=auth, nc=00000001, ");
add_to_string(&string, "cnonce=\"");
add_bytes_to_string(&string, cnonce, sizeof(cnonce));
add_bytes_to_string(&string, cnonce, sizeof(md5_digest_hex_T));
add_to_string(&string, "\", ");
add_to_string(&string, "response=\"");
add_bytes_to_string(&string, response, sizeof(response));
add_bytes_to_string(&string, response, sizeof(md5_digest_hex_T));
add_to_string(&string, "\"");
if (entry->opaque) {