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

Author: Henning Westerholt <[email protected]>
Committer: Henning Westerholt <[email protected]>
Date: 2019-09-05T21:31:16+02:00

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

This reverts commit aa8f0820318762a393c41623cba3a5795225fb0a.

---

Modified: src/modules/pv/pv_core.c

---

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

---

diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c
index 6b9124e4ba..c554ed0cde 100644
--- a/src/modules/pv/pv_core.c
+++ b/src/modules/pv/pv_core.c
@@ -1575,13 +1575,29 @@ 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);
        }
 
@@ -1596,9 +1612,20 @@ 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);
                }
-               return pv_get_strval(msg, param, res, &(puri.user));
+               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_null(msg, param, res);
+       return pv_get_strval(msg, param, res, &s);
 }
 
 int pv_get_branch(struct sip_msg *msg, pv_param_t *param,


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

Reply via email to