Module: kamailio
Branch: master
Commit: b6e264c9780fc0432e6e746f473024e41bc1126b
URL:
https://github.com/kamailio/kamailio/commit/b6e264c9780fc0432e6e746f473024e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-12-22T08:37:40+01:00
uac: exposed internal flags for $uac_req(key) variable
- if set to 1, the password is considered to be HA1 value
- GH #2982
---
Modified: src/modules/uac/uac_send.c
---
Diff:
https://github.com/kamailio/kamailio/commit/b6e264c9780fc0432e6e746f473024e…
Patch:
https://github.com/kamailio/kamailio/commit/b6e264c9780fc0432e6e746f473024e…
---
diff --git a/src/modules/uac/uac_send.c b/src/modules/uac/uac_send.c
index d906a1c27f..e5ea420d72 100644
--- a/src/modules/uac/uac_send.c
+++ b/src/modules/uac/uac_send.c
@@ -43,6 +43,8 @@
#include "uac_send.h"
#include "uac_reg.h"
+#define UAC_SEND_FL_HA1 (1<<0)
+
#define MAX_UACH_SIZE 2048
#define MAX_UACB_SIZE 32768
#define MAX_UACD_SIZE 128
@@ -492,6 +494,19 @@ int pv_set_uac_req(struct sip_msg* msg, pv_param_t *param,
}
_uac_req.evtype = tval->ri;
break;
+ case 17:
+ if(tval==NULL)
+ {
+ _uac_req.flags = 0;
+ return 0;
+ }
+ if(!(tval->flags&PV_VAL_INT))
+ {
+ LM_ERR("Invalid value type\n");
+ return -1;
+ }
+ _uac_req.flags = tval->ri;
+ break;
}
return 0;
}
@@ -528,6 +543,8 @@ int pv_parse_uac_req_name(pv_spec_p sp, str *in)
case 5:
if(strncmp(in->s, "auser", 5)==0)
sp->pvp.pvn.u.isname.name.n = 9;
+ else if(strncmp(in->s, "flags", 5)==0)
+ sp->pvp.pvn.u.isname.name.n = 17;
else goto error;
break;
case 6:
@@ -721,8 +738,8 @@ void uac_send_tm_callback(struct cell *t, int type, struct tmcb_params
*ps)
struct hdr_field *hdr;
HASHHEX response;
str *new_auth_hdr = NULL;
- static struct authenticate_body auth;
- struct uac_credential cred;
+ static authenticate_body_t auth;
+ uac_credential_t cred;
char b_hdrs[MAX_UACH_SIZE];
str s_hdrs;
uac_req_t uac_r;
@@ -771,6 +788,9 @@ void uac_send_tm_callback(struct cell *t, int type, struct tmcb_params
*ps)
cred.realm = auth.realm;
cred.user = tp->s_auser;
cred.passwd = tp->s_apasswd;
+ if(tp->flags & UAC_SEND_FL_HA1) {
+ cred.aflags = UAC_FLCRED_HA1;
+ }
do_uac_auth(&tp->s_method, &tp->s_ruri, &cred, &auth, response);
new_auth_hdr=build_authorization_hdr(ps->code, &tp->s_ruri, &cred,