[Freeswitch-svn] [commit] r8751 - freeswitch/trunk/src/mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Wed Jun 4 12:04:09 EDT 2008


Author: anthm
Date: Wed Jun  4 12:04:08 2008
New Revision: 8751

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c

Log:
add per user acl

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	Wed Jun  4 12:04:08 2008
@@ -785,8 +785,6 @@
 		if (ok && !(profile->pflags & PFLAG_BLIND_REG)) {
 			type = REG_AUTO_REGISTER;
 		} else if (!ok) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl %s\n", network_ip, profile->reg_acl[x]);
-			nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
 			goto end;
 		}
 	}
@@ -933,6 +931,7 @@
 	char hexdigest[2 * SU_MD5_DIGEST_SIZE + 1] = "";
 	char *domain_name = NULL;
 	switch_event_t *params = NULL;
+	const char *auth_acl = NULL;
 
 	username = realm = nonce = uri = qop = cnonce = nc = response = NULL;
 
@@ -1037,7 +1036,7 @@
 		ret = AUTH_FORBIDDEN;
 		goto end;
 	}
-
+	
 	if (!(mailbox = (char *) switch_xml_attr(user, "mailbox"))) {
 		mailbox = username;
 	}
@@ -1059,6 +1058,10 @@
 				passwd = val;
 			}
 
+			if (!strcasecmp(var, "auth_acl")) {
+				auth_acl = val;
+			}
+
 			if (!strcasecmp(var, "a1-hash")) {
 				a1_hash = val;
 			}
@@ -1074,12 +1077,24 @@
 				passwd = val;
 			}
 
+			if (!strcasecmp(var, "auth_acl")) {
+				auth_acl = val;
+			}
+
 			if (!strcasecmp(var, "a1-hash")) {
 				a1_hash = val;
 			}
 		}
 	}
 
+	if (auth_acl) {
+		if (!switch_check_network_list_ip(ip, auth_acl)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by user acl %s\n", ip, auth_acl);
+			ret = AUTH_FORBIDDEN;
+			goto end;
+		}
+	}
+
 	if (switch_strlen_zero(passwd) && switch_strlen_zero(a1_hash)) {
 		ret = AUTH_OK;
 		goto skip_auth;



More information about the Freeswitch-svn mailing list