Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

made xinetd.aug case insensitive on attribute names #4

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lenses/shellvars.aug
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module Shellvars =
(* but fairly close. *)
let simple_value =
let empty_array = /\([ \t]*\)/ in
store (char* | dquot | squot | bquot | dollar_assign | empty_array)
store (char* | (dquot | squot)+ | bquot | dollar_assign | empty_array)

let export = [ key "export" . Util.del_ws_spc ]
let kv = [ Util.indent . export? . key key_re
Expand Down
3 changes: 3 additions & 0 deletions lenses/tests/test_shellvars.aug
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ unset ONBOOT # We do not want this var
test Shellvars.lns get "var=\"ab#c\"\n" =
{ "var" = "\"ab#c\"" }

test Shellvars.lns get "ESSID='Joe'\"'\"'s net'\n" =
{ "ESSID" = "'Joe'\"'\"'s net'" }

(* For some reason, `` conflicts with comment_eol *)
test Shellvars.lns get "var=`ab#c`\n" =
{ "var" = "`ab"
Expand Down
6 changes: 5 additions & 1 deletion lenses/tests/test_xinetd.aug
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ service cvspserver
server_args = -f --allow-root=/var/cvs pserver
# bind = 127.0.0.1
log_on_failure += HOST
FLAGS = IPv6 IPv4
}
"

Expand Down Expand Up @@ -60,7 +61,10 @@ test Xinetd.lns get cvs =
{ "value" = "--allow-root=/var/cvs" }
{ "value" = "pserver" } }
{ "#comment" = "bind = 127.0.0.1" }
{ "log_on_failure" { "add" } { "value" = "HOST" } } }
{ "log_on_failure" { "add" } { "value" = "HOST" } }
{ "FLAGS"
{ "value" = "IPv6" }
{ "value" = "IPv4" } } }

(* Switch the '+=' to a simple '=' *)
test Xinetd.lns put lst_add after rm "/service/log_on_failure/add" =
Expand Down
23 changes: 6 additions & 17 deletions lenses/xinetd.aug
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,15 @@ module Xinetd =
* causes the type checker to work _very_ hard.
*)
let service_attr =
attr_one ("socket_type" | "protocol" | "wait" | "user" | "group"
|"server" | "instances" | "rpc_version" | "rpc_number"
| "id" | "port" | "nice" | "banner" | "bind" | "interface"
| "per_source" | "groups" | "banner_success" | "banner_fail"
| "disable" | "max_load" | "rlimit_as" | "rlimit_cpu"
| "rlimit_data" | "rlimit_rss" | "rlimit_stack" | "v6only"
| "deny_time" | "umask" | "mdns" | "libwrap")
attr_one (/socket_type|protocol|wait|user|group|server|instances|rpc_version|rpc_number|id|port|nice|banner|bind|interface|per_source|groups|banner_success|banner_fail|disable|max_load|rlimit_as|rlimit_cpu|rlimit_data|rlimit_rss|rlimit_stack|v6only|deny_time|umask|mdns|libwrap/i)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you split this line to keep it under 80 columns, please?

(* redirect and cps aren't really lists, they take exactly two values *)
|attr_lst_eq ("server_args" | "log_type" | "access_times" | "type"
| "flags" | "redirect" | "cps")
|attr_lst_op ( "log_on_success" | "log_on_failure"| "only_from"
| "no_access" | "env" | "passenv")
|attr_lst_eq (/server_args|log_type|access_times|type|flags|redirect|cps/i)
|attr_lst_op (/log_on_success|log_on_failure|only_from|no_access|env|passenv/i)

let default_attr =
attr_one ( "instances" | "banner" | "bind" | "interface" | "per_source"
| "groups" | "banner_success" | "banner_fail" | "max_load"
| "v6only" | "umask" | "mdns")
|attr_lst_eq "cps" (* really only two values, not a whole list *)
|attr_lst_op ( "log_type" | "log_on_success" | "log_on_failure" | "disabled"
| "no_access" | "only_from" | "passenv" | "enabled" )
attr_one (/instances|banner|bind|interface|per_source|groups|banner_success|banner_fail|max_load|v6only|umask|mdns/i)
|attr_lst_eq /cps/i (* really only two values, not a whole list *)
|attr_lst_op (/log_type|log_on_success|log_on_failure|disabled|no_access|only_from|passenv|enabled/i)

(* View: body
* Note:
Expand Down