mirror of
https://github.com/rfc1036/whois.git
synced 2026-05-03 06:51:09 +00:00
mkpasswd: implement a generic way to provide the hash type
This commit is contained in:
parent
80c36bb8e5
commit
4d24d493ff
@ -25,6 +25,8 @@ The behavior is undefined if this option is used without \fI--method\fP.
|
|||||||
.B -m, --method=TYPE
|
.B -m, --method=TYPE
|
||||||
Compute the password using the \fITYPE\fP method.
|
Compute the password using the \fITYPE\fP method.
|
||||||
If \fITYPE\fP is \fIhelp\fP then the available methods are printed.
|
If \fITYPE\fP is \fIhelp\fP then the available methods are printed.
|
||||||
|
If \fITYPE\fP begins and end with \fI$\fP characters then the string
|
||||||
|
is passed to \fIcrypt_gensalt(3)\fP as-is.
|
||||||
.TP
|
.TP
|
||||||
.B -5
|
.B -5
|
||||||
Like \fI--method=md5\fP.
|
Like \fI--method=md5\fP.
|
||||||
@ -50,6 +52,8 @@ This programs suffers of a bad case of featuritis.
|
|||||||
.IR passwd(1),
|
.IR passwd(1),
|
||||||
.IR passwd(5),
|
.IR passwd(5),
|
||||||
.IR crypt(3),
|
.IR crypt(3),
|
||||||
|
.IR crypt(5),
|
||||||
|
.IR crypt_gensalt(3),
|
||||||
.IR getpass(3)
|
.IR getpass(3)
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
.B mkpasswd
|
.B mkpasswd
|
||||||
|
|||||||
11
mkpasswd.c
11
mkpasswd.c
@ -181,6 +181,17 @@ int main(int argc, char *argv[])
|
|||||||
display_methods();
|
display_methods();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
#if defined HAVE_LINUX_CRYPT_GENSALT || defined HAVE_SOLARIS_CRYPT_GENSALT
|
||||||
|
if (optarg[0] == '$'
|
||||||
|
&& strlen(optarg) > 2
|
||||||
|
&& *(optarg + strlen(optarg) - 1) == '$') {
|
||||||
|
salt_prefix = NOFAIL(strdup(optarg));
|
||||||
|
salt_minlen = 0;
|
||||||
|
salt_maxlen = 0;
|
||||||
|
rounds_support = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
for (i = 0; methods[i].method != NULL; i++)
|
for (i = 0; methods[i].method != NULL; i++)
|
||||||
if (strcaseeq(methods[i].method, optarg)) {
|
if (strcaseeq(methods[i].method, optarg)) {
|
||||||
salt_prefix = methods[i].prefix;
|
salt_prefix = methods[i].prefix;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user