Submitted By: Pierre Labastie (pierre -doT- labastie -aT- neuf -DoT- fr)
Date: 2014-09-28
Initial Package Version: 1.7.11
Origin: Upstream HG
Upstream Status: In HG
Description: When PAM is not installed, sudo may use shadow passwords. The
             released version unconditionally links to libshadow in this case,
             while -lshadow is only needed for some linux distros, and is
             not available for LFS.

# HG changeset patch
# User Todd C. Miller <Todd.Miller@courtesan.com>
# Date 1411834408 21600
# Node ID fdf06757f25da85551b2e8b17fbff047a560b1ec
# Parent  4cd0481bf05ec041639b57d50703b22436300892
Only check for -lshadow if we haven't already found getspnam() in
libc.  Rather than treat this specially, just add -lshadow as another
place to search in addition to -lgen.

diff -r 4cd0481bf05e -r fdf06757f25d configure
--- a/configure	Fri Sep 26 20:55:19 2014 -0600
+++ b/configure	Sat Sep 27 10:13:28 2014 -0600
@@ -3070,7 +3070,6 @@
 shadow_defs=
 shadow_funcs=
 shadow_libs=
-shadow_libs_optional=
 CONFIGURE_ARGS="$@"
 
 RTLD_PRELOAD_VAR="LD_PRELOAD"
@@ -14733,9 +14732,7 @@
 		;;
     *-*-linux*|*-*-k*bsd*-gnu)
 		OSDEFS="${OSDEFS} -D_GNU_SOURCE"
-		# Some Linux versions need to link with -lshadow
 		shadow_funcs="getspnam"
-		shadow_libs_optional="-lshadow"
 		test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
 		;;
     *-*-gnu*)
@@ -21323,24 +21320,6 @@
 fi
 done
 
-	if test "$found" = "yes" -a -n "$shadow_libs_optional"; then
-	    LIBS="$LIBS $shadow_libs_optional"
-	    for ac_func in $shadow_funcs
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
- found=yes
-fi
-done
-
-	    if test "$found" = "yes"; then
-		shadow_libs="$shadow_libs $shadow_libs_optional"
-	    fi
-	fi
 	if test "$found" = "yes"; then
 	    case "$shadow_funcs" in
 		*getprpwnam*) SECUREWARE=1;;
@@ -21377,7 +21356,7 @@
   return 0;
 }
 _ACEOF
-for ac_lib in '' gen; do
+for ac_lib in '' gen shadow; do
   if test -z "$ac_lib"; then
     ac_res="none required"
   else
diff -r 4cd0481bf05e -r fdf06757f25d configure.ac
--- a/configure.ac	Fri Sep 26 20:55:19 2014 -0600
+++ b/configure.ac	Sat Sep 27 10:13:28 2014 -0600
@@ -226,7 +226,6 @@
 shadow_defs=
 shadow_funcs=
 shadow_libs=
-shadow_libs_optional=
 CONFIGURE_ARGS="$@"
 
 dnl
@@ -1908,9 +1907,7 @@
 		;;
     *-*-linux*|*-*-k*bsd*-gnu)
 		OSDEFS="${OSDEFS} -D_GNU_SOURCE"
-		# Some Linux versions need to link with -lshadow
 		shadow_funcs="getspnam"
-		shadow_libs_optional="-lshadow"
 		test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
 		;;
     *-*-gnu*)
@@ -3430,13 +3427,6 @@
 	LIBS="$LIBS $shadow_libs"
 	found=no
 	AC_CHECK_FUNCS($shadow_funcs, [found=yes])
-	if test "$found" = "yes" -a -n "$shadow_libs_optional"; then
-	    LIBS="$LIBS $shadow_libs_optional"
-	    AC_CHECK_FUNCS($shadow_funcs, [found=yes])
-	    if test "$found" = "yes"; then
-		shadow_libs="$shadow_libs $shadow_libs_optional"
-	    fi
-	fi
 	if test "$found" = "yes"; then
 	    case "$shadow_funcs" in
 		*getprpwnam*) SECUREWARE=1;;
@@ -3449,7 +3439,7 @@
 	LIBS="$_LIBS"
     fi
     if test "$CHECKSHADOW" = "true"; then
-	AC_SEARCH_LIBS([getspnam], [gen], [AC_DEFINE(HAVE_GETSPNAM)] [CHECKSHADOW=false; test -n "$ac_lib" && shadow_libs="${shadow_libs} $ac_res"])
+	AC_SEARCH_LIBS([getspnam], [gen shadow], [AC_DEFINE(HAVE_GETSPNAM)] [CHECKSHADOW=false; test -n "$ac_lib" && shadow_libs="${shadow_libs} $ac_res"])
     fi
     if test "$CHECKSHADOW" = "true"; then
 	AC_SEARCH_LIBS([getprpwnam], [sec security prot], [AC_DEFINE(HAVE_GETPRPWNAM)] [CHECKSHADOW=false; SECUREWARE=1; test -n "$ac_lib" && shadow_libs="${shadow_libs} $ac_res"])

