From aaaac6ee7bb39409af6332ef37e0e474faccf5c2 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 19 May 2000 21:11:34 +0000 Subject: [PATCH] Detect and use getpassphrase() and getpass() --- CHANGES | 1 + configure | 26 ++++++++++++++------------ configure.in | 2 ++ include/ac/unistd.h | 8 +++++++- include/portable.h.in | 6 ++++++ libraries/liblutil/getpass.c | 6 +++--- 6 files changed, 33 insertions(+), 16 deletions(-) diff --git a/CHANGES b/CHANGES index acc5bf04e7..f1fe2a18f9 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,7 @@ Changes included in OpenLDAP 1.2.11 Release Engineering Fixed NULL prefix bug in libldap/ufn.c Fixed slapd_shutdown extern reference bug (ITS#527) Build Environment + Detect and use getpassphrase() and getpass() Change GNU Pth to enable soft syscalls Changed RCPT cmds symbol to avoid link conflict (ITS#526) Changed LDBM directory to $localstatedir/openldap-ldbm diff --git a/configure b/configure index ce0bece2d9..0f323f2bee 100755 --- a/configure +++ b/configure @@ -9277,6 +9277,8 @@ for ac_func in \ bcopy \ closesocket \ flock \ + getpass \ + getpassphrase \ getdtablesize \ gethostname \ getpwuid \ @@ -9305,12 +9307,12 @@ for ac_func in \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:9309: checking for $ac_func" >&5 +echo "configure:9311: checking for $ac_func" >&5 if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9340: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -9362,12 +9364,12 @@ done for ac_func in getopt strdup tempnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:9366: checking for $ac_func" >&5 +echo "configure:9368: checking for $ac_func" >&5 if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -9421,13 +9423,13 @@ done # Check Configuration echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6 -echo "configure:9425: checking declaration of sys_errlist" >&5 +echo "configure:9427: checking declaration of sys_errlist" >&5 if eval "test \"\${ol_cv_dcl_sys_errlist+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -9437,7 +9439,7 @@ int main() { char *c = (char *) *sys_errlist ; return 0; } EOF -if { (eval echo configure:9441: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9443: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ol_cv_dcl_sys_errlist=yes else @@ -9458,20 +9460,20 @@ if test $ol_cv_dcl_sys_errlist = no ; then EOF echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6 -echo "configure:9462: checking existence of sys_errlist" >&5 +echo "configure:9464: checking existence of sys_errlist" >&5 if eval "test \"\${ol_cv_have_sys_errlist+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *c = (char *) *sys_errlist ; return 0; } EOF -if { (eval echo configure:9475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ol_cv_have_sys_errlist=yes else diff --git a/configure.in b/configure.in index 9152b3d98d..d7be9120b7 100644 --- a/configure.in +++ b/configure.in @@ -1396,6 +1396,8 @@ AC_CHECK_FUNCS( \ bcopy \ closesocket \ flock \ + getpass \ + getpassphrase \ getdtablesize \ gethostname \ getpwuid \ diff --git a/include/ac/unistd.h b/include/ac/unistd.h index 3eb7c23e4c..e6141cb15f 100644 --- a/include/ac/unistd.h +++ b/include/ac/unistd.h @@ -27,7 +27,13 @@ extern char *crypt(); #endif -#ifndef HAVE_GETPASS +#if defined( HAVE_GETPASSPHRASE ) +extern char* (getpassphrase)(); +#define getpass(x) getpassphrase(x) +#elif defined( HAVE_GETPASS ) +extern char* (getpass)(); +#else +#define NEED_GETPASS extern char* getpass LDAP_P((const char* prompt)); #endif diff --git a/include/portable.h.in b/include/portable.h.in index abadb5b542..e142fac975 100644 --- a/include/portable.h.in +++ b/include/portable.h.in @@ -214,6 +214,12 @@ /* Define if you have the getopt function. */ #undef HAVE_GETOPT +/* Define if you have the getpass function. */ +#undef HAVE_GETPASS + +/* Define if you have the getpassphrase function. */ +#undef HAVE_GETPASSPHRASE + /* Define if you have the getpwuid function. */ #undef HAVE_GETPWUID diff --git a/libraries/liblutil/getpass.c b/libraries/liblutil/getpass.c index c5cc6b0e32..c9c1d20771 100644 --- a/libraries/liblutil/getpass.c +++ b/libraries/liblutil/getpass.c @@ -12,8 +12,6 @@ #include "portable.h" -#ifndef HAVE_GETPASS - #include #include @@ -25,6 +23,8 @@ #include #include +#ifdef NEED_GETPASS + #ifdef HAVE_FCNTL_H #include #endif @@ -149,4 +149,4 @@ getpass( const char *prompt ) #endif /* DOS */ } -#endif /* !HAVE_GETPASS */ \ No newline at end of file +#endif /* !NEED_GETPASS */ -- 2.39.2