]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
htpasswd should not refuse to process files containing empty lines.
authorAndré Malo <nd@apache.org>
Wed, 26 May 2004 23:14:04 +0000 (23:14 +0000)
committerAndré Malo <nd@apache.org>
Wed, 26 May 2004 23:14:04 +0000 (23:14 +0000)
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

CHANGES
STATUS
support/htpasswd.c

diff --git a/CHANGES b/CHANGES
index 266a45d526c71225ace173e6295d9c185777813c..b8c63ad0faf2277bdf66ce8ffae5c645f6793cd5 100644 (file)
--- 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 9e24fc6a9378a0e2560bccf52a41026cf70c4348..5978ecff1aa41eeb0a865897161973516d6b384b 100644 (file)
--- 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
index 16d83d7b830a80ae05a3241b118b7c5b7bd64179..3675c52b46b1bad5ff8e2686324351f7e97b9aaa 100644 (file)
@@ -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.
              */