mirror of
git://anongit.mindrot.org/openssh.git
synced 2024-11-23 18:23:25 +08:00
upstream: Move checks for lists of users or groups into their own
function. This is a no-op on OpenBSD but will make things easier in -portable, eg on systems where these checks should be case-insensitive. ok djm@ OpenBSD-Commit-ID: 8bc9c8d98670e23f8eaaaefe29c1f98e7ba0487e
This commit is contained in:
parent
ab5fee8eb6
commit
fd10cf027b
@ -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:
|
||||
|
15
match.c
15
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
|
||||
|
3
match.h
3
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 *);
|
||||
|
@ -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 "
|
||||
|
Loading…
Reference in New Issue
Block a user