[Asterisk-code-review] res pjsip registrar.c: Reduce stack usage in find aor name(). (asterisk[13])

Alexei Gradinari asteriskteam at digium.com
Fri Sep 2 14:45:16 CDT 2016


Alexei Gradinari has posted comments on this change.

Change subject: res_pjsip_registrar.c: Reduce stack usage in find_aor_name().
......................................................................


Patch Set 1: Code-Review-1

(1 comment)

https://gerrit.asterisk.org/#/c/3807/1/res/res_pjsip_registrar.c
File res/res_pjsip_registrar.c:

PS1, Line 576: 	/* Look for exact match on username at domain */
             : 	configured_aors = aors_buf;
             : 	while ((aor_name = ast_strip(strsep(&configured_aors, ",")))) {
             : 		if (match_aor(aor_name, id_domain)) {
             : 			return ast_strdup(aor_name);
             : 		}
             : 	}
             : 
             : 	/* If there's a domain alias, look for exact match on username at domain_alias */
             : 	alias = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "domain_alias", domain);
             : 	if (alias) {
             : 		char *id_domain_alias = ast_alloca(strlen(username) + strlen(alias->domain) + 2);
             : 
             : 		sprintf(id_domain, "%s@%s", username, alias->domain);
             : 		ao2_cleanup(alias);
             : 
             : 		configured_aors = strcpy(aors_buf, aors);/* Safe */
             : 		while ((aor_name = ast_strip(strsep(&configured_aors, ",")))) {
             : 			if (match_aor(aor_name, id_domain_alias)) {
             : 				return ast_strdup(aor_name);
             : 			}
             : 		}
             : 	}
Do not look for domain/domain_alias if disable_multi_domain=yes

if (!ast_sip_get_disable_multi_domain()) {
	id_domain = ast_alloca(strlen(username) + strlen(domain) + 2);
	sprintf(id_domain, "%s@%s", username, domain);

...
}


-- 
To view, visit https://gerrit.asterisk.org/3807
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I8aebad1fdcf303bd115b59a4b57fbbd5b2267f09
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list