mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	Eliminates doubling the :port part of SIP Notify Message-Account headers.
This patch prevents the domain string from getting mangled during the initreqprep step by moving the initialization to before its immediate use. It also documents this pitfall for the ast_sockaddr_stringify functions. (issue ASTERISK-19057) Reported by: Yuri Review: https://reviewboard.asterisk.org/r/1678/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@351559 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -12680,7 +12680,7 @@ static int transmit_notify_with_mwi(struct sip_pvt *p, int newmsgs, int oldmsgs, | ||||
| 	struct sip_request req; | ||||
| 	struct ast_str *out = ast_str_alloca(500); | ||||
| 	int ourport = (p->fromdomainport) ? p->fromdomainport : ast_sockaddr_port(&p->ourip); | ||||
| 	const char *domain = S_OR(p->fromdomain, ast_sockaddr_stringify_host_remote(&p->ourip)); | ||||
| 	const char *domain; | ||||
| 	const char *exten = S_OR(vmexten, default_vmexten); | ||||
| 
 | ||||
| 	initreqprep(&req, p, SIP_NOTIFY, NULL); | ||||
| @@ -12688,6 +12688,8 @@ static int transmit_notify_with_mwi(struct sip_pvt *p, int newmsgs, int oldmsgs, | ||||
| 	add_header(&req, "Content-Type", default_notifymime); | ||||
| 	ast_str_append(&out, 0, "Messages-Waiting: %s\r\n", newmsgs ? "yes" : "no"); | ||||
| 
 | ||||
| 	/* domain initialization occurs here because initreqprep changes ast_sockaddr_stringify string. */ | ||||
| 	domain = S_OR(p->fromdomain, ast_sockaddr_stringify_host_remote(&p->ourip)); | ||||
| 
 | ||||
| 	if (!sip_standard_port(p->socket.type, ourport)) { | ||||
| 		if (p->socket.type == SIP_TRANSPORT_UDP) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user