]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/daemon.c
reject registrations when back-monitor is not configured
[openldap] / servers / slapd / daemon.c
index 716123f73bdc8ac983579803eb1607e5251c261f..a0125a19fc1248ba7f919d56d4112b8515d75805 100644 (file)
@@ -40,8 +40,6 @@
 
 #include "ldap_rq.h"
 
-#undef HAVE_EPOLL
-
 #if defined(HAVE_SYS_EPOLL_H) && defined(HAVE_EPOLL)
 #include <sys/epoll.h>
 #endif
@@ -1362,14 +1360,14 @@ slapd_handle_listener(
 
                        if( getpeereid( s, &uid, &gid ) == 0 ) {
                                authid.bv_val = ch_malloc(
-                                       STRLENOF( "uidNumber=4294967295+gidNumber=4294967295,"
+                                       STRLENOF( "gidNumber=4294967295+uidNumber=4294967295,"
                                        "cn=peercred,cn=external,cn=auth" ) + 1 );
                                authid.bv_len = sprintf( authid.bv_val,
-                                       "uidNumber=%d+gidNumber=%d,"
+                                       "gidNumber=%d+uidNumber=%d,"
                                        "cn=peercred,cn=external,cn=auth",
                                        (int) gid, (int) uid );
                                assert( authid.bv_len <=
-                                       STRLENOF( "uidNumber=4294967295+gidNumber=4294967295,"
+                                       STRLENOF( "gidNumber=4294967295+uidNumber=4294967295,"
                                        "cn=peercred,cn=external,cn=auth" ) );
                        }
                }
@@ -1574,7 +1572,10 @@ slapd_daemon_task(
                ber_socket_t i;
                int ns, nwriters;
                int at;
-               ber_socket_t nfds, nrfds, nwfds;
+               ber_socket_t nfds;
+#if SLAP_EVENTS_ARE_INDEXED
+               ber_socket_t nrfds, nwfds;
+#endif
 #define SLAPD_EBADF_LIMIT 16
 
                time_t  now;
@@ -1758,8 +1759,6 @@ slapd_daemon_task(
                        if ( !SLAP_EVENT_IS_READ( slap_listeners[l]->sl_sd ))
                                continue;
                        
-                       ns--;
-
                        rc = slapd_handle_listener(slap_listeners[l]);
 
 #ifdef LDAP_CONNECTIONLESS
@@ -1767,6 +1766,8 @@ slapd_daemon_task(
                        if ( rc ) continue;
 #endif
 
+                       ns--;
+
                        /* Don't need to look at this in the data loops */
                        SLAP_EVENT_CLR_READ( slap_listeners[l]->sl_sd );
                        SLAP_EVENT_CLR_WRITE( slap_listeners[l]->sl_sd );
@@ -1917,6 +1918,10 @@ slapd_daemon_task(
 #endif
                         ) continue;
 
+                       /* Don't log internal wake events */
+                       if ( SLAP_EVENT_FD( i ) == wake_sds[0] )
+                               continue;
+
                        r = SLAP_EVENT_IS_READ( i );
                        w = SLAP_EVENT_IS_WRITE( i );
                        if ( r || w ) {
@@ -1938,6 +1943,10 @@ slapd_daemon_task(
                        if ( rc ) {
                                fd = SLAP_EVENT_FD( i );
 
+                               /* Ignore wake events, they were handled above */
+                               if ( fd == wake_sds[0] )
+                                       continue;
+
                                if( SLAP_EVENT_IS_WRITE( i ) ) {
                                        Debug( LDAP_DEBUG_CONNS,
                                                "daemon: write active on %d\n",