]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix acl parsing for cidr from recent changes to directory layout
authorBrian West <brian@freeswitch.org>
Sun, 28 Dec 2008 23:17:29 +0000 (23:17 +0000)
committerBrian West <brian@freeswitch.org>
Sun, 28 Dec 2008 23:17:29 +0000 (23:17 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10981 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_core.c

index 261fead6f361910eba5ceaed92ec29e51b8d430b..a44a579299b3ff14f53b190d776e02c779287281 100644 (file)
@@ -881,7 +881,7 @@ SWITCH_DECLARE(void) switch_load_network_lists(switch_bool_t reload)
                                        if (domain) {
                                                switch_event_t *my_params = NULL;
                                                switch_xml_t x_domain, xml_root;
-                                               switch_xml_t ut;
+                                               switch_xml_t gt, gts, ut, uts;
 
                                                switch_event_create(&my_params, SWITCH_EVENT_GENERAL);
                                                switch_assert(my_params);
@@ -914,6 +914,32 @@ SWITCH_DECLARE(void) switch_load_network_lists(switch_bool_t reload)
                                                                free(token);
                                                        }
                                                }
+
+                                               for (gts = switch_xml_child(x_domain, "groups"); gts; gts = gts->next) {
+                                                       for (gt = switch_xml_child(gts, "group"); gt; gt = gt->next) {
+                                                               for (uts = switch_xml_child(gt, "users"); uts; uts = uts->next) {
+                                                                       for (ut = switch_xml_child(uts, "user"); ut; ut = ut->next) {
+                                                                               const char *user_cidr = switch_xml_attr(ut, "cidr");
+                                                                               const char *id = switch_xml_attr(ut, "id");
+                                                                               
+                                                                               if (id && user_cidr) {
+                                                                                       char *token = switch_mprintf("%s@%s", id, domain);
+                                                                                       switch_assert(token);
+                                                                                       
+                                                                                       if (switch_network_list_add_cidr_token(list, user_cidr, ok, token) == SWITCH_STATUS_SUCCESS) {
+                                                                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s (%s) [%s] to list %s\n", 
+                                                                                                                                 user_cidr, ok ? "allow" : "deny", switch_str_nil(token), name);
+                                                                                       } else {
+                                                                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding %s (%s) [%s] to list %s\n",
+                                                                                                                                 user_cidr, ok ? "allow" : "deny", switch_str_nil(token), name);
+                                                                                       }
+                                                                                       free(token);
+                                                                               }
+                                                                       }
+                                                               }
+                                                       }
+                                               }
+
                                                switch_xml_free(xml_root);
                                        } else if (cidr) {
                                                if (switch_network_list_add_cidr(list, cidr, ok) == SWITCH_STATUS_SUCCESS) {