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>
This commit is contained in:
Jakub Jelen
2019-01-23 11:43:59 +01:00
committed by Andreas Schneider
parent 3ce31532eb
commit e989c4afff

View File

@@ -152,6 +152,7 @@ static struct ssh_config_keyword_table_s ssh_config_keyword_table[] = {
enum ssh_config_match_e { enum ssh_config_match_e {
MATCH_UNKNOWN = -1, MATCH_UNKNOWN = -1,
MATCH_ALL, MATCH_ALL,
MATCH_FINAL,
MATCH_CANONICAL, MATCH_CANONICAL,
MATCH_EXEC, MATCH_EXEC,
MATCH_HOST, 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[] = { static struct ssh_config_match_keyword_table_s ssh_config_match_keyword_table[] = {
{ "all", MATCH_ALL }, { "all", MATCH_ALL },
{ "canonical", MATCH_CANONICAL }, { "canonical", MATCH_CANONICAL },
{ "final", MATCH_FINAL },
{ "exec", MATCH_EXEC }, { "exec", MATCH_EXEC },
{ "host", MATCH_HOST }, { "host", MATCH_HOST },
{ "originalhost", MATCH_ORIGINALHOST }, { "originalhost", MATCH_ORIGINALHOST },
@@ -682,8 +684,10 @@ ssh_config_parse_line(ssh_session session,
switch (opt) { switch (opt) {
case MATCH_ALL: case MATCH_ALL:
p = ssh_config_get_str_tok(&s, NULL); p = ssh_config_get_str_tok(&s, NULL);
if (args == 1 && (p == NULL || p[0] == '\0')) { if (args <= 2 && (p == NULL || p[0] == '\0')) {
/* The first argument and end of line */ /* 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) { if (negate == true) {
result = 0; result = 0;
} }
@@ -696,6 +700,16 @@ ssh_config_parse_line(ssh_session session,
SAFE_FREE(x); SAFE_FREE(x);
return -1; 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_EXEC:
case MATCH_ORIGINALHOST: case MATCH_ORIGINALHOST:
case MATCH_LOCALUSER: case MATCH_LOCALUSER:
@@ -708,9 +722,6 @@ ssh_config_parse_line(ssh_session session,
return -1; return -1;
} }
args++; args++;
FALL_THROUGH;
case MATCH_CANONICAL:
/* These do not need any argument */
SSH_LOG(SSH_LOG_WARN, SSH_LOG(SSH_LOG_WARN,
"line %d: Unsupported Match keyword '%s', ignoring\n", "line %d: Unsupported Match keyword '%s', ignoring\n",
count, count,