version 1.83, 2010/12/31 13:08:34
|
version 1.84, 2011/01/02 11:29:19
|
Line 1
|
Line 1
|
/* chain.c - chain LDAP operations */ |
/* chain.c - chain LDAP operations */ |
/* $OpenLDAP: pkg/ldap/servers/slapd/back-ldap/chain.c,v 1.82 2010/11/14 22:53:54 ando Exp $ */ |
/* $OpenLDAP: pkg/ldap/servers/slapd/back-ldap/chain.c,v 1.83 2010/12/31 13:08:34 hallvard Exp $ */ |
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. |
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. |
* |
* |
* Copyright 2003-2010 The OpenLDAP Foundation. |
* Copyright 2003-2010 The OpenLDAP Foundation. |
Line 448 Document: RFC 4511
|
Line 448 Document: RFC 4511
|
* proto://[host][:port]/ only */ |
* proto://[host][:port]/ only */ |
rc = ldap_url_parse_ext( ref->bv_val, &srv, LDAP_PVT_URL_PARSE_NONE ); |
rc = ldap_url_parse_ext( ref->bv_val, &srv, LDAP_PVT_URL_PARSE_NONE ); |
if ( rc != LDAP_URL_SUCCESS ) { |
if ( rc != LDAP_URL_SUCCESS ) { |
|
Debug( LDAP_DEBUG_TRACE, "%s ldap_chain_op: unable to parse ref=\"%s\"\n", |
|
op->o_log_prefix, ref->bv_val, 0 ); |
|
|
/* try next */ |
/* try next */ |
rc = LDAP_OTHER; |
rc = LDAP_OTHER; |
continue; |
continue; |
Line 501 Document: RFC 4511
|
Line 504 Document: RFC 4511
|
filter2bv_x( op, tmp_oq_search.rs_filter, &tmp_oq_search.rs_filterstr ); |
filter2bv_x( op, tmp_oq_search.rs_filter, &tmp_oq_search.rs_filterstr ); |
|
|
} else { |
} else { |
|
Debug( LDAP_DEBUG_TRACE, "%s ldap_chain_op: ref=\"%s\": unable to parse filter=\"%s\"\n", |
|
op->o_log_prefix, ref->bv_val, srv->lud_filter ); |
rc = LDAP_OTHER; |
rc = LDAP_OTHER; |
} |
} |
} |
} |
Line 522 Document: RFC 4511
|
Line 527 Document: RFC 4511
|
} |
} |
|
|
if ( li.li_uri == NULL ) { |
if ( li.li_uri == NULL ) { |
|
Debug( LDAP_DEBUG_TRACE, "%s ldap_chain_op: ref=\"%s\" unable to reconstruct URI\n", |
|
op->o_log_prefix, ref->bv_val, 0 ); |
|
|
/* try next */ |
/* try next */ |
rc = LDAP_OTHER; |
rc = LDAP_OTHER; |
goto further_cleanup; |
goto further_cleanup; |
} |
} |
|
|
|
Debug( LDAP_DEBUG_TRACE, "%s ldap_chain_op: ref=\"%s\" -> \"%s\"\n", |
|
op->o_log_prefix, ref->bv_val, li.li_uri ); |
|
|
op->o_req_dn = pdn; |
op->o_req_dn = pdn; |
op->o_req_ndn = ndn; |
op->o_req_ndn = ndn; |
|
|
Line 549 Document: RFC 4511
|
Line 560 Document: RFC 4511
|
if ( lip != NULL ) { |
if ( lip != NULL ) { |
op->o_bd->be_private = (void *)lip; |
op->o_bd->be_private = (void *)lip; |
|
|
|
Debug( LDAP_DEBUG_TRACE, "%s ldap_chain_op: ref=\"%s\": URI=\"%s\" found in cache\n", |
|
op->o_log_prefix, ref->bv_val, li.li_uri ); |
|
|
} else { |
} else { |
rc = ldap_chain_db_init_one( op->o_bd ); |
rc = ldap_chain_db_init_one( op->o_bd ); |
if ( rc != 0 ) { |
if ( rc != 0 ) { |
|
Debug( LDAP_DEBUG_TRACE, "%s ldap_chain_op: ref=\"%s\" unable to init back-ldap for URI=\"%s\"\n", |
|
op->o_log_prefix, ref->bv_val, li.li_uri ); |
goto cleanup; |
goto cleanup; |
} |
} |
lip = (ldapinfo_t *)op->o_bd->be_private; |
lip = (ldapinfo_t *)op->o_bd->be_private; |
Line 559 Document: RFC 4511
|
Line 575 Document: RFC 4511
|
lip->li_bvuri = bvuri; |
lip->li_bvuri = bvuri; |
rc = ldap_chain_db_open_one( op->o_bd ); |
rc = ldap_chain_db_open_one( op->o_bd ); |
if ( rc != 0 ) { |
if ( rc != 0 ) { |
|
Debug( LDAP_DEBUG_TRACE, "%s ldap_chain_op: ref=\"%s\" unable to open back-ldap for URI=\"%s\"\n", |
|
op->o_log_prefix, ref->bv_val, li.li_uri ); |
lip->li_uri = NULL; |
lip->li_uri = NULL; |
lip->li_bvuri = NULL; |
lip->li_bvuri = NULL; |
(void)ldap_chain_db_destroy_one( op->o_bd, NULL); |
(void)ldap_chain_db_destroy_one( op->o_bd, NULL); |
Line 580 Document: RFC 4511
|
Line 598 Document: RFC 4511
|
} else { |
} else { |
temporary = 1; |
temporary = 1; |
} |
} |
|
|
|
Debug( LDAP_DEBUG_TRACE, "%s ldap_chain_op: ref=\"%s\" %s\n", |
|
op->o_log_prefix, ref->bv_val, temporary ? "temporary" : "caching" ); |
} |
} |
|
|
lb->lb_op_f = op_f; |
lb->lb_op_f = op_f; |
Line 697 ldap_chain_search(
|
Line 718 ldap_chain_search(
|
* proto://[host][:port]/ only */ |
* proto://[host][:port]/ only */ |
rc = ldap_url_parse_ext( ref[0].bv_val, &srv, LDAP_PVT_URL_PARSE_NONE ); |
rc = ldap_url_parse_ext( ref[0].bv_val, &srv, LDAP_PVT_URL_PARSE_NONE ); |
if ( rc != LDAP_URL_SUCCESS ) { |
if ( rc != LDAP_URL_SUCCESS ) { |
|
Debug( LDAP_DEBUG_TRACE, "%s ldap_chain_search: unable to parse ref=\"%s\"\n", |
|
op->o_log_prefix, ref->bv_val, 0 ); |
|
|
/* try next */ |
/* try next */ |
rs->sr_err = LDAP_OTHER; |
rs->sr_err = LDAP_OTHER; |
continue; |
continue; |
Line 759 ldap_chain_search(
|
Line 783 ldap_chain_search(
|
filter2bv_x( op, tmp_oq_search.rs_filter, &tmp_oq_search.rs_filterstr ); |
filter2bv_x( op, tmp_oq_search.rs_filter, &tmp_oq_search.rs_filterstr ); |
|
|
} else { |
} else { |
|
Debug( LDAP_DEBUG_TRACE, "%s ldap_chain_search: ref=\"%s\": unable to parse filter=\"%s\"\n", |
|
op->o_log_prefix, ref->bv_val, srv->lud_filter ); |
rc = LDAP_OTHER; |
rc = LDAP_OTHER; |
} |
} |
} |
} |
Line 774 ldap_chain_search(
|
Line 800 ldap_chain_search(
|
ldap_free_urldesc( srv ); |
ldap_free_urldesc( srv ); |
|
|
if ( rc != LDAP_SUCCESS || li.li_uri == NULL ) { |
if ( rc != LDAP_SUCCESS || li.li_uri == NULL ) { |
|
Debug( LDAP_DEBUG_TRACE, "%s ldap_chain_search: ref=\"%s\" unable to reconstruct URI\n", |
|
op->o_log_prefix, ref->bv_val, 0 ); |
|
|
/* try next */ |
/* try next */ |
rc = LDAP_OTHER; |
rc = LDAP_OTHER; |
goto further_cleanup; |
goto further_cleanup; |
} |
} |
|
|
|
Debug( LDAP_DEBUG_TRACE, "%s ldap_chain_search: ref=\"%s\" -> \"%s\"\n", |
|
op->o_log_prefix, ref->bv_val, li.li_uri ); |
|
|
op->o_req_dn = pdn; |
op->o_req_dn = pdn; |
op->o_req_ndn = ndn; |
op->o_req_ndn = ndn; |
op->ors_scope = tmp_oq_search.rs_scope; |
op->ors_scope = tmp_oq_search.rs_scope; |
Line 798 ldap_chain_search(
|
Line 830 ldap_chain_search(
|
if ( lip != NULL ) { |
if ( lip != NULL ) { |
op->o_bd->be_private = (void *)lip; |
op->o_bd->be_private = (void *)lip; |
|
|
|
Debug( LDAP_DEBUG_TRACE, "%s ldap_chain_search: ref=\"%s\": URI=\"%s\" found in cache\n", |
|
op->o_log_prefix, ref->bv_val, li.li_uri ); |
|
|
} else { |
} else { |
/* if none is found, create a temporary... */ |
/* if none is found, create a temporary... */ |
rc = ldap_chain_db_init_one( op->o_bd ); |
rc = ldap_chain_db_init_one( op->o_bd ); |
if ( rc != 0 ) { |
if ( rc != 0 ) { |
|
Debug( LDAP_DEBUG_TRACE, "%s ldap_chain_search: ref=\"%s\" unable to init back-ldap for URI=\"%s\"\n", |
|
op->o_log_prefix, ref->bv_val, li.li_uri ); |
goto cleanup; |
goto cleanup; |
} |
} |
lip = (ldapinfo_t *)op->o_bd->be_private; |
lip = (ldapinfo_t *)op->o_bd->be_private; |
Line 809 ldap_chain_search(
|
Line 846 ldap_chain_search(
|
lip->li_bvuri = bvuri; |
lip->li_bvuri = bvuri; |
rc = ldap_chain_db_open_one( op->o_bd ); |
rc = ldap_chain_db_open_one( op->o_bd ); |
if ( rc != 0 ) { |
if ( rc != 0 ) { |
|
Debug( LDAP_DEBUG_TRACE, "%s ldap_chain_search: ref=\"%s\" unable to open back-ldap for URI=\"%s\"\n", |
|
op->o_log_prefix, ref->bv_val, li.li_uri ); |
lip->li_uri = NULL; |
lip->li_uri = NULL; |
lip->li_bvuri = NULL; |
lip->li_bvuri = NULL; |
(void)ldap_chain_db_destroy_one( op->o_bd, NULL ); |
(void)ldap_chain_db_destroy_one( op->o_bd, NULL ); |
Line 830 ldap_chain_search(
|
Line 869 ldap_chain_search(
|
} else { |
} else { |
temporary = 1; |
temporary = 1; |
} |
} |
|
|
|
Debug( LDAP_DEBUG_TRACE, "%s ldap_chain_search: ref=\"%s\" %s\n", |
|
op->o_log_prefix, ref->bv_val, temporary ? "temporary" : "caching" ); |
} |
} |
|
|
lb->lb_op_f = lback->bi_op_search; |
lb->lb_op_f = lback->bi_op_search; |