mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
need to catch the '' base in search as well; selected cleanup and improvements
This commit is contained in:
parent
77da5c56a4
commit
1e351da986
@ -40,7 +40,7 @@ dnssrv_back_initialize(
|
||||
|
||||
bi->bi_controls = controls;
|
||||
|
||||
bi->bi_open = 0;
|
||||
bi->bi_open = dnssrv_back_open;
|
||||
bi->bi_config = 0;
|
||||
bi->bi_close = 0;
|
||||
bi->bi_destroy = 0;
|
||||
@ -71,6 +71,21 @@ dnssrv_back_initialize(
|
||||
return 0;
|
||||
}
|
||||
|
||||
AttributeDescription *ad_dc;
|
||||
AttributeDescription *ad_associatedDomain;
|
||||
|
||||
int
|
||||
dnssrv_back_open(
|
||||
BackendInfo *bi )
|
||||
{
|
||||
const char *text;
|
||||
|
||||
(void)slap_str2ad( "dc", &ad_dc, &text );
|
||||
(void)slap_str2ad( "associatedDomain", &ad_associatedDomain, &text );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dnssrv_back_db_init(
|
||||
Backend *be )
|
||||
|
@ -38,6 +38,9 @@ extern BI_op_compare dnssrv_back_compare;
|
||||
|
||||
extern BI_chk_referrals dnssrv_back_referrals;
|
||||
|
||||
extern AttributeDescription *ad_dc;
|
||||
extern AttributeDescription *ad_associatedDomain;
|
||||
|
||||
LDAP_END_DECL
|
||||
|
||||
#endif /* PROTO_DNSSRV_H */
|
||||
|
@ -47,11 +47,25 @@ dnssrv_back_search(
|
||||
|
||||
rs->sr_ref = NULL;
|
||||
|
||||
if ( BER_BVISEMPTY( &op->o_req_ndn ) ) {
|
||||
#ifdef LDAP_DEVEL
|
||||
#if 0
|
||||
/* FIXME: need some means to determine whether the database
|
||||
* is a glue instance; if we got here with empty DN, then
|
||||
* we passed this same test in dnssrv_back_referrals() */
|
||||
if ( SLAP_GLUE_INSTANCE( op->o_bd ) ) {
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
return LDAP_SUCCESS;
|
||||
#endif /* LDAP_DEVEL */
|
||||
}
|
||||
|
||||
manageDSAit = get_manageDSAit( op );
|
||||
/*
|
||||
* FIXME: we may return a referral if manageDSAit is not set
|
||||
*/
|
||||
if ( ! manageDSAit ) {
|
||||
if ( !manageDSAit ) {
|
||||
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
|
||||
"manageDSAit must be set" );
|
||||
goto done;
|
||||
@ -166,52 +180,36 @@ dnssrv_back_search(
|
||||
|
||||
vals[1].bv_val = NULL;
|
||||
|
||||
vals[0].bv_val = "top";
|
||||
vals[0].bv_len = sizeof("top")-1;
|
||||
attr_mergeit( e, ad_objectClass, vals );
|
||||
BER_BVSTR( &vals[0], "top" );
|
||||
attr_mergeit( e, ad_objectClass, &slap_schema.si_oc_top->soc_cname );
|
||||
|
||||
vals[0].bv_val = "referral";
|
||||
vals[0].bv_len = sizeof("referral")-1;
|
||||
attr_mergeit( e, ad_objectClass, vals );
|
||||
BER_BVSTR( &vals[0], "referral" );
|
||||
attr_mergeit( e, ad_objectClass, &slap_schema.si_oc_referral->soc_cname );
|
||||
|
||||
vals[0].bv_val = "extensibleObject";
|
||||
vals[0].bv_len = sizeof("extensibleObject")-1;
|
||||
attr_mergeit( e, ad_objectClass, vals );
|
||||
BER_BVSTR( &vals[0], "extensibleObject" );
|
||||
attr_mergeit( e, ad_objectClass, &slap_schema.si_oc_extensibleObject->soc_cname );
|
||||
|
||||
{
|
||||
AttributeDescription *ad = NULL;
|
||||
const char *text;
|
||||
if ( ad_dc ) {
|
||||
char *p;
|
||||
vals[0].bv_val = ch_strdup( domain );
|
||||
|
||||
rc = slap_str2ad( "dc", &ad, &text );
|
||||
|
||||
if( rc == LDAP_SUCCESS ) {
|
||||
char *p;
|
||||
vals[0].bv_val = ch_strdup( domain );
|
||||
|
||||
p = strchr( vals[0].bv_val, '.' );
|
||||
p = strchr( vals[0].bv_val, '.' );
|
||||
|
||||
if( p == vals[0].bv_val ) {
|
||||
vals[0].bv_val[1] = '\0';
|
||||
} else if ( p != NULL ) {
|
||||
*p = '\0';
|
||||
}
|
||||
if ( p == vals[0].bv_val ) {
|
||||
vals[0].bv_val[1] = '\0';
|
||||
|
||||
vals[0].bv_len = strlen(vals[0].bv_val);
|
||||
attr_mergeit( e, ad, vals );
|
||||
} else if ( p != NULL ) {
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
vals[0].bv_len = strlen( vals[0].bv_val );
|
||||
attr_mergeit( e, ad_dc, vals );
|
||||
}
|
||||
|
||||
{
|
||||
AttributeDescription *ad = NULL;
|
||||
const char *text;
|
||||
|
||||
rc = slap_str2ad( "associatedDomain", &ad, &text );
|
||||
|
||||
if( rc == LDAP_SUCCESS ) {
|
||||
vals[0].bv_val = domain;
|
||||
vals[0].bv_len = strlen(domain);
|
||||
attr_mergeit( e, ad, vals );
|
||||
}
|
||||
if ( ad_associatedDomain ) {
|
||||
vals[0].bv_val = domain;
|
||||
vals[0].bv_len = strlen(domain);
|
||||
attr_mergeit( e, ad_associatedDomain, vals );
|
||||
}
|
||||
|
||||
attr_mergeit( e, ad_ref, urls );
|
||||
|
Loading…
Reference in New Issue
Block a user