Module: kamailio Branch: master Commit: c6f4adf80356d9fa6aa14968ef564570329e584e URL: https://github.com/kamailio/kamailio/commit/c6f4adf80356d9fa6aa14968ef564570...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: GitHub noreply@github.com Date: 2016-07-19T22:06:05+02:00
Merge pull request #711 from athonet-open/fix_log_imsauth
ims_auth: print ck in readable form and init var to 0 to avoid printing gibberish in the log
---
Modified: modules/ims_auth/authorize.c
---
Diff: https://github.com/kamailio/kamailio/commit/c6f4adf80356d9fa6aa14968ef564570... Patch: https://github.com/kamailio/kamailio/commit/c6f4adf80356d9fa6aa14968ef564570...
---
diff --git a/modules/ims_auth/authorize.c b/modules/ims_auth/authorize.c index 595132f..8343de4 100644 --- a/modules/ims_auth/authorize.c +++ b/modules/ims_auth/authorize.c @@ -727,7 +727,7 @@ int authenticate(struct sip_msg* msg, char* _realm, char* str2, int is_proxy_aut str nonce, response16, nc, cnonce, qop_str = {0, 0}, auts = {0, 0}, body, *next_nonce = &empty_s; enum qop_type qop = QOP_UNSPEC; str uri = {0, 0}; - HASHHEX expected, ha1, hbody, rspauth; + HASHHEX expected, ha1, hbody = {0}, rspauth; int expected_len = 32; int expires = 0; auth_vector *av = 0; @@ -1152,6 +1152,8 @@ void auth_data_destroy() { auth_vector * new_auth_vector(int item_number, str auth_scheme, str authenticate, str authorization, str ck, str ik) { auth_vector *x = 0; + char base16_ck[32+1] = {0}; + int base16_ck_len = 0; x = shm_malloc(sizeof (auth_vector)); if (!x) { LM_ERR("error allocating mem\n"); @@ -1305,7 +1307,9 @@ auth_vector * new_auth_vector(int item_number, str auth_scheme, str authenticate x->status = AUTH_VECTOR_UNUSED; x->expires = 0;
- LM_DBG("new auth-vector with ck [%.*s] with status %d\n", x->ck.len, x->ck.s, x->status); + base16_ck_len = bin_to_base16(x->ck.s, 16, base16_ck); + if (base16_ck_len) + LM_DBG("new auth-vector with ck [%s] with status %d\n", base16_ck, x->status);
done: return x;