summaryrefslogtreecommitdiff
path: root/res/res_pjsip/pjsip_configuration.c
diff options
context:
space:
mode:
authorGeorge Joseph <george.joseph@fairview5.com>2016-03-06 13:38:41 -0700
committerGeorge Joseph <george.joseph@fairview5.com>2016-03-07 12:15:58 -0700
commit530cff5f5f3be4d2f53e84a656f10f2f43638d1c (patch)
tree8c61022785505b44dc0e9a7c9af3adbce66b39cd /res/res_pjsip/pjsip_configuration.c
parent6e58f83d8d68045574bcb432c74f38183a559bab (diff)
res_pjsip: Strip spaces from items parsed from comma-separated lists
Configurations like "aors = a, b, c" were either ignoring everything after "a" or trying to look up " b". Same for mailboxes, ciphers, contacts and a few others. To fix, all the strsep(&copy, ",") calls have been wrapped in ast_strip. To facilitate this, ast_strip, ast_skip_blanks and ast_skip_nonblanks were updated to handle null pointers. In some cases, an ast_strlen_zero() test was added to skip consecutive commas. There was also an attempt to ast_free an ast_strdupa'd string in ast_sip_for_each_aor which was causing a SEGV. I removed it. Although this issue was reported for realtime, the issue was in the res_pjsip modules so all config mechanisms were affected. ASTERISK-25829 #close Reported-by: Mateusz Kowalski Change-Id: I0b22a2cf22a7c1c50d4ecacbfa540155bec0e7a2
Diffstat (limited to 'res/res_pjsip/pjsip_configuration.c')
-rw-r--r--res/res_pjsip/pjsip_configuration.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index 1eed9284b..ebd621261 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -413,7 +413,7 @@ int ast_sip_auth_vector_init(struct ast_sip_auth_vector *auths, const char *valu
return -1;
}
- while ((val = strsep(&auth_names, ","))) {
+ while ((val = ast_strip(strsep(&auth_names, ",")))) {
if (ast_strlen_zero(val)) {
continue;
}
@@ -480,7 +480,11 @@ static int ident_handler(const struct aco_option *opt, struct ast_variable *var,
char *idents = ast_strdupa(var->value);
char *val;
- while ((val = strsep(&idents, ","))) {
+ while ((val = ast_strip(strsep(&idents, ",")))) {
+ if (ast_strlen_zero(val)) {
+ continue;
+ }
+
if (!strcasecmp(val, "username")) {
endpoint->ident_method |= AST_SIP_ENDPOINT_IDENTIFY_BY_USERNAME;
} else {