]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/bconfig.c
ITS#5860 - more for entry cache counts
[openldap] / servers / slapd / bconfig.c
index f651d9c1393f4ef7e3e6512e13fddde03a808c08..eeed0cdc49b7774a4a2cdb7a1b81e6aeb458537b 100644 (file)
@@ -1783,20 +1783,28 @@ sortval_reject:
                                *sip = si;
 
                                if (( slapMode & SLAP_SERVER_MODE ) && c->argc > 2 ) {
+                                       Listener **l = slapd_get_listeners();
+                                       int i, isMe = 0;
+
+                                       /* Try a straight compare with Listener strings */
+                                       for ( i=0; l && l[i]; i++ ) {
+                                               if ( !strcasecmp( c->argv[2], l[i]->sl_url.bv_val )) {
+                                                       isMe = 1;
+                                                       break;
+                                               }
+                                       }
+
                                        /* If hostname is empty, or is localhost, or matches
                                         * our hostname, this serverID refers to this host.
                                         * Compare it against listeners and ports.
                                         */
-                                       if ( !lud->lud_host || !lud->lud_host[0] ||
+                                       if ( !isMe && ( !lud->lud_host || !lud->lud_host[0] ||
                                                !strncasecmp("localhost", lud->lud_host,
                                                        STRLENOF("localhost")) ||
-                                               !strcasecmp( global_host, lud->lud_host )) {
-                                               Listener **l = slapd_get_listeners();
-                                               int i;
+                                               !strcasecmp( global_host, lud->lud_host ))) {
 
                                                for ( i=0; l && l[i]; i++ ) {
                                                        LDAPURLDesc *lu2;
-                                                       int isMe = 0;
                                                        ldap_url_parse( l[i]->sl_url.bv_val, &lu2 );
                                                        do {
                                                                if ( strcasecmp( lud->lud_scheme,
@@ -1825,15 +1833,17 @@ sortval_reject:
                                                        } while(0);
                                                        ldap_free_urldesc( lu2 );
                                                        if ( isMe ) {
-                                                               slap_serverID = si->si_num;
-                                                               Debug( LDAP_DEBUG_CONFIG,
-                                                                       "%s: SID=%d (listener=%s)\n",
-                                                                       c->log, slap_serverID,
-                                                                       l[i]->sl_url.bv_val );
                                                                break;
                                                        }
                                                }
                                        }
+                                       if ( isMe ) {
+                                               slap_serverID = si->si_num;
+                                               Debug( LDAP_DEBUG_CONFIG,
+                                                       "%s: SID=%d (listener=%s)\n",
+                                                       c->log, slap_serverID,
+                                                       l[i]->sl_url.bv_val );
+                                       }
                                }
                                if ( c->argc > 2 )
                                        ldap_free_urldesc( lud );
@@ -3239,7 +3249,7 @@ config_tls_config(ConfigArgs *c) {
                }
                return(ldap_pvt_tls_set_option(slap_tls_ld, flag, &i));
        } else {
-               return(ldap_int_tls_config(slap_tls_ld, flag, c->argv[1]));
+               return(ldap_pvt_tls_config(slap_tls_ld, flag, c->argv[1]));
        }
 }
 #endif
@@ -4478,6 +4488,7 @@ config_add_internal( CfBackInfo *cfb, Entry *e, ConfigArgs *ca, SlapReply *rs,
                if ( !ct ) continue;    /* user data? */
                for (i=0; a->a_vals[i].bv_val; i++) {
                        char *iptr = NULL;
+                       ca->valx = -1;
                        ca->line = a->a_vals[i].bv_val;
                        if ( a->a_desc->ad_type->sat_flags & SLAP_AT_ORDERED ) {
                                ptr = strchr( ca->line, '}' );
@@ -4489,8 +4500,6 @@ config_add_internal( CfBackInfo *cfb, Entry *e, ConfigArgs *ca, SlapReply *rs,
                        if ( a->a_desc->ad_type->sat_flags & SLAP_AT_ORDERED_SIB ) {
                                if ( iptr ) {
                                        ca->valx = strtol( iptr+1, NULL, 0 );
-                               } else {
-                                       ca->valx = -1;
                                }
                        } else {
                                ca->valx = i;
@@ -4779,6 +4788,7 @@ config_modify_add( ConfigTable *ct, ConfigArgs *ca, AttributeDescription *ad,
 {
        int rc;
 
+       ca->valx = -1;
        if (ad->ad_type->sat_flags & SLAP_AT_ORDERED &&
                ca->line[0] == '{' )
        {