Blame SOURCES/0007-Ssh-add-Match-keyword-support-695.patch

3c78df
From 0880cf38e5c9a6a9ddb3ce4cae372dec5ad34cbe Mon Sep 17 00:00:00 2001
3c78df
From: granquet <ranquet.guillaume@gmail.com>
3c78df
Date: Tue, 6 Oct 2020 23:03:18 +0200
3c78df
Subject: [PATCH] Ssh: add Match keyword support (#695)
3c78df
3c78df
Signed-off-by: Guillaume Ranquet <guillaume-externe.ranquet@edf.fr>
3c78df
---
3c78df
 lenses/ssh.aug            | 19 +++++++++++++++++--
3c78df
 lenses/tests/test_ssh.aug | 12 ++++++++++++
3c78df
 2 files changed, 29 insertions(+), 2 deletions(-)
3c78df
3c78df
diff --git a/lenses/ssh.aug b/lenses/ssh.aug
3c78df
index 4e731581..c140c9a9 100644
3c78df
--- a/lenses/ssh.aug
3c78df
+++ b/lenses/ssh.aug
3c78df
@@ -92,7 +92,7 @@ module Ssh =
3c78df
                         | rekey_limit
3c78df
 
3c78df
     let key_re = /[A-Za-z0-9]+/
3c78df
-               - /SendEnv|Host|ProxyCommand|RemoteForward|LocalForward|MACs|Ciphers|(HostKey|Kex)Algorithms|PubkeyAcceptedKeyTypes|GlobalKnownHostsFile|RekeyLimit/i
3c78df
+               - /SendEnv|Host|Match|ProxyCommand|RemoteForward|LocalForward|MACs|Ciphers|(HostKey|Kex)Algorithms|PubkeyAcceptedKeyTypes|GlobalKnownHostsFile|RekeyLimit/i
3c78df
 
3c78df
 
3c78df
     let other_entry = [ indent . key key_re
3c78df
@@ -105,11 +105,26 @@ module Ssh =
3c78df
     let host = [ key /Host/i . spc . value_to_eol . eol . entry* ]
3c78df
 
3c78df
 
3c78df
+   let condition_entry =
3c78df
+    let value = store  /[^ \t\r\n=]+/ in
3c78df
+    [ spc . key /[A-Za-z0-9]+/ . spc . value ]
3c78df
+
3c78df
+   let match_cond =
3c78df
+     [ label "Condition" . condition_entry+ . eol ]
3c78df
+
3c78df
+   let match_entry = entry
3c78df
+
3c78df
+   let match =
3c78df
+     [ key /Match/i . match_cond
3c78df
+        . [ label "Settings" .  match_entry+ ]
3c78df
+     ]
3c78df
+
3c78df
+
3c78df
 (************************************************************************
3c78df
  * Group:                 LENS
3c78df
  *************************************************************************)
3c78df
 
3c78df
-    let lns = entry* . host*
3c78df
+    let lns = entry* . (host | match)*
3c78df
 
3c78df
     let xfm = transform lns (incl "/etc/ssh/ssh_config" .
3c78df
                              incl (Sys.getenv("HOME") . "/.ssh/config") .
3c78df
diff --git a/lenses/tests/test_ssh.aug b/lenses/tests/test_ssh.aug
3c78df
index f5fca252..456624e4 100644
3c78df
--- a/lenses/tests/test_ssh.aug
3c78df
+++ b/lenses/tests/test_ssh.aug
3c78df
@@ -5,6 +5,9 @@ module Test_ssh =
3c78df
 "# start
3c78df
 IdentityFile /etc/ssh/identity.asc
3c78df
 
3c78df
+Match final all
3c78df
+   GSSAPIAuthentication yes
3c78df
+
3c78df
 Host suse.cz
3c78df
    ForwardAgent yes
3c78df
 SendEnv LC_LANG
3c78df
@@ -30,6 +33,15 @@ PubkeyAcceptedKeyTypes ssh-ed25519-cert-v01@openssh.com,ssh-ed25519,ssh-rsa-cert
3c78df
     { "#comment" = "start" }
3c78df
     { "IdentityFile" = "/etc/ssh/identity.asc" }
3c78df
     { }
3c78df
+    { "Match"
3c78df
+      { "Condition"
3c78df
+        { "final" = "all" }
3c78df
+      }
3c78df
+      { "Settings"
3c78df
+        { "GSSAPIAuthentication" = "yes" }
3c78df
+        {  }
3c78df
+      }
3c78df
+    }
3c78df
     { "Host"	= "suse.cz"
3c78df
 	{ "ForwardAgent"  = "yes" }
3c78df
 	{ "SendEnv"
3c78df
-- 
3c78df
2.29.2
3c78df