From: André Malo Date: Wed, 26 May 2004 23:14:04 +0000 (+0000) Subject: htpasswd should not refuse to process files containing empty lines. X-Git-Tag: 2.0.50~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=546c2e87226a82fddbe2979d2f8bb7f3bd51360e;p=thirdparty%2Fapache%2Fhttpd.git htpasswd should not refuse to process files containing empty lines. Reviewed by: Jeff Trawick, Brad Nicholes git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@103789 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 266a45d526c..b8c63ad0faf 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,8 @@ Changes with Apache 2.0.50 + *) htpasswd no longer refuses to process files that contain empty + lines. [André Malo] + *) Regression from 1.3: At startup, suexec now will be checked for availability, the setuid bit and user root. The works only if httpd is compiled with the shipped APR version (0.9.5). diff --git a/STATUS b/STATUS index 9e24fc6a937..5978ecff1aa 100644 --- a/STATUS +++ b/STATUS @@ -1,5 +1,5 @@ APACHE 2.0 STATUS: -*-text-*- -Last modified at [$Date: 2004/05/26 23:03:12 $] +Last modified at [$Date: 2004/05/26 23:14:03 $] Release: @@ -127,10 +127,6 @@ PATCHES TO BACKPORT FROM 2.1 modules/mappers/mod_actions.c: r1.32, r1.34 +1: nd - *) htpasswd should not refuse to process files containing empty lines. - support/htpasswd.c: r1.76 - +1: nd, trawick, bnicholes - *) Disable AcceptEx on Win9x systems automatically. (broken in 2.0.49) PR 28529 server/mpm/winnt/mpm_winnt.c: 1.311 diff --git a/support/htpasswd.c b/support/htpasswd.c index 16d83d7b830..3675c52b46b 100644 --- a/support/htpasswd.c +++ b/support/htpasswd.c @@ -394,7 +394,7 @@ int main(int argc, const char * const argv[]) char *user = NULL; char tn[] = "htpasswd.tmp.XXXXXX"; char *dirname; - char scratch[MAX_STRING_LEN]; + char *scratch, cp[MAX_STRING_LEN]; int found = 0; int i; int alg = ALG_CRYPT; @@ -533,11 +533,16 @@ int main(int argc, const char * const argv[]) while (apr_file_gets(line, sizeof(line), fpw) == APR_SUCCESS) { char *colon; - if ((line[0] == '#') || (line[0] == '\0')) { + strcpy(cp, line); + scratch = cp; + while (apr_isspace(*scratch)) { + ++scratch; + } + + if (!*scratch || (*scratch == '#')) { putline(ftemp, line); continue; } - strcpy(scratch, line); /* * See if this is our user. */