diff options
author | Stefan Fritsch <sf@apache.org> | 2013-04-05 20:20:33 +0000 |
---|---|---|
committer | Stefan Fritsch <sf@apache.org> | 2013-04-05 20:20:33 +0000 |
commit | b02101b083aad839c4b5427f435d4de27498e935 (patch) | |
tree | 92fd8ffd1cc53858c7bbe2eb18805b677fea9653 /support/passwd_common.c | |
parent | e84335b00da02b4b85031dcd029a4cdbe0492e1a (diff) | |
download | httpd-b02101b083aad839c4b5427f435d4de27498e935.tar.gz |
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
Diffstat (limited to 'support/passwd_common.c')
-rw-r--r-- | support/passwd_common.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/support/passwd_common.c b/support/passwd_common.c index 95612b70c3..c03242be2f 100644 --- a/support/passwd_common.c +++ b/support/passwd_common.c @@ -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) |