static char** slapd_srvurls = NULL;
static SLPHandle slapd_hslp = 0;
int slapd_register_slp = 0;
+char *slapd_slp_attrs = NULL;
+
+static SLPError slapd_slp_cookie;
void slapd_slp_init( const char* urls ) {
int i;
+ SLPError err;
slapd_srvurls = ldap_str2charray( urls, " " );
}
/* open the SLP handle */
- SLPOpen( "en", 0, &slapd_hslp );
+ err = SLPOpen( "en", 0, &slapd_hslp );
+
+ if (err != SLP_OK) {
+ Debug( LDAP_DEBUG_CONNS, "daemon: SLPOpen() failed with %ld\n",
+ (long)err, 0, 0 );
+ }
}
void slapd_slp_deinit() {
SLPError errcode,
void* cookie )
{
- /* empty report */
+ /* return the error code in the cookie */
+ *(SLPError*)cookie = errcode;
}
void slapd_slp_reg() {
int i;
+ SLPError err;
if( slapd_srvurls == NULL ) return;
strncmp( slapd_srvurls[i], LDAPS_SRVTYPE_PREFIX,
sizeof( LDAPS_SRVTYPE_PREFIX ) - 1 ) == 0 )
{
- SLPReg( slapd_hslp,
+ err = SLPReg( slapd_hslp,
slapd_srvurls[i],
SLP_LIFETIME_MAXIMUM,
"ldap",
- "",
- 1,
+ (slapd_slp_attrs) ? slapd_slp_attrs : "",
+ SLP_TRUE,
slapd_slp_regreport,
- NULL );
+ &slapd_slp_cookie );
+
+ if (err != SLP_OK || slapd_slp_cookie != SLP_OK) {
+ Debug( LDAP_DEBUG_CONNS,
+ "daemon: SLPReg(%s) failed with %ld, cookie = %ld\n",
+ slapd_srvurls[i], (long)err, (long)slapd_slp_cookie );
+ }
}
}
}
void slapd_slp_dereg() {
int i;
+ SLPError err;
if( slapd_srvurls == NULL ) return;
for( i=0; slapd_srvurls[i] != NULL; i++ ) {
- SLPDereg( slapd_hslp,
+ err = SLPDereg( slapd_hslp,
slapd_srvurls[i],
slapd_slp_regreport,
- NULL );
+ &slapd_slp_cookie );
+
+ if (err != SLP_OK || slapd_slp_cookie != SLP_OK) {
+ Debug( LDAP_DEBUG_CONNS,
+ "daemon: SLPDereg(%s) failed with %ld, cookie = %ld\n",
+ slapd_srvurls[i], (long)err, (long)slapd_slp_cookie );
+ }
}
}
#endif /* HAVE_SLP */
if( u == NULL || u[0] == NULL ) {
Debug( LDAP_DEBUG_ANY, "daemon_init: no urls (%s) provided.\n",
urls, 0, 0 );
+ if ( u )
+ ldap_charray_free( u );
return -1;
}
"daemon: write active on %d\n",
wd, 0, 0 );
-#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
- connection_write_activate( wd );
-#else
/*
* NOTE: it is possible that the connection was closed
* and that the stream is now inactive.
nrfds--;
}
}
-#endif
}
for ( i = 0; nrfds > 0; i++ ) {
waswrite = 1;
-#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
- connection_write_activate( fd );
-#else
/*
* NOTE: it is possible that the connection was closed
* and that the stream is now inactive.
if ( connection_write( fd ) < 0 ) {
continue;
}
-#endif
}
/* If event is a read or an error */
if( SLAP_EVENT_IS_READ( i ) || !waswrite ) {