[Asterisk-cvs] asterisk/channels chan_sip.c,1.250,1.251
markster at lists.digium.com
markster at lists.digium.com
Mon Nov 24 15:01:30 CST 2003
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv25452/channels
Modified Files:
chan_sip.c
Log Message:
Apply host access rules in SIP
Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.250
retrieving revision 1.251
diff -u -d -r1.250 -r1.251
--- chan_sip.c 24 Nov 2003 19:13:32 -0000 1.250
+++ chan_sip.c 24 Nov 2003 21:27:51 -0000 1.251
@@ -3560,7 +3560,7 @@
ast_mutex_lock(&peerl.lock);
peer = peerl.peers;
while(peer) {
- if (!strcasecmp(peer->name, name)) {
+ if (!strcasecmp(peer->name, name) && ast_apply_ha(peer->ha,sin)) {
if (!peer->dynamic) {
ast_log(LOG_NOTICE, "Peer '%s' isn't dynamic\n", peer->name);
break;
@@ -3931,7 +3931,7 @@
}
return output;
}
-static int check_user(struct sip_pvt *p, struct sip_request *req, char *cmd, char *uri, int reliable)
+static int check_user(struct sip_pvt *p, struct sip_request *req, char *cmd, char *uri, int reliable, struct sockaddr_in *sin)
{
struct sip_user *user;
struct sip_peer *peer;
@@ -3967,7 +3967,7 @@
ast_mutex_lock(&userl.lock);
user = userl.users;
while(user) {
- if (!strcasecmp(user->name, of)) {
+ if (!strcasecmp(user->name, of) && ast_apply_ha(user->ha,sin)) {
p->nat = user->nat;
if (p->rtp) {
ast_log(LOG_DEBUG, "Setting NAT on RTP to %d\n", p->nat);
@@ -5020,7 +5020,7 @@
ast_verbose("Ignoring this request\n");
if (!p->lastinvite) {
/* Handle authentication if this is our first invite */
- res = check_user(p, req, cmd, e, 1);
+ res = check_user(p, req, cmd, e, 1, sin);
if (res) {
if (res < 0) {
ast_log(LOG_NOTICE, "Failed to authenticate user %s\n", get_header(req, "From"));
@@ -5239,7 +5239,7 @@
if (!p->lastinvite) {
/* Handle authentication if this is our first subscribe */
- res = check_user(p, req, cmd, e, 0);
+ res = check_user(p, req, cmd, e, 0, sin);
if (res) {
if (res < 0) {
ast_log(LOG_NOTICE, "Failed to authenticate user %s for SUBSCRIBE\n", get_header(req, "From"));
More information about the svn-commits
mailing list