Module: sip-router
Branch: master
Commit: a3db4686f286e4f04a416b84423d355d2ad69056
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a3db468…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Sun Apr 29 15:30:28 2012 +0200
registrar(k): realm prefix initialized to NULL instead of empty string
- it refers inside a cfg structure and might be the reason for sigbus on
solaris/sparc
- anyhow, it avoids an strlen() over empty string, behaviour being the
same as before
---
modules_k/registrar/common.c | 4 ++--
modules_k/registrar/config.c | 4 ++--
modules_k/registrar/config.h | 2 +-
modules_k/registrar/reg_mod.c | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/modules_k/registrar/common.c b/modules_k/registrar/common.c
index 9d878f2..3cd235f 100644
--- a/modules_k/registrar/common.c
+++ b/modules_k/registrar/common.c
@@ -93,8 +93,8 @@ int extract_aor(str* _uri, str* _a, sip_uri_t *_pu)
if (user_len)
aor_buf[_a->len++] = '@';
/* strip prefix (if defined) */
- realm_prefix.s = cfg_get(registrar, registrar_cfg, realm_pref);
- realm_prefix.len = strlen(realm_prefix.s);
+ realm_prefix.s = cfg_get(registrar, registrar_cfg, realm_pref).s;
+ realm_prefix.len = cfg_get(registrar, registrar_cfg, realm_pref).len;
if (realm_prefix.len && realm_prefix.len<puri->host.len &&
(memcmp(realm_prefix.s, puri->host.s, realm_prefix.len)==0) ) {
memcpy(aor_buf + _a->len, puri->host.s + realm_prefix.len,
diff --git a/modules_k/registrar/config.c b/modules_k/registrar/config.c
index f187c1a..038a68c 100644
--- a/modules_k/registrar/config.c
+++ b/modules_k/registrar/config.c
@@ -40,7 +40,7 @@ struct cfg_group_registrar default_registrar_cfg = {
0, /* case_sensitive */
Q_UNSPECIFIED, /* default_q */
1, /* append_branches */
- "" /* realm_pref */
+ STR_NULL /* realm_pref */
};
void *registrar_cfg = &default_registrar_cfg;
@@ -64,7 +64,7 @@ cfg_def_t registrar_cfg_def[] = {
"The parameter represents default q value for new contacts."}, /*
Q_UNSPECIFIED is -1 */
{"append_branches", CFG_VAR_INT , 0, 0, 0, 0,
"If set to 1(default), lookup will put all contacts found in msg
structure"},
- {"realm_pref", CFG_VAR_STRING , 0, 0, 0, 0,
+ {"realm_pref", CFG_VAR_STR, 0, 0, 0, 0,
"Realm prefix to be removed. Default is \"\""},
{0, 0, 0, 0, 0, 0}
};
diff --git a/modules_k/registrar/config.h b/modules_k/registrar/config.h
index 06b1390..f2708d6 100644
--- a/modules_k/registrar/config.h
+++ b/modules_k/registrar/config.h
@@ -36,7 +36,7 @@ struct cfg_group_registrar {
unsigned int case_sensitive;
qvalue_t default_q;
unsigned int append_branches;
- char* realm_pref;
+ str realm_pref;
};
extern struct cfg_group_registrar default_registrar_cfg;
diff --git a/modules_k/registrar/reg_mod.c b/modules_k/registrar/reg_mod.c
index de3870a..a38b00a 100644
--- a/modules_k/registrar/reg_mod.c
+++ b/modules_k/registrar/reg_mod.c
@@ -202,7 +202,7 @@ static param_export_t params[] = {
{"append_branches", INT_PARAM,
&default_registrar_cfg.append_branches },
{"case_sensitive", INT_PARAM,
&default_registrar_cfg.case_sensitive },
/* {"tcp_persistent_flag",INT_PARAM, &tcp_persistent_flag }, */
- {"realm_prefix", STR_PARAM, &default_registrar_cfg.realm_pref
},
+ {"realm_prefix", PARAM_STR, &default_registrar_cfg.realm_pref
},
{"min_expires", INT_PARAM, &default_registrar_cfg.min_expires },
{"max_expires", INT_PARAM, &default_registrar_cfg.max_expires },
{"received_param", STR_PARAM, &rcv_param },