Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
openldap
OpenLDAP
Commits
8045b541
Commit
8045b541
authored
May 19, 2000
by
Kurt Zeilenga
Browse files
Use getpassphrase() instead of getpass() if available.
parent
72db2b73
Changes
11
Hide whitespace changes
Inline
Side-by-side
clients/tools/ldapdelete.c
View file @
8045b541
...
...
@@ -318,7 +318,7 @@ main( int argc, char **argv )
}
if
(
want_bindpw
)
passwd
.
bv_val
=
getpass
(
"Enter LDAP Password: "
);
passwd
.
bv_val
=
getpass
phrase
(
"Enter LDAP Password: "
);
passwd
.
bv_len
=
strlen
(
passwd
.
bv_val
);
if
(
authmethod
==
LDAP_AUTH_SASL
)
{
...
...
clients/tools/ldapmodify.c
View file @
8045b541
...
...
@@ -382,7 +382,7 @@ main( int argc, char **argv )
}
if
(
want_bindpw
)
passwd
.
bv_val
=
getpass
(
"Enter LDAP Password: "
);
passwd
.
bv_val
=
getpass
phrase
(
"Enter LDAP Password: "
);
passwd
.
bv_len
=
strlen
(
passwd
.
bv_val
);
if
(
authmethod
==
LDAP_AUTH_SASL
)
{
...
...
clients/tools/ldapmodrdn.c
View file @
8045b541
...
...
@@ -365,7 +365,7 @@ main(int argc, char **argv)
}
if
(
want_bindpw
)
passwd
.
bv_val
=
getpass
(
"Enter LDAP Password: "
);
passwd
.
bv_val
=
getpass
phrase
(
"Enter LDAP Password: "
);
passwd
.
bv_len
=
strlen
(
passwd
.
bv_val
);
if
(
authmethod
==
LDAP_AUTH_SASL
)
{
...
...
clients/tools/ldappasswd.c
View file @
8045b541
...
...
@@ -246,8 +246,8 @@ main( int argc, char *argv[] )
if
(
want_oldpw
&&
oldpw
==
NULL
)
{
/* prompt for old password */
char
*
ckoldpw
;
newpw
=
strdup
(
getpass
(
"Old password: "
));
ckoldpw
=
getpass
(
"Re-enter old password: "
);
newpw
=
strdup
(
getpass
phrase
(
"Old password: "
));
ckoldpw
=
getpass
phrase
(
"Re-enter old password: "
);
if
(
strncmp
(
oldpw
,
ckoldpw
,
strlen
(
oldpw
)
))
{
fprintf
(
stderr
,
"passwords do not match
\n
"
);
...
...
@@ -258,8 +258,8 @@ main( int argc, char *argv[] )
if
(
want_newpw
&&
newpw
==
NULL
)
{
/* prompt for new password */
char
*
cknewpw
;
newpw
=
strdup
(
getpass
(
"New password: "
));
cknewpw
=
getpass
(
"Re-enter new password: "
);
newpw
=
strdup
(
getpass
phrase
(
"New password: "
));
cknewpw
=
getpass
phrase
(
"Re-enter new password: "
);
if
(
strncmp
(
newpw
,
cknewpw
,
strlen
(
newpw
)
))
{
fprintf
(
stderr
,
"passwords do not match
\n
"
);
...
...
@@ -280,7 +280,7 @@ main( int argc, char *argv[] )
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
(
getpass
phrase
(
"Enter bind password: "
));
passwd
.
bv_len
=
strlen
(
passwd
.
bv_val
);
}
...
...
clients/tools/ldapsearch.c
View file @
8045b541
...
...
@@ -521,7 +521,7 @@ main( int argc, char **argv )
}
if
(
want_bindpw
)
{
passwd
.
bv_val
=
getpass
(
"Enter LDAP Password: "
);
passwd
.
bv_val
=
getpass
phrase
(
"Enter LDAP Password: "
);
passwd
.
bv_len
=
strlen
(
passwd
.
bv_val
);
}
...
...
clients/ud/auth.c
View file @
8045b541
...
...
@@ -50,7 +50,7 @@ int
auth
(
char
*
who
,
int
implicit
)
{
int
rc
;
/* return code from ldap_bind() */
char
*
passwd
=
NULL
;
/* returned by getpass() */
char
*
passwd
=
NULL
;
/* returned by getpass
phrase
() */
char
**
rdns
;
/* for fiddling with the DN */
int
authmethod
;
int
name_provided
;
/* was a name passed in? */
...
...
@@ -241,7 +241,7 @@ auth( char *who, int implicit )
authmethod
=
LDAP_AUTH_SIMPLE
;
sprintf
(
prompt
,
" Enter your LDAP password: "
);
do
{
passwd
=
getpass
(
prompt
);
passwd
=
getpass
phrase
(
prompt
);
}
while
(
passwd
!=
NULL
&&
*
passwd
==
'\0'
);
if
(
passwd
==
NULL
)
{
(
void
)
ldap_value_free
(
rdns
);
...
...
@@ -352,7 +352,7 @@ krbgetpass( char *user, char *inst, char *realm, char *pw, C_Block key )
sprintf
(
prompt
,
" Enter Kerberos password for %s: "
,
kauth_name
);
#endif
do
{
passwd
=
getpass
(
prompt
);
passwd
=
getpass
phrase
(
prompt
);
}
while
(
passwd
!=
NULL
&&
*
passwd
==
'\0'
);
if
(
passwd
==
NULL
)
{
return
(
-
1
);
...
...
configure
View file @
8045b541
...
...
@@ -15539,6 +15539,7 @@ for ac_func in \
getgrgid
\
gethostname
\
getpass
\
getpassphrase
\
getpwuid
\
getpwnam
\
getspnam
\
...
...
@@ -15580,12 +15581,12 @@ for ac_func in \
do
echo
$ac_n
"checking for
$ac_func
""...
$ac_c
"
1>&6
echo
"configure:1558
4
: checking for
$ac_func
"
>
&5
echo
"configure:1558
5
: 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 155
8
9 "configure"
#line 1559
0
"configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char
$ac_func
(); below. */
...
...
@@ -15609,7 +15610,7 @@ f = $ac_func;
; return 0; }
EOF
if
{
(
eval echo
configure:1561
3
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
${
ac_exeext
}
;
then
if
{
(
eval echo
configure:1561
4
:
\"
$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
...
...
@@ -15637,12 +15638,12 @@ done
for
ac_func
in
getopt tempnam
do
echo
$ac_n
"checking for
$ac_func
""...
$ac_c
"
1>&6
echo
"configure:1564
1
: checking for
$ac_func
"
>
&5
echo
"configure:1564
2
: 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 1564
6
"configure"
#line 1564
7
"configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char
$ac_func
(); below. */
...
...
@@ -15666,7 +15667,7 @@ f = $ac_func;
; return 0; }
EOF
if
{
(
eval echo
configure:1567
0
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
${
ac_exeext
}
;
then
if
{
(
eval echo
configure:1567
1
:
\"
$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
...
...
@@ -15703,13 +15704,13 @@ fi
# Check Configuration
echo
$ac_n
"checking declaration of sys_errlist""...
$ac_c
"
1>&6
echo
"configure:1570
7
: checking declaration of sys_errlist"
>
&5
echo
"configure:1570
8
: 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 1571
3
"configure"
#line 1571
4
"configure"
#include "confdefs.h"
#include <stdio.h>
...
...
@@ -15722,7 +15723,7 @@ int main() {
char *c = (char *) *sys_errlist
; return 0; }
EOF
if
{
(
eval echo
configure:1572
6
:
\"
$ac_compile
\"
)
1>&5
;
(
eval
$ac_compile
)
2>&5
;
}
;
then
if
{
(
eval echo
configure:1572
7
:
\"
$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
...
...
@@ -15745,20 +15746,20 @@ EOF
echo
$ac_n
"checking existence of sys_errlist""...
$ac_c
"
1>&6
echo
"configure:157
49
: checking existence of sys_errlist"
>
&5
echo
"configure:157
50
: 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 1575
5
"configure"
#line 1575
6
"configure"
#include "confdefs.h"
#include <errno.h>
int main() {
char *c = (char *) *sys_errlist
; return 0; }
EOF
if
{
(
eval echo
configure:1576
2
:
\"
$ac_link
\"
)
1>&5
;
(
eval
$ac_link
)
2>&5
;
}
&&
test
-s
conftest
${
ac_exeext
}
;
then
if
{
(
eval echo
configure:1576
3
:
\"
$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
...
...
configure.in
View file @
8045b541
...
...
@@ -2138,6 +2138,7 @@ AC_CHECK_FUNCS( \
getgrgid \
gethostname \
getpass \
getpassphrase \
getpwuid \
getpwnam \
getspnam \
...
...
include/ac/unistd.h
View file @
8045b541
...
...
@@ -27,10 +27,17 @@
/* 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 */
...
...
include/portable.h.in
View file @
8045b541
...
...
@@ -166,6 +166,9 @@
/* 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
...
...
libraries/liblutil/getpass.c
View file @
8045b541
...
...
@@ -17,8 +17,6 @@
#include
"portable.h"
#ifndef HAVE_GETPASS
#include
<stdio.h>
#include
<ac/stdlib.h>
...
...
@@ -30,6 +28,8 @@
#include
<ac/time.h>
#include
<ac/unistd.h>
#ifdef NEED_GETPASSPHRASE
#ifdef HAVE_FCNTL_H
#include
<fcntl.h>
#endif
...
...
@@ -44,16 +44,19 @@
#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'
)
...
...
@@ -73,6 +76,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
);
...
...
@@ -155,4 +160,4 @@ getpass( const char *prompt )
#endif
}
#endif
/* !
HAVE
_GETPASS */
#endif
/* !
NEED
_GETPASS
PHRASE
*/
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment