Module: kamailio
Branch: 5.8
Commit: beb7946a5ea18ba6c7cf8e3808c1eb8d06b4d361
URL: 
https://github.com/kamailio/kamailio/commit/beb7946a5ea18ba6c7cf8e3808c1eb8d06b4d361

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2025-12-01T13:47:45+01:00

auth_db: init variable and set the result header later

(cherry picked from commit c2e62cd2dfb0c9969f7e410020fa3a39f343d608)
(cherry picked from commit de337ed3c2ff50bf095b7179968fe7e73d83b62e)

---

Modified: src/modules/auth_db/authorize.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/beb7946a5ea18ba6c7cf8e3808c1eb8d06b4d361.diff
Patch: 
https://github.com/kamailio/kamailio/commit/beb7946a5ea18ba6c7cf8e3808c1eb8d06b4d361.patch

---

diff --git a/src/modules/auth_db/authorize.c b/src/modules/auth_db/authorize.c
index f0de2299ac1..79d2b6bfe11 100644
--- a/src/modules/auth_db/authorize.c
+++ b/src/modules/auth_db/authorize.c
@@ -235,7 +235,7 @@ static int digest_authenticate_hdr(sip_msg_t *msg, str 
*realm, str *table,
        char ha1[256];
        auth_cfg_result_t ret;
        auth_result_t rauth;
-       struct hdr_field *h;
+       struct hdr_field *h = NULL;
        auth_body_t *cred;
        db1_res_t *result = NULL;
 
@@ -281,8 +281,6 @@ static int digest_authenticate_hdr(sip_msg_t *msg, str 
*realm, str *table,
        }
 
        cred = (auth_body_t *)h->parsed;
-       if(ahdr != NULL)
-               *ahdr = h;
 
        rauth = get_ha1(&cred->digest.username, realm, table, ha1, &result);
        if(rauth < 0) {
@@ -324,6 +322,9 @@ static int digest_authenticate_hdr(sip_msg_t *msg, str 
*realm, str *table,
        }
 
 end:
+       if(ahdr != NULL) {
+               *ahdr = h;
+       }
        if(result)
                auth_dbf.free_result(auth_db_handle, result);
        return ret;

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to