Module: sip-router Branch: master Commit: ef56e6bc119e982dc305bfa4b7508ca9226a1287 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ef56e6bc...
Author: Andrei Pelinescu-Onciul andrei@iptel.org Committer: Andrei Pelinescu-Onciul andrei@iptel.org Date: Wed Aug 25 18:59:21 2010 +0200
lcr: fix load_gws() 2nd param
load_gws() 2nd optional parameter was treated like a fparam instead of a pv_spec_t (the fixup_igp_pvar function converts the first parameter to a fparam and the second one to a pv_spec).
---
modules/lcr/lcr_mod.c | 27 ++++++++++++++++----------- 1 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/modules/lcr/lcr_mod.c b/modules/lcr/lcr_mod.c index e3603cb..3d74975 100644 --- a/modules/lcr/lcr_mod.c +++ b/modules/lcr/lcr_mod.c @@ -1649,7 +1649,8 @@ void add_gws_into_avps(struct gw_info *gws, struct matched_gw_info *matched_gws, /* * Load info of matching GWs into gw_uri_avps */ -static int load_gws(struct sip_msg* _m, fparam_t *_lcr_id, fparam_t *_from_uri) +static int load_gws(struct sip_msg* _m, fparam_t *_lcr_id, + pv_spec_t* _from_uri) { str ruri_user, from_uri; int i, j, lcr_id; @@ -1659,6 +1660,7 @@ static int load_gws(struct sip_msg* _m, fparam_t *_lcr_id, fparam_t *_from_uri) struct rule_info **rules, *rule, *pl; struct gw_info *gws; struct target *t; + pv_value_t pv_val;
/* Get and check parameter values */ if (get_int_fparam(&lcr_id, _m, _lcr_id) != 0) { @@ -1670,14 +1672,17 @@ static int load_gws(struct sip_msg* _m, fparam_t *_lcr_id, fparam_t *_from_uri) return -1; } if (_from_uri) { - if (get_str_fparam(&from_uri, _m, _from_uri) != 0) { - LM_ERR("no from_uri parameter value\n"); - return -1; - } - if (from_uri.len == 0) { - LM_ERR("empty from_uri parameter value\n"); - return -1; - } + if (pv_get_spec_value(_m, _from_uri, &pv_val) == 0) { + if (pv_val.flags & PV_VAL_STR) + from_uri = pv_val.rs; + else { + LM_ERR("non string from_uri parameter value\n"); + return -1; + } + } else { + LM_ERR("could not get from_uri pvar value\n"); + return -1; + } } else { from_uri.len = 0; from_uri.s = (char *)0; @@ -1787,13 +1792,13 @@ static int load_gws(struct sip_msg* _m, fparam_t *_lcr_id, fparam_t *_from_uri)
static int load_gws_1(struct sip_msg* _m, char *_lcr_id, char *_s2) { - return load_gws(_m, (fparam_t *)_lcr_id, (fparam_t *)0); + return load_gws(_m, (fparam_t *)_lcr_id, 0); }
static int load_gws_2(struct sip_msg* _m, char *_lcr_id, char *_from_uri) { - return load_gws(_m, (fparam_t *)_lcr_id, (fparam_t *)_from_uri); + return load_gws(_m, (fparam_t *)_lcr_id, (pv_spec_t *)_from_uri); }