Review Board 1.7.16


Use 'remotesecret' when it is set instead of 'secret' when authenticating to a remote party

Review Request #1107 - Created Feb. 14, 2011 and submitted

Terry Wilson
1.6.2
Reviewers
asterisk-dev
dvossel, oej
Asterisk
Asterisk 1.6.2+ has the 'remotesecret' config option which is documented to be the password we use when connecting out to a peer. The 'secret' option is supposed to be used for when we are authenticating an inbound request. 'remotesecret' currently works for registration, but for sending an INVITE the 'secret' is used instead. This patch tests if we are making an outgoing request and uses the peer remotesecret if it is set. Otherwise it still uses the secret as it always has.
Tested that a peer with a 'remotesecret' used that on an outbound call. Tested that if remotesecret is not set, secret is used.

Diff revision 1 (Latest)

  1. /branches/1.6.2/channels/chan_sip.c: Loading...
/branches/1.6.2/channels/chan_sip.c
Revision 307791 New Change
[20] 17596 lines
[+20] [+] static int build_reply_digest(struct sip_pvt *p, int method, char* digest, int digest_len)
17597
		if (sipdebug)
17597
		if (sipdebug)
17598
 			ast_debug(1, "Using realm %s authentication for call %s\n", p->realm, p->callid);
17598
 			ast_debug(1, "Using realm %s authentication for call %s\n", p->realm, p->callid);
17599
 	} else {
17599
 	} else {
17600
 		/* No authentication, use peer or register= config */
17600
 		/* No authentication, use peer or register= config */
17601
 		username = p->authname;
17601
 		username = p->authname;
17602
 		secret =  p->peersecret;
17602
 		secret = ast_test_flag(&p->flags[0], SIP_OUTGOING) && p->relatedpeer

    
   
17603
			&& !ast_strlen_zero(p->relatedpeer->remotesecret)

    
   
17604
			? p->relatedpeer->remotesecret : p->peersecret;
17603
 		md5secret = p->peermd5secret;
17605
 		md5secret = p->peermd5secret;
17604
 	}
17606
 	}
17605
	if (ast_strlen_zero(username))	/* We have no authentication */
17607
	if (ast_strlen_zero(username))	/* We have no authentication */
17606
		return -1;
17608
		return -1;
17607

    
   
17609

   
[+20] [20] 8922 lines
  1. /branches/1.6.2/channels/chan_sip.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.