X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/58f4ce3bac23ceef3d84ab97144d1b4b50f27606..167cffff3b3a976d4bf454808d3054fdb323b1a1:/src/plugins/firewall.sml diff --git a/src/plugins/firewall.sml b/src/plugins/firewall.sml index 5da168f..d58c251 100644 --- a/src/plugins/firewall.sml +++ b/src/plugins/firewall.sml @@ -61,13 +61,22 @@ fun parseRules () = loop [] end -fun query uname = +fun formatQueryRule (Client (ports, hosts)) = + "Client " ^ String.concatWith "," (map Int.toString ports) ^ " " ^ String.concatWith " " hosts + | formatQueryRule (Server (ports, hosts)) = + "Server " ^ String.concatWith "," (map Int.toString ports) ^ " " ^ String.concatWith " " hosts + | formatQueryRule (ProxiedServer ports) = + "ProxiedServer " ^ String.concatWith "," (map Int.toString ports) + | formatQueryRule (LocalServer ports) = + "LocalServer " ^ String.concatWith "," (map Int.toString ports) + +fun query (node, uname) = (* completely broken *) let val rules = parseRules () in - (* map (fn (_, FirewallNode n, r) => (n, r)) (List.filter (fn (User u, _, _) => u = uname) rules) *) - ["broken"] + map (fn (_, _, r) => formatQueryRule r) + (List.filter (fn (User u, FirewallNode n, _) => u = uname andalso n = node) rules) end fun formatPorts ports = "(" ^ String.concatWith " " (map Int.toString ports) ^ ")"