Module: kamailio
Branch: master
Commit: aa8f0820318762a393c41623cba3a5795225fb0a
URL: 
https://github.com/kamailio/kamailio/commit/aa8f0820318762a393c41623cba3a5795225fb0a

Author: Henning Westerholt <h...@skalatan.de>
Committer: Henning Westerholt <h...@skalatan.de>
Date: 2019-09-05T19:24:01+02:00

pv: fix $Au pseudo-variable, it contains incorrectly domain or realm (GH #2056)

---

Modified: src/modules/pv/pv_core.c

---

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

---

diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c
index c554ed0cde..6b9124e4ba 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,


_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to