summaryrefslogtreecommitdiff
path: root/chat/jabberd/patches/patch-ad
blob: 1b2d65032c8dd35b95dfdc7cbbb2bebb97e875eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$NetBSD: patch-ad,v 1.4 2010/05/04 18:33:35 gdt Exp $

--- jabberd/mio_ssl.c.orig	2002-02-08 07:39:27.000000000 +0000
+++ jabberd/mio_ssl.c
@@ -63,6 +63,7 @@ void mio_ssl_init(xmlnode x)
 
     log_debug(ZONE, "Handling configuration using: %s", xmlnode2str(x));
     /* Generic SSL Inits */
+    SSL_library_init();
 	OpenSSL_add_all_algorithms();    
     SSL_load_error_strings();
 
@@ -219,6 +220,15 @@ int _mio_ssl_accept(mio m, struct sockad
     SSL_CTX *ctx = NULL;
     int fd;
     int sret;
+    int flags;
+
+    fd = accept(m->fd, serv_addr, addrlen);
+
+    /* set the socket to non-blocking as this is not
+       inherited */
+    flags =  fcntl(fd, F_GETFL, 0);
+    flags |= O_NONBLOCK;
+    fcntl(fd, F_SETFL, flags);
 
     if(m->ip == NULL)
     {
@@ -226,8 +236,6 @@ int _mio_ssl_accept(mio m, struct sockad
         return -1;
     }
 
-    fd = accept(m->fd, serv_addr, addrlen);
-    
     ctx = ghash_get(ssl__ctxs, m->ip);
     if(ctx == NULL)
     {