[asterisk-commits] kharwell: branch kharwell/pimp_sip_callgroup r390396 - /team/kharwell/pimp_si...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 4 10:22:10 CDT 2013


Author: kharwell
Date: Tue Jun  4 10:22:08 2013
New Revision: 390396

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390396
Log:
return config errors if group specified, but data is invalid

Modified:
    team/kharwell/pimp_sip_callgroup/res/res_sip/sip_configuration.c

Modified: team/kharwell/pimp_sip_callgroup/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_callgroup/res/res_sip/sip_configuration.c?view=diff&rev=390396&r1=390395&r2=390396
==============================================================================
--- team/kharwell/pimp_sip_callgroup/res/res_sip/sip_configuration.c (original)
+++ team/kharwell/pimp_sip_callgroup/res/res_sip/sip_configuration.c Tue Jun  4 10:22:08 2013
@@ -293,29 +293,41 @@
 	return 0;
 }
 
-static int group_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
+static int group_handler(const struct aco_option *opt,
+			 struct ast_variable *var, void *obj)
 {
 	struct ast_sip_endpoint *endpoint = obj;
 
 	if (!strncmp(var->name, "callgroup", 9)) {
-		endpoint->callgroup = ast_get_group(var->value);
+		if (!(endpoint->callgroup = ast_get_group(var->value))) {
+			return -1;
+		}
 	} else if (!strncmp(var->name, "pickupgroup", 11)) {
-		endpoint->pickupgroup = ast_get_group(var->value);
-	} else {
-		return -1;
-	}
-
-	return 0;
-}
-
-static int named_groups_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
+		if (!(endpoint->pickupgroup = ast_get_group(var->value))) {
+			return -1;
+		}
+	} else {
+		return -1;
+	}
+
+	return 0;
+}
+
+static int named_groups_handler(const struct aco_option *opt,
+				struct ast_variable *var, void *obj)
 {
 	struct ast_sip_endpoint *endpoint = obj;
 
 	if (!strncmp(var->name, "namedcallgroup", 14)) {
-		endpoint->named_callgroups = ast_get_namedgroups(var->value);
+		if (!(endpoint->named_callgroups =
+		      ast_get_namedgroups(var->value))) {
+			return -1;
+		}
 	} else if (!strncmp(var->name, "namedpickupgroup", 16)) {
-		endpoint->named_pickupgroups = ast_get_namedgroups(var->value);
+		if (!(endpoint->named_pickupgroups =
+		      ast_get_namedgroups(var->value))) {
+			return -1;
+		}
 	} else {
 		return -1;
 	}




More information about the asterisk-commits mailing list