httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bnicho...@apache.org
Subject cvs commit: apache-1.3/src CHANGES
Date Thu, 18 Sep 2003 18:54:27 GMT
bnicholes    2003/09/18 11:54:27

  Modified:    src/main rfc1413.c
               src      CHANGES
  Log:
  Enabled the RFC1413 ident functionality for Win32 and NetWare.  Also introduced
  a thread-safe socket timeout alternative that can be adapted for other non-winsock
  platforms
  
  Revision  Changes    Path
  1.44      +47 -6     apache-1.3/src/main/rfc1413.c
  
  Index: rfc1413.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/rfc1413.c,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- rfc1413.c	16 Sep 2003 23:26:18 -0000	1.43
  +++ rfc1413.c	18 Sep 2003 18:54:26 -0000	1.44
  @@ -99,6 +99,38 @@
   
   int ap_rfc1413_timeout = RFC1413_TIMEOUT;	/* Global so it can be changed */
   
  +#if (defined (NETWARE) || defined (WIN32))
  +#define write(a,b,c) send(a,b,c,0)
  +#define read(a,b,c) recv(a,b,c,0)
  +#endif
  +
  +#ifdef MULTITHREAD
  +#define RFC_USER_STATIC 
  +
  +static int setsocktimeout (int sock, int timeout)
  +{
  +#if (defined (NETWARE) || defined (WIN32))
  +    u_long msec = 0;
  +
  +    /* Make sure that we are in blocking mode */
  +    if (ioctlsocket(sock, FIONBIO, &msec) == SOCKET_ERROR) {
  +        return h_errno;
  +    }
  +
  +    /* Win32 timeouts are in msec, represented as int */
  +    msec = timeout * 1000;
  +    setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, 
  +               (char *) &msec, sizeof(msec));
  +    setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, 
  +               (char *) &msec, sizeof(msec));
  +#else
  +    //XXX Needs to be implemented for non-winsock platforms
  +#endif
  +    return 0;
  +}
  +#else /* MULTITHREAD */
  +
  +#define RFC_USER_STATIC static
   static JMP_BUF timebuf;
   
   /* ident_timeout - handle timeouts */
  @@ -106,6 +138,7 @@
   {
       ap_longjmp(timebuf, sig);
   }
  +#endif
   
   /* bind_connect - bind both ends of a socket */
   /* Ambarish fix this. Very broken */
  @@ -237,22 +270,28 @@
   /* rfc1413 - return remote user name, given socket structures */
   API_EXPORT(char *) ap_rfc1413(conn_rec *conn, server_rec *srv)
   {
  -    static char user[RFC1413_USERLEN + 1];	/* XXX */
  -    static char *result;
  -    static int sock;
  +    RFC_USER_STATIC char user[RFC1413_USERLEN + 1];	/* XXX */
  +    RFC_USER_STATIC char *result;
  +    RFC_USER_STATIC int sock;
   
       result = FROM_UNKNOWN;
   
       sock = ap_psocket_ex(conn->pool, AF_INET, SOCK_STREAM, IPPROTO_TCP, 1);
       if (sock < 0) {
  -	ap_log_error(APLOG_MARK, APLOG_CRIT, srv,
  -		    "socket: rfc1413: error creating socket");
  -	conn->remote_logname = result;
  +    	ap_log_error(APLOG_MARK, APLOG_CRIT, srv,
  +    		    "socket: rfc1413: error creating socket");
  +    	conn->remote_logname = result;
       }
   
       /*
        * Set up a timer so we won't get stuck while waiting for the server.
        */
  +#ifdef MULTITHREAD
  +    if (setsocktimeout(sock, ap_rfc1413_timeout) == 0) {
  +        if (get_rfc1413(sock, &conn->local_addr, &conn->remote_addr, user,
srv) >= 0)
  +            result = ap_pstrdup (conn->pool, user);
  +    }
  +#else
       if (ap_setjmp(timebuf) == 0) {
   	ap_set_callback_and_alarm(ident_timeout, ap_rfc1413_timeout);
   
  @@ -260,8 +299,10 @@
   	    result = user;
       }
       ap_set_callback_and_alarm(NULL, 0);
  +#endif
       ap_pclosesocket(conn->pool, sock);
       conn->remote_logname = result;
   
       return conn->remote_logname;
   }
  +
  
  
  
  1.1905    +6 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1904
  retrieving revision 1.1905
  diff -u -r1.1904 -r1.1905
  --- CHANGES	2 Sep 2003 18:17:04 -0000	1.1904
  +++ CHANGES	18 Sep 2003 18:54:26 -0000	1.1905
  @@ -1,5 +1,11 @@
   Changes with Apache 1.3.29
   
  +  *) Enabled RFC1413 ident functionality for both Win32 and
  +     NetWare platforms.  This also included an alternate thread safe
  +     implementation of the socket timout functionality when querying
  +     the identd daemon.
  +     [Brad Nicholes, William Rowe]
  +     
     *) Prevent creation of subprocess Zombies when using CGI wrappers
        such as suExec and cgiwrap. PR 21737. [Numerous]
   
  
  
  

Mime
View raw message