}
if (want_bindpw)
- passwd.bv_val = getpass("Enter LDAP Password: ");
+ passwd.bv_val = getpassphrase("Enter LDAP Password: ");
passwd.bv_len = strlen( passwd.bv_val );
if ( authmethod == LDAP_AUTH_SASL ) {
}
if (want_bindpw)
- passwd.bv_val = getpass("Enter LDAP Password: ");
+ passwd.bv_val = getpassphrase("Enter LDAP Password: ");
passwd.bv_len = strlen( passwd.bv_val );
if ( authmethod == LDAP_AUTH_SASL ) {
}
if (want_bindpw)
- passwd.bv_val = getpass("Enter LDAP Password: ");
+ passwd.bv_val = getpassphrase("Enter LDAP Password: ");
passwd.bv_len = strlen( passwd.bv_val );
if ( authmethod == LDAP_AUTH_SASL ) {
if( want_oldpw && oldpw == NULL ) {
/* prompt for old password */
char *ckoldpw;
- newpw = strdup(getpass("Old password: "));
- ckoldpw = getpass("Re-enter old password: ");
+ newpw = strdup(getpassphrase("Old password: "));
+ ckoldpw = getpassphrase("Re-enter old password: ");
if( strncmp( oldpw, ckoldpw, strlen(oldpw) )) {
fprintf( stderr, "passwords do not match\n" );
if( want_newpw && newpw == NULL ) {
/* prompt for new password */
char *cknewpw;
- newpw = strdup(getpass("New password: "));
- cknewpw = getpass("Re-enter new password: ");
+ newpw = strdup(getpassphrase("New password: "));
+ cknewpw = getpassphrase("Re-enter new password: ");
if( strncmp( newpw, cknewpw, strlen(newpw) )) {
fprintf( stderr, "passwords do not match\n" );
if (want_bindpw && passwd.bv_val == NULL ) {
/* handle bind password */
fprintf( stderr, "Bind DN: %s\n", binddn );
- passwd.bv_val = strdup( getpass("Enter bind password: "));
+ passwd.bv_val = strdup( getpassphrase("Enter bind password: "));
passwd.bv_len = strlen( passwd.bv_val );
}
}
if (want_bindpw) {
- passwd.bv_val = getpass("Enter LDAP Password: ");
+ passwd.bv_val = getpassphrase("Enter LDAP Password: ");
passwd.bv_len = strlen( passwd.bv_val );
}
auth( char *who, int implicit )
{
int rc; /* return code from ldap_bind() */
- char *passwd = NULL; /* returned by getpass() */
+ char *passwd = NULL; /* returned by getpassphrase() */
char **rdns; /* for fiddling with the DN */
int authmethod;
int name_provided; /* was a name passed in? */
authmethod = LDAP_AUTH_SIMPLE;
sprintf(prompt, " Enter your LDAP password: ");
do {
- passwd = getpass(prompt);
+ passwd = getpassphrase(prompt);
} while (passwd != NULL && *passwd == '\0');
if (passwd == NULL) {
(void) ldap_value_free(rdns);
sprintf(prompt, " Enter Kerberos password for %s: ", kauth_name );
#endif
do {
- passwd = getpass(prompt);
+ passwd = getpassphrase(prompt);
} while (passwd != NULL && *passwd == '\0');
if (passwd == NULL) {
return(-1);
getgrgid \
gethostname \
getpass \
+ getpassphrase \
getpwuid \
getpwnam \
getspnam \
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:15584: checking for $ac_func" >&5
+echo "configure:15585: 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 <<EOF
-#line 15589 "configure"
+#line 15590 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:15613: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15614: \"$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
for ac_func in getopt tempnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:15641: checking for $ac_func" >&5
+echo "configure:15642: 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 <<EOF
-#line 15646 "configure"
+#line 15647 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:15670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15671: \"$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
# Check Configuration
echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
-echo "configure:15707: checking declaration of sys_errlist" >&5
+echo "configure:15708: 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 <<EOF
-#line 15713 "configure"
+#line 15714 "configure"
#include "confdefs.h"
#include <stdio.h>
char *c = (char *) *sys_errlist
; return 0; }
EOF
-if { (eval echo configure:15726: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:15727: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_dcl_sys_errlist=yes
ol_cv_have_sys_errlist=yes
echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6
-echo "configure:15749: checking existence of sys_errlist" >&5
+echo "configure:15750: 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 <<EOF
-#line 15755 "configure"
+#line 15756 "configure"
#include "confdefs.h"
#include <errno.h>
int main() {
char *c = (char *) *sys_errlist
; return 0; }
EOF
-if { (eval echo configure:15762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15763: \"$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
getgrgid \
gethostname \
getpass \
+ getpassphrase \
getpwuid \
getpwnam \
getspnam \
/* note: callers of crypt(3) should include <ac/crypt.h> */
-#ifndef HAVE_GETPASS
-LIBLUTIL_F(char*)(getpass) LDAP_P((const char *getpass));
-#else
+#if defined(HAVE_GETPASSPHRASE)
+LIBC_F(char*)(getpassphrase)();
+
+#elif defined(HAVE_GETPASS)
+#define getpassphrase(p) getpass(p)
LIBC_F(char*)(getpass)();
+
+#else
+#define NEED_GETPASSPHRASE 1
+#define getpassphrase(p) lutil_getpass(p)
+LIBLUTIL_F(char*)(lutil_getpass) LDAP_P((const char *getpass));
#endif
/* getopt() defines may be in separate include file */
/* 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 getpwnam function. */
#undef HAVE_GETPWNAM
#include "portable.h"
-#ifndef HAVE_GETPASS
-
#include <stdio.h>
#include <ac/stdlib.h>
#include <ac/time.h>
#include <ac/unistd.h>
+#ifdef NEED_GETPASSPHRASE
+
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include "ldap_defaults.h"
char *
-getpass( const char *prompt )
+lutil_getpass( const char *prompt )
{
#if !defined(HAVE_POSIX_TERMIOS) && !defined(HAVE_SGTTY_H)
static char buf[256];
int i, c;
+ if( prompt == NULL ) prompt = "Password: ";
+
#ifdef DEBUG
if (debug & D_TRACE)
printf("->getpass(%s)\n", prompt);
#endif
+
printf("%s", prompt);
i = 0;
while ( (c = getch()) != EOF && c != '\n' && c != '\r' )
FILE *fi;
RETSIGTYPE (*sig)( int sig );
+ if( prompt == NULL ) prompt = "Password: ";
+
#ifdef DEBUG
if (debug & D_TRACE)
printf("->getpass(%s)\n", prompt);
#endif
}
-#endif /* !HAVE_GETPASS */
+#endif /* !NEED_GETPASSPHRASE */