You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by nd...@apache.org on 2004/04/24 20:56:00 UTC

cvs commit: httpd-2.0/support htpasswd.c

nd          2004/04/24 11:56:00

  Modified:    .        CHANGES
               support  htpasswd.c
  Log:
  no longer refuse to process files that contain empty lines
  
  Revision  Changes    Path
  1.1470    +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1469
  retrieving revision 1.1470
  diff -u -u -r1.1469 -r1.1470
  --- CHANGES	24 Apr 2004 11:53:37 -0000	1.1469
  +++ CHANGES	24 Apr 2004 18:55:59 -0000	1.1470
  @@ -2,6 +2,9 @@
   
     [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]
   
  
  
  
  1.76      +8 -3      httpd-2.0/support/htpasswd.c
  
  Index: htpasswd.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/support/htpasswd.c,v
  retrieving revision 1.75
  retrieving revision 1.76
  diff -u -u -r1.75 -r1.76
  --- htpasswd.c	13 Mar 2004 22:18:19 -0000	1.75
  +++ htpasswd.c	24 Apr 2004 18:56:00 -0000	1.76
  @@ -394,7 +394,7 @@
       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 @@
           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.
                */