mirror of
https://github.com/apache/httpd.git
synced 2025-07-25 17:01:22 +00:00
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:
@ -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)
|
||||
|
Reference in New Issue
Block a user