[asterisk-bugs] [JIRA] (ASTERISK-16871) [regression] ast_md5_hash sometimes create incorrect md5 digest
Matt Jordan (JIRA)
noreply at issues.asterisk.org
Fri Mar 27 16:26:34 CDT 2015
[ https://issues.asterisk.org/jira/browse/ASTERISK-16871?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matt Jordan updated ASTERISK-16871:
-----------------------------------
Description:
ast_md5_hash sometimes create incorrect md5 digest. on arm(DockStar) device
make & install asterisk 1.8.0 on my DockStar. my ata can not register or make calls sometimes.
add log in channels/chan_sip.c @ check_auth()
like below code
function ast_md5_hash can not get correct md5 digest almost all the time(sometimes it is correct) .
it's different as echo -n "<user>:<realm>:<secret>" | md5sum
while in 1.6.2.10, it's always correct.
{code}
if (!ast_strlen_zero(md5secret)) {
ast_copy_string(a1_hash, md5secret, sizeof(a1_hash));
ast_log(LOG_NOTICE, "result is correct hash is has md5secret original:%s",a1_hash);
} else {
char a1[256];
snprintf(a1, sizeof(a1), "%s:%s:%s", username, p->realm, secret);
ast_log(LOG_NOTICE, "result is correct hash is a1 original:%s",a1);
ast_md5_hash(a1_hash, a1);
ast_log(LOG_NOTICE, "result is correct hash is a1 hashed:%s",a1_hash);
}
/* compute the expected response to compare with what we received */
{
char a2[256];
char a2_hash[256];
char resp[256];
snprintf(a2, sizeof(a2), "%s:%s", sip_methods[sipmethod].text,
S_OR(keys[K_URI].s, uri));
ast_log(LOG_NOTICE, "result is correct hash is a2 original:%s",a2);
ast_md5_hash(a2_hash, a2);
ast_log(LOG_NOTICE, "result is correct hash is a2 hash:%s",a2_hash);
snprintf(resp, sizeof(resp), "%s:%s:%s", a1_hash, usednonce, a2_hash);
ast_log(LOG_NOTICE, "result is correct hash original is :%s",resp);
ast_md5_hash(resp_hash, resp);
ast_log(LOG_NOTICE, "result is correct hash is:%s",resp_hash);
}
{code}
was:
ast_md5_hash sometimes create incorrect md5 digest. on arm(DockStar) device
make & install asterisk 1.8.0 on my DockStar. my ata can not register or make calls sometimes.
add log in channels/chan_sip.c @ check_auth()
like below code
function ast_md5_hash can not get correct md5 digest almost all the time(sometimes it is correct) .
it's different as echo -n "<user>:<realm>:<secret>" | md5sum
while in 1.6.2.10, it's always correct.
if (!ast_strlen_zero(md5secret)) {
ast_copy_string(a1_hash, md5secret, sizeof(a1_hash));
ast_log(LOG_NOTICE, "result is correct hash is has md5secret original:%s",a1_hash);
} else {
char a1[256];
snprintf(a1, sizeof(a1), "%s:%s:%s", username, p->realm, secret);
ast_log(LOG_NOTICE, "result is correct hash is a1 original:%s",a1);
ast_md5_hash(a1_hash, a1);
ast_log(LOG_NOTICE, "result is correct hash is a1 hashed:%s",a1_hash);
}
/* compute the expected response to compare with what we received */
{
char a2[256];
char a2_hash[256];
char resp[256];
snprintf(a2, sizeof(a2), "%s:%s", sip_methods[sipmethod].text,
S_OR(keys[K_URI].s, uri));
ast_log(LOG_NOTICE, "result is correct hash is a2 original:%s",a2);
ast_md5_hash(a2_hash, a2);
ast_log(LOG_NOTICE, "result is correct hash is a2 hash:%s",a2_hash);
snprintf(resp, sizeof(resp), "%s:%s:%s", a1_hash, usednonce, a2_hash);
ast_log(LOG_NOTICE, "result is correct hash original is :%s",resp);
ast_md5_hash(resp_hash, resp);
ast_log(LOG_NOTICE, "result is correct hash is:%s",resp_hash);
}
> [regression] ast_md5_hash sometimes create incorrect md5 digest
> ---------------------------------------------------------------
>
> Key: ASTERISK-16871
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-16871
> Project: Asterisk
> Issue Type: Bug
> Components: Functions/func_md5
> Reporter: zhiqiang wang
> Severity: Minor
>
> ast_md5_hash sometimes create incorrect md5 digest. on arm(DockStar) device
> make & install asterisk 1.8.0 on my DockStar. my ata can not register or make calls sometimes.
> add log in channels/chan_sip.c @ check_auth()
> like below code
> function ast_md5_hash can not get correct md5 digest almost all the time(sometimes it is correct) .
> it's different as echo -n "<user>:<realm>:<secret>" | md5sum
> while in 1.6.2.10, it's always correct.
> {code}
> if (!ast_strlen_zero(md5secret)) {
> ast_copy_string(a1_hash, md5secret, sizeof(a1_hash));
> ast_log(LOG_NOTICE, "result is correct hash is has md5secret original:%s",a1_hash);
> } else {
> char a1[256];
> snprintf(a1, sizeof(a1), "%s:%s:%s", username, p->realm, secret);
> ast_log(LOG_NOTICE, "result is correct hash is a1 original:%s",a1);
> ast_md5_hash(a1_hash, a1);
> ast_log(LOG_NOTICE, "result is correct hash is a1 hashed:%s",a1_hash);
> }
> /* compute the expected response to compare with what we received */
> {
> char a2[256];
> char a2_hash[256];
> char resp[256];
> snprintf(a2, sizeof(a2), "%s:%s", sip_methods[sipmethod].text,
> S_OR(keys[K_URI].s, uri));
> ast_log(LOG_NOTICE, "result is correct hash is a2 original:%s",a2);
> ast_md5_hash(a2_hash, a2);
> ast_log(LOG_NOTICE, "result is correct hash is a2 hash:%s",a2_hash);
> snprintf(resp, sizeof(resp), "%s:%s:%s", a1_hash, usednonce, a2_hash);
> ast_log(LOG_NOTICE, "result is correct hash original is :%s",resp);
> ast_md5_hash(resp_hash, resp);
> ast_log(LOG_NOTICE, "result is correct hash is:%s",resp_hash);
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list