~singpolyma/asterisk

3ef8fade9b1803906a9052feb380170b2a51d2f9 — Stephen Paul Weber 8 months ago 1623f65 master
Use actual arg parser for @ part too
1 files changed, 7 insertions(+), 4 deletions(-)

M channels/sip/config_parser.c
M channels/sip/config_parser.c => channels/sip/config_parser.c +7 -4
@@ 42,6 42,10 @@ int sip_parse_register_line(struct sip_registry *reg, int default_expiry, const 
	char buf[256] = "";
	char *userpart = NULL, *hostpart = NULL;
	/* register => [peer?][transport://]user[@domain][:secret[:authuser]]@host[:port][/extension][~expiry] */
	AST_DECLARE_APP_ARGS(pre0,
		AST_APP_ARG(pre0userpart);
		AST_APP_ARG(pre0hostpart);
	);
	AST_DECLARE_APP_ARGS(pre1,
		AST_APP_ARG(peer);
		AST_APP_ARG(userpart);


@@ 95,10 99,9 @@ int sip_parse_register_line(struct sip_registry *reg, int default_expiry, const 
	 *   userpart => [peer?][transport://]user[@domain][:secret[:authuser]]
	 *   hostpart => host[:port][/extension][~expiry]
	 */
	if ((hostpart = strrchr(buf, '@'))) {
		*hostpart++ = '\0';
		userpart = buf;
	}
	AST_NONSTANDARD_RAW_ARGS(pre0, buf, '@');
	hostpart = pre0.pre0hostpart;
	userpart = pre0.pre0userpart;

	if (ast_strlen_zero(userpart) || ast_strlen_zero(hostpart)) {
		ast_log(LOG_WARNING, "Format for registration is [peer?][transport://]user[@domain][:secret[:authuser]]@host[:port][/extension][~expiry] at line %d\n", lineno);