.B [\-F slapd\-config\-directory]
.B [\-h URLs]
.B [\-n service\-name] [\-s syslog\-level] [\-l syslog\-local\-user]
+.B [\-o option[=value]]
.B [\-r directory]
.B [\-u user] [\-g group]
.B [\-c cookie]
is the commit sequence number received by a previous synchronization
and represents the state of the consumer replica content which the
syncrepl engine will synchronize to the current provider content.
+.TP
+.BI \-o " option[=value]"
+This option provides a generic means to specify options without the need to reserve
+a separate letter for them.
+
+It supports the following options:
+.RS
+.TP
+slp={\fBon\fP|\fBoff\fP|\fIslp\-attrs\fP}
+When SLP support is compiled into slapd, disable it (
+.B off
+), enable it by registering at SLP DAs without specific SLP attributes (
+.B on
+), or with specific SLP attributes
+.I slp\-attrs
+that must be an SLP attribute list definition according to the SLP standard.
+
+For example, "-o slp=(tree=production),(server-type=OpenLDAP),(server-version=2.3.20)"
+registers at SLP DAs with the three SLP attributes tree, server-type and server-version
+that have the values given above.
+This allows to specifically query the SLP DAs for LDAP servers holding the
+.I production
+tree in case multiple trees are availabe.
+.RE
.SH EXAMPLES
To start
.I slapd
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 */
{
#ifdef HAVE_SLP
/* NULL is default */
- if ( val == NULL || strcasecmp( val, "on" ) == 0 ) {
+ if ( val == NULL || *val == '(' || strcasecmp( val, "on" ) == 0 ) {
slapd_register_slp = 1;
+ slapd_slp_attrs = (val != NULL && *val == '(') ? val : NULL;
} else if ( strcasecmp( val, "off" ) == 0 ) {
slapd_register_slp = 0;
void *oh_arg;
const char *oh_usage;
} option_helpers[] = {
- { BER_BVC("slp"), slapd_opt_slp, NULL, "slp[={on|off}] enable/disable SLP" },
+ { BER_BVC("slp"), slapd_opt_slp, NULL, "slp[={on|off|(attrs)}] enable/disable SLP using (attrs)" },
{ BER_BVNULL, 0, NULL, NULL }
};
LDAP_SLAPD_V (volatile sig_atomic_t) slapd_abrupt_shutdown;
LDAP_SLAPD_V (volatile sig_atomic_t) slapd_shutdown;
LDAP_SLAPD_V (int) slapd_register_slp;
+LDAP_SLAPD_V (char *) slapd_slp_attrs;
LDAP_SLAPD_V (slap_ssf_t) local_ssf;
LDAP_SLAPD_V (struct runqueue_s) slapd_rq;