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
914bf992
Commit
914bf992
authored
May 11, 2006
by
Pierangelo Masarati
Browse files
add "-n" to omit trailing newline
parent
a0ee2869
Changes
2
Hide whitespace changes
Inline
Side-by-side
doc/man/man8/slappasswd.8
View file @
914bf992
...
...
@@ -11,6 +11,7 @@ slappasswd \- OpenLDAP password utility
.B [\-g|\-s secret|\-T file]
.B [\-h hash]
.B [\-c salt-format]
.B [\-n]
.B
.LP
.SH DESCRIPTION
...
...
@@ -131,6 +132,10 @@ provides a two character salt and '$1$%.8s' tells some
versions of crypt(3) to use an MD5 algorithm and provides
8 random characters of salt. The default is '%s', which
provides 31 characters of salt.
.TP
.BI \-n
Omit the trailing newline; useful to pipe the credentials
into a command.
.SH LIMITATIONS
The practice storing hashed passwords in userPassword violates
Standard Track (RFC 2256) schema specifications and may hinder
...
...
servers/slapd/slappasswd.c
View file @
914bf992
...
...
@@ -48,6 +48,7 @@ usage(const char *s)
" -c format
\t
crypt(3) salt format
\n
"
" -g
\t\t
generate random password
\n
"
" -h hash
\t
password scheme
\n
"
" -n
\t\t
omit trailing newline
\n
"
" -s secret
\t
new password
\n
"
" -u
\t\t
generate RFC2307 values (default)
\n
"
" -v
\t\t
increase verbosity
\n
"
...
...
@@ -73,11 +74,12 @@ slappasswd( int argc, char *argv[] )
const
char
*
progname
=
"slappasswd"
;
int
i
;
char
*
newline
=
"
\n
"
;
struct
berval
passwd
=
BER_BVNULL
;
struct
berval
hash
;
while
(
(
i
=
getopt
(
argc
,
argv
,
"c:d:gh:s:T:vu"
))
!=
EOF
)
"c:d:gh:
n
s:T:vu"
))
!=
EOF
)
{
switch
(
i
)
{
case
'c'
:
/* crypt salt format */
...
...
@@ -110,6 +112,10 @@ slappasswd( int argc, char *argv[] )
}
break
;
case
'n'
:
newline
=
""
;
break
;
case
's'
:
/* new password (secret) */
if
(
pwfile
!=
NULL
)
{
fprintf
(
stderr
,
"Option -s incompatible with -T
\n
"
);
...
...
@@ -178,9 +184,8 @@ slappasswd( int argc, char *argv[] )
passwd
.
bv_val
=
newpw
;
passwd
.
bv_len
=
strlen
(
passwd
.
bv_val
);
}
else
{
/* Omit trailing newline so it may be directed to a pwfile */
printf
(
"%s"
,
passwd
.
bv_val
);
return
EXIT_SUCCESS
;
hash
=
passwd
;
goto
print_pw
;
}
lutil_passwd_hash
(
&
passwd
,
scheme
,
&
hash
,
&
text
);
...
...
@@ -197,6 +202,7 @@ slappasswd( int argc, char *argv[] )
return
EXIT_FAILURE
;
}
printf
(
"%s
\n
"
,
hash
.
bv_val
);
print_pw:
;
printf
(
"%s%s"
,
hash
.
bv_val
,
newline
);
return
EXIT_SUCCESS
;
}
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