]> git.sur5r.net Git - openldap/commitdiff
+ Fixed slapd connectionless LDAP support
authorKurt Zeilenga <kurt@openldap.org>
Mon, 13 Feb 2006 21:02:53 +0000 (21:02 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 13 Feb 2006 21:02:53 +0000 (21:02 +0000)
CHANGES
servers/slapd/daemon.c

diff --git a/CHANGES b/CHANGES
index 3b1c01b5a6b7cb8297e903f4a12b7d297b37e802..5ed46b03babf25e640974643085992c3042ae2aa 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -8,6 +8,7 @@ OpenLDAP 2.3.20 Engineering
        Fixed slapd non-read/write epoll event handling (ITS#4395)
        Fixed slapd syncrepl de-normalize UUID issue
        Added slapd syncrepl log messages (ITS#4369)
+       Fixed slapd connectionless LDAP support
        Fixed slapd-bdb/hdb wake listener on runqueue submit (ITS#4385)
        Fixed slapo-auditlog crash (ITS#4394)
        Fixed slapo-accesslog unbind crash (ITS#4386)
index 41127d291c16c54ecc87518f2a05c7c4ab22300d..b1724ed3a140502547e7dcbdbf4582746a85e33b 100644 (file)
@@ -223,7 +223,7 @@ static struct slap_daemon {
 # define SLAP_EVENT_IS_READ(i) SLAP_CHK_EVENT((i), EPOLLIN)
 # define SLAP_EVENT_IS_WRITE(i)        SLAP_CHK_EVENT((i), EPOLLOUT)
 # define SLAP_EVENT_IS_LISTENER(i)     SLAP_EV_LISTENER(revents[(i)].data.ptr)
-# define SLAP_EVENT_LISTENER(i)        (revents[(i)].data.ptr)
+# define SLAP_EVENT_LISTENER(i)        ((Listener *)(revents[(i)].data.ptr))
 
 # define SLAP_EVENT_FD(i)      SLAP_EV_PTRFD(revents[(i)].data.ptr)
 
@@ -1106,21 +1106,6 @@ static int slap_open_listener(
                return -1;
        }
 
-#ifdef LDAP_CONNECTIONLESS
-       if( l.sl_is_udp ) {
-               long id = connection_init( l.sl_sd, &l, "", "", CONN_IS_UDP,
-                       (slap_ssf_t) 0, NULL );
-
-               if( id < 0 ) {
-                       Debug( LDAP_DEBUG_TRACE,
-                               "slap_open_listener: connectionless init failed on %s (%d)\n",
-                               url, l.sl_sd, 0 );
-                       return -1;
-               }
-               l.sl_is_udp++;
-       }
-#endif
-
        Debug( LDAP_DEBUG_TRACE, "daemon: listener initialized %s\n",
                l.sl_url.bv_val, 0, 0 );
        return 0;
@@ -1621,10 +1606,8 @@ slapd_daemon_task(
                 * listening port. The listen() and accept() calls
                 * are unnecessary.
                 */
-               if ( slap_listeners[l]->sl_is_udp ) {
-                       slapd_add( slap_listeners[l]->sl_sd, 1, slap_listeners[l] );
+               if ( slap_listeners[l]->sl_is_udp )
                        continue;
-               }
 #endif
 
                if ( listen( slap_listeners[l]->sl_sd, SLAPD_LISTEN_BACKLOG ) == -1 ) {
@@ -2201,11 +2184,41 @@ slapd_daemon_task(
 }
 
 
+#ifdef LDAP_CONNECTIONLESS
+static int connectionless_init(void)
+{
+       int l;
+
+       for ( l = 0; slap_listeners[l] != NULL; l++ ) {
+               Listener *lr = slap_listeners[l];
+               long id;
+
+               if( !lr->sl_is_udp ) {
+                       continue;
+               }
+
+               id = connection_init( lr->sl_sd, lr, "", "", CONN_IS_UDP, (slap_ssf_t) 0, NULL );
+
+               if( id < 0 ) {
+                       Debug( LDAP_DEBUG_TRACE,
+                               "connectionless_init: failed on %s (%d)\n", lr->sl_url, lr->sl_sd, 0 );
+                       return -1;
+               }
+               lr->sl_is_udp++;
+       }
+
+       return 0;
+}
+#endif /* LDAP_CONNECTIONLESS */
+
 int slapd_daemon( void )
 {
        int rc;
 
        connections_init();
+#ifdef LDAP_CONNECTIONLESS
+       connectionless_init();
+#endif
 
 #define SLAPD_LISTENER_THREAD 1
 #if defined( SLAPD_LISTENER_THREAD )