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.3/src/main rfc1413.c
Date Mon, 18 May 1998 21:56:13 GMT
brian       98/05/18 14:56:12

  Modified:    src      CHANGES
               src/main rfc1413.c
  Log:
  Improve RFC1413 support.
  See Message-ID: <Pine.BSF.3.95.980513104320.974R-100000@alive.znep.com>
  
  Revision  Changes    Path
  1.852     +2 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.851
  retrieving revision 1.852
  diff -u -r1.851 -r1.852
  --- CHANGES	1998/05/18 11:24:19	1.851
  +++ CHANGES	1998/05/18 21:56:06	1.852
  @@ -1,5 +1,7 @@
   Changes with Apache 1.3b7
   
  +  *) Improve RFC1413 support. [Bob Beck <beck@bofh.ucs.ualberta.ca>]
  +
     *) Fix support script `dbmmanage': It was unable to handle some sort
        of passwords, especially passwords with "0" chars.
        [Ralf S. Engelschall] PR#2242
  
  
  
  1.24      +32 -18    apache-1.3/src/main/rfc1413.c
  
  Index: rfc1413.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/rfc1413.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- rfc1413.c	1998/04/11 12:00:31	1.23
  +++ rfc1413.c	1998/05/18 21:56:11	1.24
  @@ -103,7 +103,8 @@
   /* bind_connect - bind both ends of a socket */
   /* Ambarish fix this. Very broken */
   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;
  @@ -144,30 +145,43 @@
   /* send the data */
       buflen = ap_snprintf(buffer, sizeof(buffer), "%u,%u\r\n", ntohs(rmt_sin->sin_port),
   		ntohs(our_sin->sin_port));
  -    do
  -	i = write(sock, buffer, buflen);
  -    while (i == -1 && errno == EINTR);
  -    if (i == -1) {
  -	ap_log_error(APLOG_MARK, APLOG_CRIT, srv,
  -		    "write: rfc1413: error sending request");
  -	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) {
  +	  ap_log_error(APLOG_MARK, APLOG_CRIT, srv,
  +		       "write: rfc1413: error sending request");
  +	  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) {
  -	ap_log_error(APLOG_MARK, APLOG_CRIT, srv,
  -		    "read: rfc1413: error reading response");
  -	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) {
  +	   ap_log_error(APLOG_MARK, APLOG_CRIT, srv,
  +			"read: rfc1413: error reading response");
  +	   return -1;
  +	}
  +	else if (j > 0) {
  +	    i+=j; 
  +	}
       }
   
  -    buffer[i] = '\0';
   /* RFC1413_USERLEN = 512 */
       if (sscanf(buffer, "%u , %u : USERID :%*[^:]:%512s", &rmt_port, &our_port,
   	       user) != 3 || ntohs(rmt_sin->sin_port) != rmt_port
  
  
  

Mime
View raw message