You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Aram W. Mirzadeh" <aw...@qosina.com> on 1995/08/31 17:54:12 UTC

Re: linux - apache - another patch

Here is a patch that will help with the linux problems.  
The requirements for LINUX should be changed on
hyperreal to the following: 

linux 1.2.11+ kernel ( 1.2.13 recommended ) 
libc 4.6.27 ( recommended 4.7.2 ) 
                        ^^^^^^^^^^^^^^^^^^
        There is a serious security bug in previous versions
        of libc.  This should be brough up to the attention of
        all BSD users as well.  If anyone is interested I have
        the cern mailing about this. 

Could someone try this on another platform other than Linux
BSD, and OSF/1 and make sure it doesn't break anything else.

Thank you.
<Aram>

--- http_main.c.orig	Wed Aug 30 21:23:16 1995
+++ http_main.c	Thu Aug 31 11:10:10 1995
@@ -201,6 +201,17 @@
 #define accept_mutex_off()
 #endif
 
+#ifdef INTERRUPT_ACCEPT
+
+void            	alarm_catcher(sig)
+int                     sig;
+{
+    return;
+}
+#endif
+
+
+
 void usage(char *bin)
 {
     fprintf(stderr,"Usage: %s [-d directory] [-f file] [-v]\n",bin);
@@ -753,9 +764,36 @@
 	
 	accept_mutex_on();  /* Lock around "accept", if necessary */
 	
-	while ((csd=accept(sd,(struct sockaddr *)&sa_client,&clen)) == -1) 
-           if (errno != EINTR) 
-		log_error("socket error: accept failed", server_conf);
+	while (1) {
+
+#ifdef INTERRUPT_ACCEPT
+	    int         oflags;
+	    void        (*ohandler)();
+	    int         oerrno;
+	    unsigned    osec;
+
+	    osec = alarm(0);
+	    ohandler = signal(SIGALRM, alarm_catcher);
+	    (void)alarm(1);
+#endif
+
+	    csd = accept(sd,(struct sockaddr *)&sa_client,&clen);
+
+#ifdef INTERRUPT_ACCEPT
+	    oerrno = errno;
+	    (void) alarm(0);
+	    (void) signal(SIGALRM, ohandler);
+	    (void) alarm(osec);
+	    errno = oerrno;
+#endif
+
+	    if(csd < 0) {
+		if (errno != EINTR)
+		    log_error("socket error: accept failed", server_conf);
+	    }
+	    else
+		break;
+	}
 
 	accept_mutex_off(); /* unlock after "accept" */


-- 
Michael Davon                       617-227-7735 Tel
Davon@Web-Depot.Com                 617-720-2607 Fax
http://www.web-depot.com/~davon

--
Aram W. Mirzadeh, MIS Manager, Qosina Corporation
http://www.qosina.com/~awm/, awm@qosina.com
Apache httpd server team http://www.apache.org