summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--groupaccess.c9
-rw-r--r--match.c15
-rw-r--r--match.h3
-rw-r--r--servconf.c8
4 files changed, 21 insertions, 14 deletions
diff --git a/groupaccess.c b/groupaccess.c
index 43367990..80d30191 100644
--- a/groupaccess.c
+++ b/groupaccess.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: groupaccess.c,v 1.16 2015/05/04 06:10:48 djm Exp $ */
+/* $OpenBSD: groupaccess.c,v 1.17 2019/03/06 22:14:23 dtucker Exp $ */
/*
* Copyright (c) 2001 Kevin Steves. All rights reserved.
*
@@ -103,11 +103,8 @@ ga_match_pattern_list(const char *group_pattern)
int i, found = 0;
for (i = 0; i < ngroups; i++) {
-#ifndef HAVE_CYGWIN
- switch (match_pattern_list(groups_byname[i], group_pattern, 0)) {
-#else
- switch (match_pattern_list(groups_byname[i], group_pattern, 1)) {
-#endif
+ switch (match_usergroup_pattern_list(groups_byname[i],
+ group_pattern)) {
case -1:
return 0; /* Negated match wins */
case 0:
diff --git a/match.c b/match.c
index b50ae405..ff0815ef 100644
--- a/match.c
+++ b/match.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: match.c,v 1.38 2018/07/04 13:49:31 djm Exp $ */
+/* $OpenBSD: match.c,v 1.39 2019/03/06 22:14:23 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* 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)
#endif
+/* Match a list representing users or groups. */
+int
+match_usergroup_pattern_list(const char *string, const char *pattern)
+{
+#ifndef HAVE_CYGWIN
+ /* Case sensitive match */
+ return match_pattern_list(string, pattern, 0);
+#else
+ /* Case insensitive match */
+ return match_pattern_list(string, pattern, 1);
+#endif
+}
+
/*
* Tries to match the host name (which must be in all lowercase) against the
* comma-separated sequence of subpatterns (each possibly preceded by ! to
diff --git a/match.h b/match.h
index 852b1a5c..3a8a6ecd 100644
--- a/match.h
+++ b/match.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: match.h,v 1.18 2018/07/04 13:49:31 djm Exp $ */
+/* $OpenBSD: match.h,v 1.19 2019/03/06 22:14:23 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -16,6 +16,7 @@
int match_pattern(const char *, const char *);
int match_pattern_list(const char *, const char *, int);
+int match_usergroup_pattern_list(const char *, const char *);
int match_hostname(const char *, const char *);
int match_host_and_ip(const char *, const char *, const char *);
int match_user(const char *, const char *, const char *, const char *);
diff --git a/servconf.c b/servconf.c
index 4fa896fd..a7bfba82 100644
--- a/servconf.c
+++ b/servconf.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: servconf.c,v 1.348 2019/01/24 02:34:52 dtucker Exp $ */
+/* $OpenBSD: servconf.c,v 1.349 2019/03/06 22:14:23 dtucker Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
@@ -1049,11 +1049,7 @@ match_cfg_line(char **condition, int line, struct connection_info *ci)
}
if (ci->user == NULL)
match_test_missing_fatal("User", "user");
-#ifndef HAVE_CYGWIN
- if (match_pattern_list(ci->user, arg, 0) != 1)
-#else
- if (match_pattern_list(ci->user, arg, 1) != 1)
-#endif
+ if (match_usergroup_pattern_list(ci->user, arg) != 1)
result = 0;
else
debug("user %.100s matched 'User %.100s' at "