diff options
author | Joe Orton <jorton@apache.org> | 2017-10-20 15:40:37 +0000 |
---|---|---|
committer | Joe Orton <jorton@apache.org> | 2017-10-20 15:40:37 +0000 |
commit | a4099762df4f72c71f30dee739d4734aa2bd552d (patch) | |
tree | 4b40465a98fdd3e45e2ad59105d6f4aea4a0751f /support/htpasswd.c | |
parent | 483c751b71b767b4b15e62b5accf84210716ab49 (diff) | |
download | httpd-a4099762df4f72c71f30dee739d4734aa2bd552d.tar.gz |
* support/htpasswd.c (main): Only check for readability if running in
verify (-v) mode.
PR: 61631
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1812756 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'support/htpasswd.c')
-rw-r--r-- | support/htpasswd.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/support/htpasswd.c b/support/htpasswd.c index 65a0b9c3bb..660a27c792 100644 --- a/support/htpasswd.c +++ b/support/htpasswd.c @@ -329,7 +329,7 @@ int main(int argc, const char * const argv[]) */ if (!(mask & APHTP_NOFILE)) { existing_file = exists(pwfilename, pool); - if (existing_file) { + if (existing_file && (mask & APHTP_VERIFY) == 0) { /* * Check that this existing file is readable and writable. */ @@ -339,6 +339,16 @@ int main(int argc, const char * const argv[]) exit(ERR_FILEPERM); } } + else if (existing_file && (mask & APHTP_VERIFY) != 0) { + /* + * Check that this existing file is readable. + */ + if (!accessible(pool, pwfilename, APR_FOPEN_READ)) { + apr_file_printf(errfile, "%s: cannot open file %s for " + "read access" NL, argv[0], pwfilename); + exit(ERR_FILEPERM); + } + } else { /* * Error out if -c was omitted for this non-existant file. |