X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lenses%2Fssh.aug;h=e9585d32e9718c87fb2ec041a2964a214e0c7957;hb=HEAD;hp=2e9c43d808d3408019287d58767b5d2a0213e24c;hpb=2fd787fe3660272ad555e930bb43ceb9b7ec558c;p=platform%2Fupstream%2Faugeas.git diff --git a/lenses/ssh.aug b/lenses/ssh.aug index 2e9c43d..e9585d3 100644 --- a/lenses/ssh.aug +++ b/lenses/ssh.aug @@ -31,14 +31,14 @@ module Ssh = let eol = Util.doseol let spc = Util.del_ws_spc - + let spc_eq = del /[ \t]+|[ \t]*=[ \t]*/ " " let comment = Util.comment let empty = Util.empty let comma = Util.del_str "," let indent = Util.indent let value_to_eol = store Rx.space_in - let value_to_spc = store Rx.no_spaces - let value_to_comma = store /[^, \t\r\n]+/ + let value_to_spc = store /[^ \t\r\n=][^ \t\r\n]*/ + let value_to_comma = store /[^, \t\r\n=][^, \t\r\n]*/ (************************************************************************ @@ -51,16 +51,16 @@ module Ssh = let commas_entry (k:regexp) = let value = [ seq "commas_entry" . value_to_comma] - in [ indent . key k . counter "commas_entry" . spc . + in [ indent . key k . counter "commas_entry" . spc_eq . Build.opt_list value comma . eol ] let spaces_entry (k:regexp) = let value = [ seq "spaces_entry" . value_to_spc ] - in [ indent . key k . counter "spaces_entry" . spc . + in [ indent . key k . counter "spaces_entry" . spc_eq . Build.opt_list value spc . eol ] - let fw_entry (k:regexp) = [ indent . key k . spc . - [ key /[^ \t\r\n\/]+/ . spc . value_to_eol . eol ]] + let fw_entry (k:regexp) = [ indent . key k . spc_eq . + [ key /[^ \t\r\n\/=][^ \t\r\n\/]*/ . spc . value_to_eol . eol ]] let send_env = array_entry /SendEnv/i @@ -76,6 +76,10 @@ module Ssh = let global_knownhosts_file = spaces_entry /GlobalKnownHostsFile/i + let rekey_limit = [ indent . key /RekeyLimit/i . spc_eq . + [ label "amount" . value_to_spc ] . + [ spc . label "duration" . value_to_spc ]? . eol ] + let special_entry = send_env | proxy_command | remote_fw @@ -84,14 +88,15 @@ module Ssh = | ciphers | algorithms | pubkey_accepted_key_types - | global_knownhosts_file + | global_knownhosts_file + | rekey_limit let key_re = /[A-Za-z0-9]+/ - - /SendEnv|Host|ProxyCommand|RemoteForward|LocalForward|MACs|Ciphers|(HostKey|Kex)Algorithms|PubkeyAcceptedKeyTypes|GlobalKnownHostsFile/i + - /SendEnv|Host|Match|ProxyCommand|RemoteForward|LocalForward|MACs|Ciphers|(HostKey|Kex)Algorithms|PubkeyAcceptedKeyTypes|GlobalKnownHostsFile|RekeyLimit/i let other_entry = [ indent . key key_re - . spc . value_to_spc . eol ] + . spc_eq . value_to_spc . eol ] let entry = comment | empty | special_entry @@ -100,11 +105,30 @@ module Ssh = let host = [ key /Host/i . spc . value_to_eol . eol . entry* ] + let condition_entry = + let k = /[A-Za-z0-9]+/ in + let no_spc = Quote.do_dquote_opt (store /[^"' \t\r\n=]+/) in + let with_spc = Quote.do_quote (store /[^"'\t\r\n]* [^"'\t\r\n]*/) in + [ spc . key k . spc . no_spc ] + | [ spc . key k . spc . with_spc ] + + let match_cond = + [ label "Condition" . condition_entry+ . eol ] + + let match_entry = entry + + let match = + [ key /Match/i . match_cond + . [ label "Settings" . match_entry+ ] + ] + + (************************************************************************ * Group: LENS *************************************************************************) - let lns = entry* . host* + let lns = entry* . (host | match)* let xfm = transform lns (incl "/etc/ssh/ssh_config" . - incl (Sys.getenv("HOME") . "/.ssh/config")) + incl (Sys.getenv("HOME") . "/.ssh/config") . + incl "/etc/ssh/ssh_config.d/*.conf")