X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fbackend.c;h=297ec308f981b42310a28d01602493c1054d15bb;hb=d23c55964651929e7b2b5a1730b33efee9661033;hp=e638770820c2cc9d6c6d9d099ae4c0c445453047;hpb=fafce1601e5bcd0eca185a2a0366cd2b198121a6;p=openldap diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index e638770820..297ec308f9 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -272,11 +272,11 @@ int backend_startup(Backend *be) if(rc != 0) { #ifdef NEW_LOGGING LDAP_LOG(( "backend", LDAP_LEVEL_CRIT, - "backend_startup: bi_db_open failed!\n" )); + "backend_startup: bi_db_open failed! (%d)\n", rc )); #else Debug( LDAP_DEBUG_ANY, - "backend_startup: bi_db_open failed!\n", - 0, 0, 0 ); + "backend_startup: bi_db_open failed! (%d)\n", + rc, 0, 0 ); #endif return rc; } @@ -322,11 +322,12 @@ int backend_startup(Backend *be) if(rc != 0) { #ifdef NEW_LOGGING LDAP_LOG(( "backend", LDAP_LEVEL_CRIT, - "backend_startup: bi_db_open %d failed!\n", i )); + "backend_startup: bi_db_open(%d) failed! (%d)\n", + i, rc )); #else Debug( LDAP_DEBUG_ANY, - "backend_startup: bi_db_open %d failed!\n", - i, 0, 0 ); + "backend_startup: bi_db_open(%d) failed! (%d)\n", + i, rc, 0 ); #endif return rc; } @@ -489,6 +490,7 @@ backend_db_init( be->be_restrictops = global_restrictops; be->be_requires = global_requires; + be->be_ssf_set = global_ssf_set; /* assign a default depth limit for alias deref */ be->be_max_deref_depth = SLAPD_DEFAULT_MAXDEREFDEPTH; @@ -577,17 +579,13 @@ select_backend( int be_issuffix( Backend *be, - const char *suffix + struct berval *bvsuffix ) { int i; - size_t len = strlen(suffix); for ( i = 0; be->be_nsuffix != NULL && be->be_nsuffix[i] != NULL; i++ ) { - if ( len != be->be_nsuffix[i]->bv_len ) { - continue; - } - if ( strcmp( be->be_nsuffix[i]->bv_val, suffix ) == 0 ) { + if ( ber_bvcmp( be->be_nsuffix[i], bvsuffix ) == 0 ) { return( 1 ); } } @@ -748,7 +746,7 @@ backend_check_controls( if( (*ctrls)->ldctl_iscritical && !charray_inlist( be->be_controls, (*ctrls)->ldctl_oid ) ) { - *text = "control unavailable in NamingContext"; + *text = "control unavailable in context"; return LDAP_UNAVAILABLE_CRITICAL_EXTENSION; } } @@ -894,7 +892,7 @@ backend_check_restrictions( if( requires & SLAP_REQUIRE_STRONG ) { /* should check mechanism */ - if( op->o_authmech == NULL || op->o_dn.bv_len == 0 ) + if( op->o_authmech.bv_len == 0 || op->o_dn.bv_len == 0 ) { *text = "strong authentication required"; return LDAP_STRONG_AUTH_REQUIRED; @@ -902,7 +900,7 @@ backend_check_restrictions( } if( requires & SLAP_REQUIRE_SASL ) { - if( op->o_authmech == NULL || op->o_dn.bv_len == 0 ) + if( op->o_authmech.bv_len == 0 || op->o_dn.bv_len == 0 ) { *text = "SASL authentication required"; return LDAP_STRONG_AUTH_REQUIRED; @@ -1006,16 +1004,17 @@ backend_group( } ldap_pvt_thread_mutex_lock( &conn->c_mutex ); - for (g = conn->c_groups; g; g=g->next) { - if (g->be != be || g->oc != group_oc || g->at != group_at || - g->len != gr_ndn->bv_len) + for (g = conn->c_groups; g; g=g->ga_next) { + if (g->ga_be != be || g->ga_oc != group_oc || + g->ga_at != group_at || g->ga_len != gr_ndn->bv_len) continue; - if (strcmp( g->ndn, gr_ndn->bv_val ) == 0) + if (strcmp( g->ga_ndn, gr_ndn->bv_val ) == 0) break; } ldap_pvt_thread_mutex_unlock( &conn->c_mutex ); - if (g) - return g->res; + if (g) { + return g->ga_res; + } if( be->be_group ) { int res = be->be_group( be, conn, op, @@ -1024,14 +1023,14 @@ backend_group( if (op->o_tag != LDAP_REQ_BIND) { g = ch_malloc(sizeof(GroupAssertion) + gr_ndn->bv_len); - g->be = be; - g->oc = group_oc; - g->at = group_at; - g->res = res; - g->len = gr_ndn->bv_len; - strcpy(g->ndn, gr_ndn->bv_val); + g->ga_be = be; + g->ga_oc = group_oc; + g->ga_at = group_at; + g->ga_res = res; + g->ga_len = gr_ndn->bv_len; + strcpy(g->ga_ndn, gr_ndn->bv_val); ldap_pvt_thread_mutex_lock( &conn->c_mutex ); - g->next = conn->c_groups; + g->ga_next = conn->c_groups; conn->c_groups = g; ldap_pvt_thread_mutex_unlock( &conn->c_mutex ); } @@ -1050,7 +1049,7 @@ backend_attribute( Entry *target, struct berval *edn, AttributeDescription *entry_at, - BVarray *vals + BerVarray *vals ) { if ( target == NULL || !dn_match( &target->e_nname, edn ) ) {