]> granicus.if.org Git - sudo/commitdiff
Add support for getpwnam_shadow() on OpenBSD
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 18 Nov 2016 00:55:44 +0000 (17:55 -0700)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 18 Nov 2016 00:55:44 +0000 (17:55 -0700)
config.h.in
configure
configure.ac
plugins/sudoers/getspwuid.c

index b07626dd39e9892697fa4a21298a8d76d436f5a6..4a080aaf984b228970b0376f632aa05bbb795175 100644 (file)
    passwords). */
 #undef HAVE_GETPRPWNAM
 
+/* Define to 1 if you have the `getpwnam_shadow' function. */
+#undef HAVE_GETPWNAM_SHADOW
+
 /* Define to 1 if you have the `getresuid' function. */
 #undef HAVE_GETRESUID
 
index 22a3e9c1f632c50a2c018765a74e60295f3fefc6..0af324726cab56a761c376cfb0fb1f8e2e7076d0 100755 (executable)
--- a/configure
+++ b/configure
@@ -15633,7 +15633,7 @@ done
                # OpenBSD has a real setreuid(2) starting with 3.3 but
                # we will use setresuid(2) instead.
                SKIP_SETREUID=yes
-               CHECKSHADOW="false"
+
                # OpenBSD >= 3.0 supports BSD auth
                if test -z "$with_bsdauth"; then
                    if test "$OSMAJOR" -ge 3; then
@@ -15642,6 +15642,9 @@ done
                fi
                : ${with_logincap='maybe'}
 
+               # Newer OpenBSD only fills in pw_password for getpwnam_shadow()
+               shadow_funcs="getpwnam_shadow"
+
                # Examples go in share/examples/sudo
                if test X"$with_exampledir" = X""; then
                    exampledir='$(datarootdir)/examples/$(PACKAGE_TARNAME)'
@@ -28050,5 +28053,6 @@ fi
 
 
 
+
 
 
index 86912f231dd9a5fc58538fb2ace6f32ece320dae..02f47fb49d36871bdf5d97c4a5eb80aaf09f073f 100644 (file)
@@ -2037,7 +2037,7 @@ case "$host" in
                # OpenBSD has a real setreuid(2) starting with 3.3 but
                # we will use setresuid(2) instead.
                SKIP_SETREUID=yes
-               CHECKSHADOW="false"
+
                # OpenBSD >= 3.0 supports BSD auth
                if test -z "$with_bsdauth"; then
                    if test "$OSMAJOR" -ge 3; then
@@ -2046,6 +2046,9 @@ case "$host" in
                fi
                : ${with_logincap='maybe'}
 
+               # Newer OpenBSD only fills in pw_password for getpwnam_shadow()
+               shadow_funcs="getpwnam_shadow"
+
                # Examples go in share/examples/sudo
                if test X"$with_exampledir" = X""; then
                    exampledir='$(datarootdir)/examples/$(PACKAGE_TARNAME)'
@@ -4295,6 +4298,7 @@ AH_TEMPLATE(HAVE_FCNTL_CLOSEM, [Define to 1 if your system has the F_CLOSEM fcnt
 AH_TEMPLATE(HAVE_FNMATCH, [Define to 1 if you have the `fnmatch' function.])
 AH_TEMPLATE(HAVE_FWTK, [Define to 1 if you use the FWTK authsrv daemon.])
 AH_TEMPLATE(HAVE_GETPRPWNAM, [Define to 1 if you have the `getprpwnam' function.  (SecureWare-style shadow passwords).])
+AH_TEMPLATE(HAVE_GETPWNAM_SHADOW, [Define to 1 if you have the `getpwnam_shadow' function.])
 AH_TEMPLATE(HAVE_GETSPNAM, [Define to 1 if you have the `getspnam' function (SVR4-style shadow passwords).])
 AH_TEMPLATE(HAVE_GSS_KRB5_CCACHE_NAME, [Define to 1 if you have the `gss_krb5_ccache_name' function.])
 AH_TEMPLATE(HAVE_HEIMDAL, [Define to 1 if your Kerberos is Heimdal.])
index 7a8fc75e4bd39fb6511fc0862d5685debafdda2f..212c0c23d9350510b0328f762e5a9428ef3065b0 100644 (file)
@@ -72,6 +72,14 @@ sudo_getepw(const struct passwd *pw)
        goto done;
 #endif /* HAVE_ISCOMSEC */
 
+#ifdef HAVE_GETPWNAM_SHADOW
+    {
+       struct passwd *spw;
+
+       if ((spw = getpwnam_shadow(pw->pw_name)) != NULL)
+           epw = spw->pw_passwd;
+    }
+#endif /* HAVE_GETPWNAM_SHADOW */
 #ifdef HAVE_GETPRPWNAM
     {
        struct pr_passwd *spw;