return -1;
}
- while ((aor_name = strsep(&rest, ","))) {
+ while ((aor_name = ast_strip(strsep(&rest, ",")))) {
RAII_VAR(struct ast_sip_aor *, aor, ast_sip_location_retrieve_aor(aor_name), ao2_cleanup);
RAII_VAR(struct ao2_container *, contacts, NULL, ao2_cleanup);
struct ao2_iterator it_contacts;
AST_INLINE_API(
char * attribute_pure ast_skip_blanks(const char *str),
{
- while (*str && ((unsigned char) *str) < 33)
- str++;
+ if (str) {
+ while (*str && ((unsigned char) *str) < 33) {
+ str++;
+ }
+ }
+
return (char *) str;
}
)
AST_INLINE_API(
char * attribute_pure ast_skip_nonblanks(const char *str),
{
- while (*str && ((unsigned char) *str) > 32)
- str++;
+ if (str) {
+ while (*str && ((unsigned char) *str) > 32) {
+ str++;
+ }
+ }
+
return (char *) str;
}
)
}
parse = ast_strdupa(S_OR(var->value, ""));
- while ((name = strsep(&parse, ","))) {
- name = ast_strip(name);
+ while ((name = ast_strip(strsep(&parse, ",")))) {
if (ast_strlen_zero(name)) {
continue;
}
*aor = NULL;
*contact = NULL;
- while ((aor_name = strsep(&rest, ","))) {
+ while ((aor_name = ast_strip(strsep(&rest, ",")))) {
*aor = ast_sip_location_retrieve_aor(aor_name);
if (!(*aor)) {
}
contacts = ast_strdupa(var->value);
- while ((contact_uri = strsep(&contacts, ","))) {
+ while ((contact_uri = ast_strip(strsep(&contacts, ",")))) {
struct ast_sip_contact *contact;
struct ast_sip_contact_status *status;
char hash[33];
char contact_id[strlen(aor_id) + sizeof(hash) + 2];
+ if (ast_strlen_zero(contact_uri)) {
+ continue;
+ }
+
if (!aor->permanent_contacts) {
aor->permanent_contacts = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_NOLOCK,
AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT, permanent_uri_sort_fn, NULL);
}
copy = ast_strdupa(aors);
- while ((name = strsep(©, ","))) {
+ while ((name = ast_strip(strsep(©, ",")))) {
RAII_VAR(struct ast_sip_aor *, aor,
ast_sip_location_retrieve_aor(name), ao2_cleanup);
return -1;
}
}
- ast_free(copy);
return 0;
}
return -1;
}
- while ((val = strsep(&auth_names, ","))) {
+ while ((val = ast_strip(strsep(&auth_names, ",")))) {
if (ast_strlen_zero(val)) {
continue;
}
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 {
}
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;
}
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;
}
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;
}
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;
return 0;
}
- while ((current_string = strsep(&input_string, ","))) {
+ while ((current_string = ast_strip(strsep(&input_string, ",")))) {
struct ast_sockaddr *addrs;
int num_addrs = 0, error = 0, i;
char *mask = strrchr(current_string, '/');
+ if (ast_strlen_zero(current_string)) {
+ continue;
+ }
+
if (mask) {
identify->matches = ast_append_ha("d", current_string, identify->matches, &error);
ast_debug(5, "Sending unsolicited MWI NOTIFY to endpoint %s, new messages: %d, old messages: %d\n",
sub->id, counter->new_msgs, counter->old_msgs);
- while ((aor_name = strsep(&endpoint_aors, ","))) {
+ while ((aor_name = ast_strip(strsep(&endpoint_aors, ",")))) {
RAII_VAR(struct ast_sip_aor *, aor, ast_sip_location_retrieve_aor(aor_name), ao2_cleanup);
RAII_VAR(struct ao2_container *, contacts, NULL, ao2_cleanup);
struct unsolicited_mwi_data mwi_data = {
}
mailboxes = ast_strdupa(aor->mailboxes);
- while ((mailbox = strsep(&mailboxes, ","))) {
+ while ((mailbox = ast_strip(strsep(&mailboxes, ",")))) {
+ if (ast_strlen_zero(mailbox)) {
+ continue;
+ }
+
if (endpoint_receives_unsolicited_mwi_for_mailbox(endpoint, mailbox)) {
ast_debug(1, "Endpoint '%s' already configured for unsolicited MWI for mailbox '%s'. "
"Denying MWI subscription to %s\n", ast_sorcery_object_get_id(endpoint), mailbox,
}
mailboxes = ast_strdupa(aor->mailboxes);
- while ((mailbox = strsep(&mailboxes, ","))) {
+ while ((mailbox = ast_strip(strsep(&mailboxes, ",")))) {
struct mwi_stasis_subscription *mwi_stasis_sub;
+ if (ast_strlen_zero(mailbox)) {
+ continue;
+ }
+
mwi_stasis_sub = mwi_stasis_subscription_alloc(mailbox, sub);
if (!mwi_stasis_sub) {
continue;
endpoint_aors = ast_strdupa(endpoint->aors);
- while ((aor_name = strsep(&endpoint_aors, ","))) {
+ while ((aor_name = ast_strip(strsep(&endpoint_aors, ",")))) {
RAII_VAR(struct ast_sip_aor *, aor, ast_sip_location_retrieve_aor(aor_name), ao2_cleanup);
if (!aor) {
}
mailboxes = ast_strdupa(endpoint->subscription.mwi.mailboxes);
- while ((mailbox = strsep(&mailboxes, ","))) {
- struct mwi_subscription *sub = aggregate_sub ?:
- mwi_subscription_alloc(endpoint, 0, NULL);
+ while ((mailbox = ast_strip(strsep(&mailboxes, ",")))) {
+ struct mwi_subscription *sub;
struct mwi_stasis_subscription *mwi_stasis_sub;
+ if (ast_strlen_zero(mailbox)) {
+ continue;
+ }
+
+ sub = aggregate_sub ?: mwi_subscription_alloc(endpoint, 0, NULL);
mwi_stasis_sub = mwi_stasis_subscription_alloc(mailbox, sub);
if (mwi_stasis_sub) {
ao2_link(sub->stasis_subs, mwi_stasis_sub);
aors = ast_strdupa(data->endpoint->aors);
- while ((aor_name = strsep(&aors, ","))) {
+ while ((aor_name = ast_strip(strsep(&aors, ",")))) {
RAII_VAR(struct ast_sip_aor *, aor,
ast_sip_location_retrieve_aor(aor_name), ao2_cleanup);
RAII_VAR(struct ao2_container *, contacts, NULL, ao2_cleanup);
configured_aors = ast_strdupa(endpoint->aors);
/* Iterate the configured AORs to see if the user or the user+domain match */
- while ((aor_name = strsep(&configured_aors, ","))) {
+ while ((aor_name = ast_strip(strsep(&configured_aors, ",")))) {
struct ast_sip_domain_alias *alias = NULL;
+ if (ast_strlen_zero(aor_name)) {
+ continue;
+ }
+
if (!pj_strcmp2(&sip_uri->user, aor_name)) {
break;
}
char *items = ast_strdupa(var->value);
char *item;
- while ((item = strsep(&items, ","))) {
+ while ((item = ast_strip(strsep(&items, ",")))) {
+ if (ast_strlen_zero(item)) {
+ continue;
+ }
+
if (item_in_vector(list, item)) {
ast_log(LOG_WARNING, "Ignoring duplicated list item '%s'\n", item);
continue;
configured_aors = ast_strdupa(endpoint->aors);
/* Iterate the configured AORs to see if the user or the user+domain match */
- while ((aor_name = strsep(&configured_aors, ","))) {
+ while ((aor_name = ast_strip(strsep(&configured_aors, ",")))) {
struct ast_sip_domain_alias *alias = NULL;
+ if (ast_strlen_zero(aor_name)) {
+ continue;
+ }
+
if (!pj_strcmp2(&uri->user, aor_name)) {
break;
}