diff options
-rw-r--r-- | groupaccess.c | 9 | ||||
-rw-r--r-- | match.c | 15 | ||||
-rw-r--r-- | match.h | 3 | ||||
-rw-r--r-- | servconf.c | 8 |
4 files changed, 21 insertions, 14 deletions
diff --git a/groupaccess.c b/groupaccess.c index 43367990d..80d301915 100644 --- a/groupaccess.c +++ b/groupaccess.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: groupaccess.c,v 1.16 2015/05/04 06:10:48 djm Exp $ */ | 1 | /* $OpenBSD: groupaccess.c,v 1.17 2019/03/06 22:14:23 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Kevin Steves. All rights reserved. | 3 | * Copyright (c) 2001 Kevin Steves. All rights reserved. |
4 | * | 4 | * |
@@ -103,11 +103,8 @@ ga_match_pattern_list(const char *group_pattern) | |||
103 | int i, found = 0; | 103 | int i, found = 0; |
104 | 104 | ||
105 | for (i = 0; i < ngroups; i++) { | 105 | for (i = 0; i < ngroups; i++) { |
106 | #ifndef HAVE_CYGWIN | 106 | switch (match_usergroup_pattern_list(groups_byname[i], |
107 | switch (match_pattern_list(groups_byname[i], group_pattern, 0)) { | 107 | group_pattern)) { |
108 | #else | ||
109 | switch (match_pattern_list(groups_byname[i], group_pattern, 1)) { | ||
110 | #endif | ||
111 | case -1: | 108 | case -1: |
112 | return 0; /* Negated match wins */ | 109 | return 0; /* Negated match wins */ |
113 | case 0: | 110 | case 0: |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: match.c,v 1.38 2018/07/04 13:49:31 djm Exp $ */ | 1 | /* $OpenBSD: match.c,v 1.39 2019/03/06 22:14:23 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 |
@@ -174,6 +174,19 @@ match_pattern_list(const char *string, const char *pattern, int dolower) | |||
174 | 174 | ||
175 | #endif | 175 | #endif |
176 | 176 | ||
177 | /* Match a list representing users or groups. */ | ||
178 | int | ||
179 | match_usergroup_pattern_list(const char *string, const char *pattern) | ||
180 | { | ||
181 | #ifndef HAVE_CYGWIN | ||
182 | /* Case sensitive match */ | ||
183 | return match_pattern_list(string, pattern, 0); | ||
184 | #else | ||
185 | /* Case insensitive match */ | ||
186 | return match_pattern_list(string, pattern, 1); | ||
187 | #endif | ||
188 | } | ||
189 | |||
177 | /* | 190 | /* |
178 | * Tries to match the host name (which must be in all lowercase) against the | 191 | * Tries to match the host name (which must be in all lowercase) against the |
179 | * comma-separated sequence of subpatterns (each possibly preceded by ! to | 192 | * comma-separated sequence of subpatterns (each possibly preceded by ! to |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: match.h,v 1.18 2018/07/04 13:49:31 djm Exp $ */ | 1 | /* $OpenBSD: match.h,v 1.19 2019/03/06 22:14:23 dtucker Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | int match_pattern(const char *, const char *); | 17 | int match_pattern(const char *, const char *); |
18 | int match_pattern_list(const char *, const char *, int); | 18 | int match_pattern_list(const char *, const char *, int); |
19 | int match_usergroup_pattern_list(const char *, const char *); | ||
19 | int match_hostname(const char *, const char *); | 20 | int match_hostname(const char *, const char *); |
20 | int match_host_and_ip(const char *, const char *, const char *); | 21 | int match_host_and_ip(const char *, const char *, const char *); |
21 | int match_user(const char *, const char *, const char *, const char *); | 22 | int match_user(const char *, const char *, const char *, const char *); |
diff --git a/servconf.c b/servconf.c index 4fa896fd4..a7bfba827 100644 --- a/servconf.c +++ b/servconf.c | |||
@@ -1,5 +1,5 @@ | |||
1 | 1 | ||
2 | /* $OpenBSD: servconf.c,v 1.348 2019/01/24 02:34:52 dtucker Exp $ */ | 2 | /* $OpenBSD: servconf.c,v 1.349 2019/03/06 22:14:23 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 |
@@ -1049,11 +1049,7 @@ match_cfg_line(char **condition, int line, struct connection_info *ci) | |||
1049 | } | 1049 | } |
1050 | if (ci->user == NULL) | 1050 | if (ci->user == NULL) |
1051 | match_test_missing_fatal("User", "user"); | 1051 | match_test_missing_fatal("User", "user"); |
1052 | #ifndef HAVE_CYGWIN | 1052 | if (match_usergroup_pattern_list(ci->user, arg) != 1) |
1053 | if (match_pattern_list(ci->user, arg, 0) != 1) | ||
1054 | #else | ||
1055 | if (match_pattern_list(ci->user, arg, 1) != 1) | ||
1056 | #endif | ||
1057 | result = 0; | 1053 | result = 0; |
1058 | else | 1054 | else |
1059 | debug("user %.100s matched 'User %.100s' at " | 1055 | debug("user %.100s matched 'User %.100s' at " |