X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=libraries%2Fliblutil%2Fgetpass.c;h=2745da308cd5c7e40d22ee35273ecbc0e5efe0c0;hb=96dd70da2895a6935e4f34148b684747c78dbc12;hp=865c7d1885f7d6657cc0242179adcdc982406350;hpb=21e081dc5b4e9f115302c4d3ab231b2caf1ad2c5;p=openldap
diff --git a/libraries/liblutil/getpass.c b/libraries/liblutil/getpass.c
index 865c7d1885..2745da308c 100644
--- a/libraries/liblutil/getpass.c
+++ b/libraries/liblutil/getpass.c
@@ -1,5 +1,20 @@
-/*
- * Copyright (c) 1992, 1993 Regents of the University of Michigan.
+/* getpass.c -- get password from user */
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software .
+ *
+ * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Portions Copyright 1998-2003 Kurt D. Zeilenga.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * .
+ */
+/* Portions Copyright (c) 1992, 1993 Regents of the University of Michigan.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
@@ -9,11 +24,13 @@
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*/
+/* This work was originally developed by the University of Michigan
+ * and distributed as part of U-MICH LDAP. It was adapted for use in
+ * -llutil by Kurt D. Zeilenga.
+ */
#include "portable.h"
-#ifndef HAVE_GETPASS
-
#include
#include
@@ -25,6 +42,8 @@
#include
#include
+#ifdef NEED_GETPASSPHRASE
+
#ifdef HAVE_FCNTL_H
#include
#endif
@@ -35,19 +54,23 @@
#include
#include
-#include
+
+#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' )
@@ -67,6 +90,8 @@ getpass( const char *prompt )
FILE *fi;
RETSIGTYPE (*sig)( int sig );
+ if( prompt == NULL ) prompt = _("Password: ");
+
#ifdef DEBUG
if (debug & D_TRACE)
printf("->getpass(%s)\n", prompt);
@@ -149,4 +174,4 @@ getpass( const char *prompt )
#endif
}
-#endif /* !HAVE_GETPASS */
+#endif /* !NEED_GETPASSPHRASE */