From b002a5dcde1f14850ddfc620ed5b9d0a7e8e5962 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Mon, 1 May 2023 20:51:10 +0200 Subject: [PATCH] auth_db: exported www_authenticate() to kemi --- src/modules/auth_db/auth_db_mod.c | 5 +++++ src/modules/auth_db/authorize.c | 8 ++++++++ src/modules/auth_db/authorize.h | 1 + 3 files changed, 14 insertions(+) diff --git a/src/modules/auth_db/auth_db_mod.c b/src/modules/auth_db/auth_db_mod.c index 49556cd71de..55bb395a925 100644 --- a/src/modules/auth_db/auth_db_mod.c +++ b/src/modules/auth_db/auth_db_mod.c @@ -452,6 +452,11 @@ static sr_kemi_t sr_kemi_auth_db_exports[] = { { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } }, + { str_init("auth_db"), str_init("www_authenticate"), + SR_KEMIP_INT, ki_www_authenticate, + { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE, + SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } + }, { str_init("auth_db"), str_init("www_authenticate_method"), SR_KEMIP_INT, ki_www_authenticate_method, { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR, diff --git a/src/modules/auth_db/authorize.c b/src/modules/auth_db/authorize.c index 5fd7cce61ad..74a151d4297 100644 --- a/src/modules/auth_db/authorize.c +++ b/src/modules/auth_db/authorize.c @@ -402,6 +402,14 @@ int www_authenticate(struct sip_msg* _m, char* _realm, char* _table) &_m->first_line.u.request.method); } +int ki_www_authenticate(struct sip_msg* _m, str *realm, str *table) +{ + LM_DBG("realm value [%.*s]\n", realm->len, realm->s); + + return digest_authenticate(_m, realm, table, HDR_AUTHORIZATION_T, + &_m->first_line.u.request.method); +} + int www_authenticate2(struct sip_msg* _m, char* _realm, char* _table, char *_method) { str srealm; diff --git a/src/modules/auth_db/authorize.h b/src/modules/auth_db/authorize.h index b67ba7121f9..5653fd452f5 100644 --- a/src/modules/auth_db/authorize.h +++ b/src/modules/auth_db/authorize.h @@ -46,6 +46,7 @@ int proxy_authenticate(struct sip_msg* _msg, char* _realm, char* _table); int www_authenticate(struct sip_msg* _msg, char* _realm, char* _table); int www_authenticate2(struct sip_msg* _msg, char* _realm, char* _table, char *_method); +int ki_www_authenticate(struct sip_msg* _m, str *realm, str *table); int ki_www_authenticate_method(sip_msg_t *msg, str *realm, str *table, str *method); /*