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

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