httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@hyperreal.org
Subject cvs commit: apache-1.2/src CHANGES rfc1413.c
Date Mon, 18 May 1998 21:49:28 GMT
brian       98/05/18 14:49:28

  Modified:    src      CHANGES rfc1413.c
  Log:
  See Message-ID: <Pine.BSF.3.95.980513104320.974R-100000@alive.znep.com>
  
  Revision  Changes    Path
  1.309     +2 -0      apache-1.2/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache-1.2/src/CHANGES,v
  retrieving revision 1.308
  retrieving revision 1.309
  diff -u -r1.308 -r1.309
  --- CHANGES	1998/05/11 19:56:04	1.308
  +++ CHANGES	1998/05/18 21:49:26	1.309
  @@ -1,5 +1,7 @@
   Changes with Apache 1.2.7
   
  +  *) Improve RFC1413 support. [Bob Beck <beck@bofh.ucs.ualberta.ca>]
  +
     *) Support for NCR MP/RAS 3.0 [John Withers <withers@semi.kcsc.mwr.irs.gov>]
   
     *) Correct a protocol issue - always send the "Accept-ranges: bytes"
  
  
  
  1.13      +31 -17    apache-1.2/src/rfc1413.c
  
  Index: rfc1413.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.2/src/rfc1413.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- rfc1413.c	1998/04/13 11:45:48	1.12
  +++ rfc1413.c	1998/05/18 21:49:27	1.13
  @@ -108,7 +108,8 @@
   
   static int
   get_rfc1413(int sock, const struct sockaddr_in *our_sin,
  -	  const struct sockaddr_in *rmt_sin, char user[256], server_rec *srv)
  +	    const struct sockaddr_in *rmt_sin, char user[RFC1413_USERLEN+1], 
  +	    server_rec *srv)
   {
       struct sockaddr_in rmt_query_sin, our_query_sin;
       unsigned int rmt_port, our_port;
  @@ -148,29 +149,42 @@
   /* send the data */
       ap_snprintf(buffer, sizeof(buffer), "%u,%u\r\n", ntohs(rmt_sin->sin_port),
   	    ntohs(our_sin->sin_port));
  -    do i = write(sock, buffer, strlen(buffer));
  -    while (i == -1 && errno == EINTR);
  -    if (i == -1)
  -    {
  -	log_unixerr("write", NULL, "rfc1413: error sending request", srv);
  -	return -1;
  +
  +    /* send query to server. Handle short write. */
  +    i = 0;
  +    while(i < strlen(buffer)) {
  +        int j;
  +        j = write(sock, buffer+i, (strlen(buffer+i)));
  +        if (j < 0 && errno != EINTR) {
  +	    log_unixerr("write", NULL, "rfc1413: error sending request", srv);
  +	    return -1;
  +	}
  +	else if (j > 0) {
  +	    i+=j; 
  +	}
       }
   
       /*
  -     * Read response from server. We assume that all the data
  -     * comes in a single packet.
  +     * Read response from server. - the response should be newline 
  +     * terminated according to rfc - make sure it doesn't stomp it's
  +     * way out of the buffer.
        */
       
  -    do i = read(sock, buffer, RFC1413_MAXDATA);
  -    while (i == -1 && errno == EINTR);
  -    if (i == -1)
  -    {
  -	log_unixerr("read", NULL, "rfc1413: error reading response", srv);
  -	return -1;
  +    i = 0;
  +    memset(buffer, 0, sizeof(buffer));
  +    while((cp = strchr(buffer, '\n')) == NULL && i < sizeof(buffer) - 1) {
  +        int j;
  +	j = read(sock, buffer+i, (sizeof(buffer) - 1) - i);
  +	if (j < 0 && errno != EINTR) {
  +	    log_unixerr("read", NULL, "rfc1413: error reading response", srv);
  +	    return -1;
  +	}
  +	else if (j > 0) {
  +	    i+=j; 
  +	}
       }
   
  -    buffer[i] = '\0';
  -/* RFC1413_USERLEN = 512 */
  +    /* RFC1413_USERLEN = 512 */
       if (sscanf(buffer, "%u , %u : USERID :%*[^:]:%512s", &rmt_port, &our_port,
   	       user) != 3 || ntohs(rmt_sin->sin_port) != rmt_port
   	|| ntohs(our_sin->sin_port) != our_port) return -1;
  
  
  

Mime
View raw message