static struct slap_daemon {
ldap_pvt_thread_mutex_t sd_mutex;
+#ifdef HAVE_TCPD
+ ldap_pvt_thread_mutex_t tcpd_mutex;
+#endif
ber_socket_t sd_nactives;
int sd_nwriters;
ldap_charray_free( u );
ldap_pvt_thread_mutex_init( &slap_daemon.sd_mutex );
+#ifdef HAVE_TCPD
+ ldap_pvt_thread_mutex_init( &slap_daemon.tcpd_mutex );
+#endif
+
return !i;
}
}
#endif
+#ifdef HAVE_TCPD
+ ldap_pvt_thread_mutex_destroy( &slap_daemon.tcpd_mutex );
+#endif
+
+ ldap_pvt_thread_mutex_destroy( &slap_daemon.sd_mutex );
return 0;
}
#endif /* SLAPD_RLOOKUPS */
#ifdef HAVE_TCPD
- if ( !hosts_ctl("slapd",
- dnsname != NULL ? dnsname : SLAP_STRING_UNKNOWN,
- peeraddr != NULL ? peeraddr : SLAP_STRING_UNKNOWN,
- SLAP_STRING_UNKNOWN ))
{
- /* DENY ACCESS */
- Statslog( LDAP_DEBUG_STATS,
- "fd=%ld DENIED from %s (%s)\n",
- (long) s,
+ int rc;
+ ldap_pvt_thread_mutex_lock( &slap_daemon.tcpd_mutex );
+ rc = hosts_ctl("slapd",
dnsname != NULL ? dnsname : SLAP_STRING_UNKNOWN,
peeraddr != NULL ? peeraddr : SLAP_STRING_UNKNOWN,
- 0, 0 );
- slapd_close(s);
- return 0;
+ SLAP_STRING_UNKNOWN );
+ ldap_pvt_thread_mutex_unlock( &slap_daemon.tcpd_mutex );
+ if ( !rc ) {
+ /* DENY ACCESS */
+ Statslog( LDAP_DEBUG_STATS,
+ "fd=%ld DENIED from %s (%s)\n",
+ (long) s,
+ dnsname != NULL ? dnsname : SLAP_STRING_UNKNOWN,
+ peeraddr != NULL ? peeraddr : SLAP_STRING_UNKNOWN,
+ 0, 0 );
+ slapd_close(s);
+ return 0;
+ }
}
#endif /* HAVE_TCPD */
}