diff options
Diffstat (limited to 'readconf.c')
-rw-r--r-- | readconf.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/readconf.c b/readconf.c index f18666786..63c0ba196 100644 --- a/readconf.c +++ b/readconf.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: readconf.c,v 1.212 2013/10/23 03:05:19 djm Exp $ */ | 1 | /* $OpenBSD: readconf.c,v 1.213 2013/10/24 00:51:48 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -459,7 +459,7 @@ match_cfg_line(Options *options, char **condition, struct passwd *pw, | |||
459 | { | 459 | { |
460 | char *arg, *attrib, *cmd, *cp = *condition, *host; | 460 | char *arg, *attrib, *cmd, *cp = *condition, *host; |
461 | const char *ruser; | 461 | const char *ruser; |
462 | int r, port, result = 1; | 462 | int r, port, result = 1, attributes = 0; |
463 | size_t len; | 463 | size_t len; |
464 | char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV]; | 464 | char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV]; |
465 | 465 | ||
@@ -478,6 +478,19 @@ match_cfg_line(Options *options, char **condition, struct passwd *pw, | |||
478 | 478 | ||
479 | debug3("checking match for '%s' host %s", cp, host); | 479 | debug3("checking match for '%s' host %s", cp, host); |
480 | while ((attrib = strdelim(&cp)) && *attrib != '\0') { | 480 | while ((attrib = strdelim(&cp)) && *attrib != '\0') { |
481 | attributes++; | ||
482 | if (strcasecmp(attrib, "all") == 0) { | ||
483 | if (attributes != 1 || | ||
484 | ((arg = strdelim(&cp)) != NULL && *arg != '\0')) { | ||
485 | error("'all' cannot be combined with other " | ||
486 | "Match attributes"); | ||
487 | result = -1; | ||
488 | goto out; | ||
489 | } | ||
490 | *condition = cp; | ||
491 | result = 1; | ||
492 | goto out; | ||
493 | } | ||
481 | if ((arg = strdelim(&cp)) == NULL || *arg == '\0') { | 494 | if ((arg = strdelim(&cp)) == NULL || *arg == '\0') { |
482 | error("Missing Match criteria for %s", attrib); | 495 | error("Missing Match criteria for %s", attrib); |
483 | result = -1; | 496 | result = -1; |
@@ -544,6 +557,11 @@ match_cfg_line(Options *options, char **condition, struct passwd *pw, | |||
544 | goto out; | 557 | goto out; |
545 | } | 558 | } |
546 | } | 559 | } |
560 | if (attributes == 0) { | ||
561 | error("One or more attributes required for Match"); | ||
562 | result = -1; | ||
563 | goto out; | ||
564 | } | ||
547 | debug3("match %sfound", result ? "" : "not "); | 565 | debug3("match %sfound", result ? "" : "not "); |
548 | *condition = cp; | 566 | *condition = cp; |
549 | out: | 567 | out: |