summaryrefslogtreecommitdiff
path: root/servconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'servconf.c')
-rw-r--r--servconf.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/servconf.c b/servconf.c
index 100d38d9b..82146723f 100644
--- a/servconf.c
+++ b/servconf.c
@@ -1,5 +1,5 @@
1 1
2/* $OpenBSD: servconf.c,v 1.242 2013/10/23 05:40:58 dtucker Exp $ */ 2/* $OpenBSD: servconf.c,v 1.243 2013/10/24 00:51:48 dtucker Exp $ */
3/* 3/*
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5 * All rights reserved 5 * All rights reserved
@@ -647,7 +647,7 @@ out:
647static int 647static int
648match_cfg_line(char **condition, int line, struct connection_info *ci) 648match_cfg_line(char **condition, int line, struct connection_info *ci)
649{ 649{
650 int result = 1, port; 650 int result = 1, attributes = 0, port;
651 char *arg, *attrib, *cp = *condition; 651 char *arg, *attrib, *cp = *condition;
652 size_t len; 652 size_t len;
653 653
@@ -661,6 +661,17 @@ match_cfg_line(char **condition, int line, struct connection_info *ci)
661 ci->laddress ? ci->laddress : "(null)", ci->lport); 661 ci->laddress ? ci->laddress : "(null)", ci->lport);
662 662
663 while ((attrib = strdelim(&cp)) && *attrib != '\0') { 663 while ((attrib = strdelim(&cp)) && *attrib != '\0') {
664 attributes++;
665 if (strcasecmp(attrib, "all") == 0) {
666 if (attributes != 1 ||
667 ((arg = strdelim(&cp)) != NULL && *arg != '\0')) {
668 error("'all' cannot be combined with other "
669 "Match attributes");
670 return -1;
671 }
672 *condition = cp;
673 return 1;
674 }
664 if ((arg = strdelim(&cp)) == NULL || *arg == '\0') { 675 if ((arg = strdelim(&cp)) == NULL || *arg == '\0') {
665 error("Missing Match criteria for %s", attrib); 676 error("Missing Match criteria for %s", attrib);
666 return -1; 677 return -1;
@@ -754,6 +765,10 @@ match_cfg_line(char **condition, int line, struct connection_info *ci)
754 return -1; 765 return -1;
755 } 766 }
756 } 767 }
768 if (attributes == 0) {
769 error("One or more attributes required for Match");
770 return -1;
771 }
757 if (ci != NULL) 772 if (ci != NULL)
758 debug3("match %sfound", result ? "" : "not "); 773 debug3("match %sfound", result ? "" : "not ");
759 *condition = cp; 774 *condition = cp;