]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/main.c
Fix strchrlen running past end of berval
[openldap] / servers / slapd / main.c
index 79a83434dbd7fcf38d585daca08b7489771b3159..eb475f2f08dea9ba0bc131693688922a65fc86c0 100644 (file)
@@ -115,8 +115,9 @@ slapd_opt_slp( const char *val, void *arg )
 {
 #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;
@@ -155,7 +156,7 @@ struct option_helper {
        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 }
 };
 
@@ -963,8 +964,10 @@ stop:
        /* Setting it to itself decreases refcount, allowing it to be freed
         * when the LD is freed.
         */
-       ldap_pvt_tls_set_option( slap_tls_ld, LDAP_OPT_X_TLS_CTX, slap_tls_ctx );
-       ldap_ld_free( slap_tls_ld, 0, NULL, NULL );
+       if ( slap_tls_ld ) {
+               ldap_pvt_tls_set_option( slap_tls_ld, LDAP_OPT_X_TLS_CTX, slap_tls_ctx );
+               ldap_unbind( slap_tls_ld );
+       }
        ldap_pvt_tls_destroy();
 #endif