[openssh-commits] [openssh] 01/01: prefer login_getpwclass() to login_getclass()

git+noreply at mindrot.org git+noreply at mindrot.org
Thu Feb 18 11:27:14 AEDT 2021


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 845fe9811c047063d935eca89188ed55c993626b
Author: Damien Miller <djm at mindrot.org>
Date:   Thu Feb 18 11:25:38 2021 +1100

    prefer login_getpwclass() to login_getclass()
    
    FreeBSD has login_getpwclass() that does some special magic for
    UID=0. Prefer this to login_getclass() as its easier to emulate
    the former with the latter.
    
    Based on FreeBSD PR 37416 via Ed Maste; ok dtucker@
---
 auth.c                          | 2 +-
 configure.ac                    | 1 +
 openbsd-compat/openbsd-compat.h | 4 ++++
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/auth.c b/auth.c
index 2b77abca..a0e3cd6f 100644
--- a/auth.c
+++ b/auth.c
@@ -604,7 +604,7 @@ getpwnamallow(struct ssh *ssh, const char *user)
 	if (!allowed_user(ssh, pw))
 		return (NULL);
 #ifdef HAVE_LOGIN_CAP
-	if ((lc = login_getclass(pw->pw_class)) == NULL) {
+	if ((lc = login_getpwclass(pw)) == NULL) {
 		debug("unable to get login class: %s", user);
 		return (NULL);
 	}
diff --git a/configure.ac b/configure.ac
index 63c239e0..6b75cf97 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1841,6 +1841,7 @@ AC_CHECK_FUNCS([ \
 	llabs \
 	localtime_r \
 	login_getcapbool \
+	login_getpwclass \
 	md5_crypt \
 	memmem \
 	memmove \
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h
index 50bac587..542ae58d 100644
--- a/openbsd-compat/openbsd-compat.h
+++ b/openbsd-compat/openbsd-compat.h
@@ -48,6 +48,10 @@
 #include "blf.h"
 #include "fnmatch.h"
 
+#if defined(HAVE_LOGIN_CAP) && !defined(HAVE_LOGIN_GETPWCLASS)
+# define login_getpwclass(pw) login_getclass(pw->pw_class)
+#endif
+
 #ifndef HAVE_BASENAME
 char *basename(const char *path);
 #endif

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list