aboutsummaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2019-01-23 11:43:59 +0100
committerAndreas Schneider <asn@cryptomilk.org>2019-01-24 15:15:18 +0100
commite989c4afffa154d92fe8c4ae1716ecc6bb4c2fd5 (patch)
treef16de604bca63c23c5b36505e91a3196e6e657f8 /src/config.c
parent3ce31532eb3d2e5ef0e6f881a4d4a88a9bd44fb2 (diff)
downloadlibssh-e989c4afffa154d92fe8c4ae1716ecc6bb4c2fd5.tar.gz
libssh-e989c4afffa154d92fe8c4ae1716ecc6bb4c2fd5.tar.xz
libssh-e989c4afffa154d92fe8c4ae1716ecc6bb4c2fd5.zip
config: Add new Match final keyword from OpenSSH 8.0
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/config.c b/src/config.c
index a16dd0e0..840f55a9 100644
--- a/src/config.c
+++ b/src/config.c
@@ -152,6 +152,7 @@ static struct ssh_config_keyword_table_s ssh_config_keyword_table[] = {
enum ssh_config_match_e {
MATCH_UNKNOWN = -1,
MATCH_ALL,
+ MATCH_FINAL,
MATCH_CANONICAL,
MATCH_EXEC,
MATCH_HOST,
@@ -168,6 +169,7 @@ struct ssh_config_match_keyword_table_s {
static struct ssh_config_match_keyword_table_s ssh_config_match_keyword_table[] = {
{ "all", MATCH_ALL },
{ "canonical", MATCH_CANONICAL },
+ { "final", MATCH_FINAL },
{ "exec", MATCH_EXEC },
{ "host", MATCH_HOST },
{ "originalhost", MATCH_ORIGINALHOST },
@@ -682,8 +684,10 @@ ssh_config_parse_line(ssh_session session,
switch (opt) {
case MATCH_ALL:
p = ssh_config_get_str_tok(&s, NULL);
- if (args == 1 && (p == NULL || p[0] == '\0')) {
- /* The first argument and end of line */
+ if (args <= 2 && (p == NULL || p[0] == '\0')) {
+ /* The first or second, but last argument. The "all" keyword
+ * can be prefixed with either "final" or "canonical"
+ * keywords which do not have any effect here. */
if (negate == true) {
result = 0;
}
@@ -696,6 +700,16 @@ ssh_config_parse_line(ssh_session session,
SAFE_FREE(x);
return -1;
+ case MATCH_FINAL:
+ case MATCH_CANONICAL:
+ SSH_LOG(SSH_LOG_WARN,
+ "line %d: Unsupported Match keyword '%s', skipping\n",
+ count,
+ p);
+ /* Not set any result here -- the result is dependent on the
+ * following matches after this keyword */
+ break;
+
case MATCH_EXEC:
case MATCH_ORIGINALHOST:
case MATCH_LOCALUSER:
@@ -708,9 +722,6 @@ ssh_config_parse_line(ssh_session session,
return -1;
}
args++;
- FALL_THROUGH;
- case MATCH_CANONICAL:
- /* These do not need any argument */
SSH_LOG(SSH_LOG_WARN,
"line %d: Unsupported Match keyword '%s', ignoring\n",
count,