From aa8f0820318762a393c41623cba3a5795225fb0a Mon Sep 17 00:00:00 2001 From: Henning Westerholt Date: Thu, 5 Sep 2019 19:21:27 +0200 Subject: [PATCH] pv: fix $Au pseudo-variable, it contains incorrectly domain or realm (GH #2056) --- src/modules/pv/pv_core.c | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c index c554ed0cde2..6b9124e4ba3 100644 --- a/src/modules/pv/pv_core.c +++ b/src/modules/pv/pv_core.c @@ -1575,29 +1575,13 @@ static inline str *cred_realm(struct sip_msg *rq) int pv_get_acc_username(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) { - static char buf[MAX_URI_SIZE]; str* user; - str* realm; struct sip_uri puri; struct to_body* from; - str s; /* try to take it from credentials */ user = cred_user(msg); if (user) { - realm = cred_realm(msg); - if (realm) { - s.len = user->len+1+realm->len; - if (s.len > MAX_URI_SIZE) { - LM_ERR("uri too long\n"); - return pv_get_null(msg, param, res); - } - s.s = buf; - memcpy(s.s, user->s, user->len); - (s.s)[user->len] = '@'; - memcpy(s.s+user->len+1, realm->s, realm->len); - return pv_get_strval(msg, param, res, &s); - } return pv_get_strval(msg, param, res, user); } @@ -1612,20 +1596,9 @@ int pv_get_acc_username(struct sip_msg *msg, pv_param_t *param, LM_ERR("bad From URI\n"); return pv_get_null(msg, param, res); } - s.len = puri.user.len + 1 + puri.host.len; - if (s.len > MAX_URI_SIZE) { - LM_ERR("from URI too long\n"); - return pv_get_null(msg, param, res); - } - s.s = buf; - memcpy(s.s, puri.user.s, puri.user.len); - (s.s)[puri.user.len] = '@'; - memcpy(s.s + puri.user.len + 1, puri.host.s, puri.host.len); - } else { - s.len = 0; - s.s = 0; + return pv_get_strval(msg, param, res, &(puri.user)); } - return pv_get_strval(msg, param, res, &s); + return pv_get_null(msg, param, res); } int pv_get_branch(struct sip_msg *msg, pv_param_t *param,