httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@apache.org
Subject cvs commit: httpd-2.0/support htdigest.c
Date Sun, 10 Jun 2001 21:01:57 GMT
stoddard    01/06/10 14:01:57

  Modified:    .        CHANGES
               support  htdigest.c
  Log:
  Fix look in htdigest.  Reimplemented getline to work properly with
  APR. Shuld consider adding apr_file_getline() to APR.  Should also consider
  changing apr_file_getc() to return characters rather than apr_status.
  
  Revision  Changes    Path
  1.222     +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.221
  retrieving revision 1.222
  diff -u -r1.221 -r1.222
  --- CHANGES	2001/06/10 20:11:31	1.221
  +++ CHANGES	2001/06/10 21:01:56	1.222
  @@ -1,5 +1,8 @@
   Changes with Apache 2.0.19-dev
   
  +  *) Fix htdigest. It would go into a loop in getline when adding 
  +     a second user. [Bill Stoddard]
  +
     *) Win32 platforms now fully support mod_userdir options.  [Will Rowe]
   
     *) Automatically generate httpd.exp for AIX.
  
  
  
  1.25      +11 -16    httpd-2.0/support/htdigest.c
  
  Index: htdigest.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/support/htdigest.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- htdigest.c	2001/05/21 19:17:20	1.24
  +++ htdigest.c	2001/06/10 21:01:57	1.25
  @@ -122,24 +122,20 @@
   {
       register int i = 0;
       char ch;
  +    apr_status_t rv;
   
  -    while (1) {
  -	apr_file_getc(&ch, f);
  -            s[i] = ch;
  +    while (i < (n - 1) && 
  +           ((rv = apr_file_getc(&ch, f)) == APR_SUCCESS) && (ch != '\n')) {
  +        s[i++] = ch;
  +    }
  +    if (ch == '\n')
  +        s[i++] = ch;
  +    s[i] = '\0';
   
  -	if (s[i] == CR)
  -	    apr_file_getc(&ch, f);
  -            s[i] = ch;
  +    if (rv != APR_SUCCESS) 
  +        return 1;
   
  -	if ((s[i] == 0x4) || (s[i] == LF) || (i == (n - 1))) {
  -	    s[i] = '\0';
  -            if (apr_file_eof(f) == APR_EOF) {
  -                return 1;
  -            }
  -            return 0;
  -	}
  -	++i;
  -    }
  +    return 0;
   }
   
   static void putline(apr_file_t *f, char *l)
  @@ -148,7 +144,6 @@
   
       for (x = 0; l[x]; x++)
   	apr_file_putc(l[x], f);
  -    apr_file_putc('\n', f);
   }
   
   
  
  
  

Mime
View raw message