+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
/*
* Copyright (c) 1992, 1993 Regents of the University of Michigan.
* All rights reserved.
#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 <lber.h>
#include <ldap.h>
-#include <ldap_defaults.h>
+
+#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 */