From d2eb65f71e9347c15d469579bbb20c47501d924b Mon Sep 17 00:00:00 2001 From: George Joseph Date: Sun, 6 Mar 2016 13:38:41 -0700 Subject: 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(©, ",") 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 --- res/res_pjsip/pjsip_options.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'res/res_pjsip/pjsip_options.c') diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c index 73f12a00c..aed962030 100644 --- a/res/res_pjsip/pjsip_options.c +++ b/res/res_pjsip/pjsip_options.c @@ -270,7 +270,7 @@ static int on_endpoint(void *obj, void *arg, int flags) } aors = ast_strdupa(endpoint->aors); - while ((aor_name = strsep(&aors, ","))) { + while ((aor_name = ast_strip(strsep(&aors, ",")))) { struct ast_sip_aor *aor; struct ao2_container *contacts; @@ -795,7 +795,7 @@ static int cli_qualify_contacts(void *data) } aors = ast_strdupa(endpoint->aors); - while ((aor_name = strsep(&aors, ","))) { + while ((aor_name = ast_strip(strsep(&aors, ",")))) { struct ast_sip_aor *aor; struct ao2_container *contacts; @@ -899,7 +899,7 @@ static int ami_sip_qualify(struct mansession *s, const struct message *m) } aors = ast_strdupa(endpoint->aors); - while ((aor_name = strsep(&aors, ","))) { + while ((aor_name = ast_strip(strsep(&aors, ",")))) { struct ast_sip_aor *aor; struct ao2_container *contacts; @@ -1087,7 +1087,7 @@ static int qualify_and_schedule_all_cb(void *obj, void *arg, int flags) } aors = ast_strdupa(endpoint->aors); - while ((aor_name = strsep(&aors, ","))) { + while ((aor_name = ast_strip(strsep(&aors, ",")))) { struct ast_sip_aor *aor; struct ao2_container *contacts; -- cgit v1.2.3