]> granicus.if.org Git - apache/commitdiff
no longer refuse to process files that contain empty lines
authorAndré Malo <nd@apache.org>
Sat, 24 Apr 2004 18:56:00 +0000 (18:56 +0000)
committerAndré Malo <nd@apache.org>
Sat, 24 Apr 2004 18:56:00 +0000 (18:56 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103507 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
support/htpasswd.c

diff --git a/CHANGES b/CHANGES
index 05cdd4fa210b55c937d6a891ac9670a52bb2a78b..e6b094780dea2b46e591b5ba06a1b1875e6f09cd 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) htpasswd no longer refuses to process files that contain empty
+     lines.  [André Malo]
+
   *) Restore the ability to disable the use of AcceptEx on Win9x systems
      automatically. PR 28529.  [André Malo]
 
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.
              */