]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/bconfig.c
Partially revert prev commit, leave rs->sr_err == SLAPD_ABANDON
[openldap] / servers / slapd / bconfig.c
index 2d23b9e2a3044213cbf010c51c461df1f556f139..7979dc57f5ce4da084ed99b0b7008cf752bd1ce3 100644 (file)
@@ -692,7 +692,7 @@ static ConfigTable config_back_cf_table[] = {
 #else
                ARG_IGNORED, NULL,
 #endif
-               "( OLcfgGlAt:85 NAME 'olcTLSProtocolMin' "
+               "( OLcfgGlAt:87 NAME 'olcTLSProtocolMin' "
                        "SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
        { "tool-threads", "count", 2, 2, 0, ARG_INT|ARG_MAGIC|CFG_TTHREADS,
                &config_generic, "( OLcfgGlAt:80 NAME 'olcToolThreads' "
@@ -706,6 +706,9 @@ static ConfigTable config_back_cf_table[] = {
                &config_updateref, "( OLcfgDbAt:0.13 NAME 'olcUpdateRef' "
                        "EQUALITY caseIgnoreMatch "
                        "SUP labeledURI )", NULL, NULL },
+       { "writetimeout", "timeout", 2, 2, 0, ARG_INT,
+               &global_writetimeout, "( OLcfgGlAt:88 NAME 'olcWriteTimeout' "
+                       "SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
        { NULL, NULL, 0, 0, 0, ARG_IGNORED,
                NULL, NULL, NULL, NULL }
 };
@@ -764,7 +767,7 @@ static ConfigOCs cf_ocs[] = {
                 "olcTLSCACertificatePath $ olcTLSCertificateFile $ "
                 "olcTLSCertificateKeyFile $ olcTLSCipherSuite $ olcTLSCRLCheck $ "
                 "olcTLSRandFile $ olcTLSVerifyClient $ olcTLSDHParamFile $ "
-                "olcTLSCRLFile $ olcToolThreads $ "
+                "olcTLSCRLFile $ olcToolThreads $ olcWriteTimeout $ "
                 "olcObjectIdentifier $ olcAttributeTypes $ olcObjectClasses $ "
                 "olcDitContentRules $ olcLdapSyntaxes ) )", Cft_Global },
        { "( OLcfgGlOc:2 "
@@ -1783,20 +1786,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 +1836,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 +3252,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
@@ -3809,14 +3822,15 @@ config_rename_kids( CfEntryInfo *ce )
        struct berval rdn, nrdn;
 
        for (ce2 = ce->ce_kids; ce2; ce2 = ce2->ce_sibs) {
+               struct berval newdn, newndn;
                dnRdn ( &ce2->ce_entry->e_name, &rdn );
                dnRdn ( &ce2->ce_entry->e_nname, &nrdn );
+               build_new_dn( &newdn, &ce->ce_entry->e_name, &rdn, NULL );
+               build_new_dn( &newndn, &ce->ce_entry->e_nname, &nrdn, NULL );
                free( ce2->ce_entry->e_name.bv_val );
                free( ce2->ce_entry->e_nname.bv_val );
-               build_new_dn( &ce2->ce_entry->e_name, &ce->ce_entry->e_name,
-                       &rdn, NULL );
-               build_new_dn( &ce2->ce_entry->e_nname, &ce->ce_entry->e_nname,
-                       &nrdn, NULL );
+               ce2->ce_entry->e_name = newdn;
+               ce2->ce_entry->e_nname = newndn;
                config_rename_kids( ce2 );
        }
 }
@@ -4477,6 +4491,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, '}' );
@@ -4488,8 +4503,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;
@@ -4695,7 +4708,7 @@ config_back_add( Operation *op, SlapReply *rs )
        {
                char textbuf[SLAP_TEXT_BUFLEN];
                size_t textlen = sizeof textbuf;
-               rs->sr_err = entry_schema_check(op, op->ora_e, NULL, 0, 1,
+               rs->sr_err = entry_schema_check(op, op->ora_e, NULL, 0, 1, NULL,
                        &rs->sr_text, textbuf, sizeof( textbuf ) );
                if ( rs->sr_err != LDAP_SUCCESS )
                        goto out;
@@ -4778,6 +4791,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] == '{' )
        {
@@ -4941,7 +4955,7 @@ config_modify_internal( CfEntryInfo *ce, Operation *op, SlapReply *rs,
        
        if ( rc == LDAP_SUCCESS) {
                /* check that the entry still obeys the schema */
-               rc = entry_schema_check(op, e, NULL, 0, 0,
+               rc = entry_schema_check(op, e, NULL, 0, 0, NULL,
                        &rs->sr_text, ca->cr_msg, sizeof(ca->cr_msg) );
        }
        if ( rc ) goto out_noop;