bpo-28503: Use crypt_r() when available instead of crypt() (GH-11373) · python/cpython@387512c (original) (raw)
`@@ -12677,6 +12677,150 @@ fi
`
12677
12677
`done
`
12678
12678
``
12679
12679
``
``
12680
`+
We search for both crypt and crypt_r as one or the other may be defined
`
``
12681
`+
This gets us our -lcrypt in LIBS when required on the target platform.
`
``
12682
`+
{ asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: checking for library containing crypt" >&5
`
``
12683
`+
$as_echo_n "checking for library containing crypt... " >&6; }
`
``
12684
`+
if ${ac_cv_search_crypt+:} false; then :
`
``
12685
`+
$as_echo_n "(cached) " >&6
`
``
12686
`+
else
`
``
12687
`+
ac_func_search_save_LIBS=$LIBS
`
``
12688
`+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
`
``
12689
`+
/* end confdefs.h. */
`
``
12690
+
``
12691
`+
/* Override any GCC internal prototype to avoid an error.
`
``
12692
`+
Use char because int might match the return type of a GCC
`
``
12693
`+
builtin and then its argument prototype would still apply. */
`
``
12694
`+
#ifdef __cplusplus
`
``
12695
`+
extern "C"
`
``
12696
`+
#endif
`
``
12697
`+
char crypt ();
`
``
12698
`+
int
`
``
12699
`+
main ()
`
``
12700
`+
{
`
``
12701
`+
return crypt ();
`
``
12702
`+
;
`
``
12703
`+
return 0;
`
``
12704
`+
}
`
``
12705
`+
_ACEOF
`
``
12706
`+
for ac_lib in '' crypt; do
`
``
12707
`+
if test -z "$ac_lib"; then
`
``
12708
`+
ac_res="none required"
`
``
12709
`+
else
`
``
12710
`+
ac_res=-l$ac_lib
`
``
12711
`+
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
`
``
12712
`+
fi
`
``
12713
`+
if ac_fn_c_try_link "$LINENO"; then :
`
``
12714
`+
ac_cv_search_crypt=$ac_res
`
``
12715
`+
fi
`
``
12716
`+
rm -f core conftest.err conftest.$ac_objext \
`
``
12717
`+
conftest$ac_exeext
`
``
12718
`+
if ${ac_cv_search_crypt+:} false; then :
`
``
12719
`+
break
`
``
12720
`+
fi
`
``
12721
`+
done
`
``
12722
`+
if ${ac_cv_search_crypt+:} false; then :
`
``
12723
+
``
12724
`+
else
`
``
12725
`+
ac_cv_search_crypt=no
`
``
12726
`+
fi
`
``
12727
`+
rm conftest.$ac_ext
`
``
12728
`+
LIBS=$ac_func_search_save_LIBS
`
``
12729
`+
fi
`
``
12730
`+
{ asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: result: $ac_cv_search_crypt" >&5
`
``
12731
`+ asecho"as_echo "asecho"ac_cv_search_crypt" >&6; }
`
``
12732
`+
ac_res=$ac_cv_search_crypt
`
``
12733
`+
if test "$ac_res" != no; then :
`
``
12734
`+
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
`
``
12735
+
``
12736
`+
fi
`
``
12737
+
``
12738
`+
{ asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: checking for library containing crypt_r" >&5
`
``
12739
`+
$as_echo_n "checking for library containing crypt_r... " >&6; }
`
``
12740
`+
if ${ac_cv_search_crypt_r+:} false; then :
`
``
12741
`+
$as_echo_n "(cached) " >&6
`
``
12742
`+
else
`
``
12743
`+
ac_func_search_save_LIBS=$LIBS
`
``
12744
`+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
`
``
12745
`+
/* end confdefs.h. */
`
``
12746
+
``
12747
`+
/* Override any GCC internal prototype to avoid an error.
`
``
12748
`+
Use char because int might match the return type of a GCC
`
``
12749
`+
builtin and then its argument prototype would still apply. */
`
``
12750
`+
#ifdef __cplusplus
`
``
12751
`+
extern "C"
`
``
12752
`+
#endif
`
``
12753
`+
char crypt_r ();
`
``
12754
`+
int
`
``
12755
`+
main ()
`
``
12756
`+
{
`
``
12757
`+
return crypt_r ();
`
``
12758
`+
;
`
``
12759
`+
return 0;
`
``
12760
`+
}
`
``
12761
`+
_ACEOF
`
``
12762
`+
for ac_lib in '' crypt; do
`
``
12763
`+
if test -z "$ac_lib"; then
`
``
12764
`+
ac_res="none required"
`
``
12765
`+
else
`
``
12766
`+
ac_res=-l$ac_lib
`
``
12767
`+
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
`
``
12768
`+
fi
`
``
12769
`+
if ac_fn_c_try_link "$LINENO"; then :
`
``
12770
`+
ac_cv_search_crypt_r=$ac_res
`
``
12771
`+
fi
`
``
12772
`+
rm -f core conftest.err conftest.$ac_objext \
`
``
12773
`+
conftest$ac_exeext
`
``
12774
`+
if ${ac_cv_search_crypt_r+:} false; then :
`
``
12775
`+
break
`
``
12776
`+
fi
`
``
12777
`+
done
`
``
12778
`+
if ${ac_cv_search_crypt_r+:} false; then :
`
``
12779
+
``
12780
`+
else
`
``
12781
`+
ac_cv_search_crypt_r=no
`
``
12782
`+
fi
`
``
12783
`+
rm conftest.$ac_ext
`
``
12784
`+
LIBS=$ac_func_search_save_LIBS
`
``
12785
`+
fi
`
``
12786
`+
{ asecho"as_echo "asecho"as_me:${as_lineno-$LINENO}: result: $ac_cv_search_crypt_r" >&5
`
``
12787
`+ asecho"as_echo "asecho"ac_cv_search_crypt_r" >&6; }
`
``
12788
`+
ac_res=$ac_cv_search_crypt_r
`
``
12789
`+
if test "$ac_res" != no; then :
`
``
12790
`+
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
`
``
12791
+
``
12792
`+
fi
`
``
12793
+
``
12794
+
``
12795
`+
ac_fn_c_check_func "$LINENO" "crypt_r" "ac_cv_func_crypt_r"
`
``
12796
`+
if test "x$ac_cv_func_crypt_r" = xyes; then :
`
``
12797
`+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
`
``
12798
`+
/* end confdefs.h. */
`
``
12799
+
``
12800
`+
#define _GNU_SOURCE /* Required for crypt_r()'s prototype in glibc. */
`
``
12801
`+
#include <crypt.h>
`
``
12802
+
``
12803
`+
int
`
``
12804
`+
main ()
`
``
12805
`+
{
`
``
12806
+
``
12807
`+
struct crypt_data d;
`
``
12808
`+
char *r = crypt_r("", "", &d);
`
``
12809
+
``
12810
`+
;
`
``
12811
`+
return 0;
`
``
12812
`+
}
`
``
12813
`+
_ACEOF
`
``
12814
`+
if ac_fn_c_try_compile "$LINENO"; then :
`
``
12815
+
``
12816
`+
$as_echo "#define HAVE_CRYPT_R 1" >>confdefs.h
`
``
12817
+
``
12818
`+
fi
`
``
12819
`+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
`
``
12820
+
``
12821
`+
fi
`
``
12822
+
``
12823
+
12680
12824
`for ac_func in clock_gettime
`
12681
12825
`do :
`
12682
12826
` ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime"
`