htpasswd: Add -v option to verify a password

htpasswd and htdbm could use some more refactoring...


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1465116 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Fritsch
2013-04-05 20:20:33 +00:00
parent e84335b00d
commit b02101b083
5 changed files with 116 additions and 50 deletions

View File

@ -103,6 +103,8 @@ static int generate_salt(char *s, size_t size, const char **errstr,
void putline(apr_file_t *f, const char *l)
{
apr_status_t rv;
if (f == NULL)
return;
rv = apr_file_puts(l, f);
if (rv != APR_SUCCESS) {
apr_file_printf(errfile, "Error writing temp file: %pm", &rv);
@ -135,6 +137,12 @@ int get_password(struct passwd_ctx *ctx)
apr_file_close(file_stdin);
ctx->passwd = apr_pstrdup(ctx->pool, buf);
}
else if (ctx->passwd_src == PW_PROMPT_VERIFY) {
apr_size_t bufsize = sizeof(buf);
if (apr_password_get("Enter password: ", buf, &bufsize) != 0)
goto err_too_long;
ctx->passwd = apr_pstrdup(ctx->pool, buf);
}
else {
apr_size_t bufsize = sizeof(buf);
if (apr_password_get("New password: ", buf, &bufsize) != 0)