mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-03 20:40:05 -05:00
Rework root dse and other info entry codes to produce entry
to caller (do_search) such that info can be used by other operations (ie: do_compare). SLAPD_SCHEMA_NOT_COMPAT: Add additional code to support filters (needs work)
This commit is contained in:
parent
c923fe5401
commit
a1430fdfdb
7 changed files with 72 additions and 70 deletions
|
|
@ -361,21 +361,32 @@ get_substring_filter(
|
|||
ber_tag_t rc;
|
||||
struct berval *val;
|
||||
char *last;
|
||||
char *type;
|
||||
struct berval type;
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int syntax;
|
||||
|
||||
#endif
|
||||
*text = "error decoding filter";
|
||||
|
||||
Debug( LDAP_DEBUG_FILTER, "begin get_substring_filter\n", 0, 0, 0 );
|
||||
|
||||
if ( ber_scanf( ber, "{a" /*}*/, &type ) == LBER_ERROR ) {
|
||||
if ( ber_scanf( ber, "{o" /*}*/, &type ) == LBER_ERROR ) {
|
||||
return SLAPD_DISCONNECT;
|
||||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
rc = slap_bv2ad( &type, &f->f_sub_desc, text );
|
||||
|
||||
ch_free( type.bv_val );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
text = NULL;
|
||||
f->f_choice = SLAPD_FILTER_COMPUTED;
|
||||
f->f_result = SLAPD_COMPARE_UNDEFINED;
|
||||
*fstr = ch_strdup( "(undefined)" );
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
#else
|
||||
f->f_sub_type = type;
|
||||
f->f_sub_type = type.bv_val;
|
||||
attr_normalize( f->f_sub_type );
|
||||
|
||||
/* should get real syntax and see if we have a substring matching rule */
|
||||
|
|
@ -387,7 +398,11 @@ get_substring_filter(
|
|||
f->f_sub_final = NULL;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
if( fstr ) {
|
||||
*fstr = ch_malloc( sizeof("(=" /*)*/) +
|
||||
f->f_sub_desc->ad_cname->bv_len );
|
||||
sprintf( *fstr, "(%s=" /*)*/, f->f_sub_desc->ad_cname->bv_val );
|
||||
}
|
||||
#else
|
||||
if( fstr ) {
|
||||
*fstr = ch_malloc( strlen( f->f_sub_type ) + 3 );
|
||||
|
|
@ -412,9 +427,7 @@ get_substring_filter(
|
|||
|
||||
rc = LDAP_PROTOCOL_ERROR;
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
#else
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* we should call a substring syntax normalization routine */
|
||||
value_normalize( val->bv_val, syntax );
|
||||
/* this is bogus, value_normalize should take a berval */
|
||||
|
|
@ -485,7 +498,7 @@ return_error:
|
|||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* not yet implemented */
|
||||
ad_free( f->f_sub_desc, 1 );
|
||||
#else
|
||||
ch_free( f->f_sub_type );
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -440,11 +440,8 @@ LIBSLAPD_F (void) *module_resolve LDAP_P((
|
|||
*/
|
||||
LIBSLAPD_F (char *) supportedControls[];
|
||||
|
||||
LIBSLAPD_F (void) monitor_info LDAP_P((
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
char ** attrs,
|
||||
int attrsonly ));
|
||||
LIBSLAPD_F (int) monitor_info LDAP_P((
|
||||
Entry **entry, char **text ));
|
||||
|
||||
/*
|
||||
* operation.c
|
||||
|
|
@ -596,8 +593,7 @@ LIBSLAPD_F (int) register_matching_rule LDAP_P((char * desc,
|
|||
slap_mr_indexer_func *indexer,
|
||||
slap_mr_filter_func *filter ));
|
||||
|
||||
LIBSLAPD_F (void) schema_info LDAP_P((Connection *conn, Operation *op,
|
||||
char **attrs, int attrsonly));
|
||||
LIBSLAPD_F (int) schema_info LDAP_P(( Entry **entry, char **text ));
|
||||
|
||||
LIBSLAPD_F (int) is_entry_objectclass LDAP_P((
|
||||
Entry *, const char* objectclass ));
|
||||
|
|
@ -788,17 +784,11 @@ LIBSLAPD_F (void) slapd_remove LDAP_P((ber_socket_t s, int wake));
|
|||
LIBSLAPD_F (RETSIGTYPE) slap_sig_shutdown LDAP_P((int sig));
|
||||
LIBSLAPD_F (RETSIGTYPE) slap_sig_wake LDAP_P((int sig));
|
||||
|
||||
LIBSLAPD_F (void) config_info LDAP_P((
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
char ** attrs,
|
||||
int attrsonly ));
|
||||
LIBSLAPD_F (int) config_info LDAP_P((
|
||||
Entry **e, char **text ));
|
||||
|
||||
LIBSLAPD_F (void) root_dse_info LDAP_P((
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
char ** attrs,
|
||||
int attrsonly ));
|
||||
LIBSLAPD_F (int) root_dse_info LDAP_P((
|
||||
Entry **e, char **text ));
|
||||
|
||||
LIBSLAPD_F (int) do_abandon LDAP_P((Connection *conn, Operation *op));
|
||||
LIBSLAPD_F (int) do_add LDAP_P((Connection *conn, Operation *op));
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
#include "slap.h"
|
||||
|
||||
void
|
||||
root_dse_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
|
||||
int
|
||||
root_dse_info( Entry **entry, char **text )
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
Entry *e;
|
||||
|
|
@ -121,12 +121,7 @@ root_dse_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
|
|||
attr_merge( e, ad_ref, default_referral );
|
||||
}
|
||||
|
||||
send_search_entry( &backends[0], conn, op,
|
||||
e, attrs, attrsonly, NULL );
|
||||
|
||||
send_search_result( conn, op, LDAP_SUCCESS,
|
||||
NULL, NULL, NULL, NULL, 1 );
|
||||
|
||||
entry_free( e );
|
||||
*entry = e;
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -197,7 +197,8 @@ int sasl_bind(
|
|||
int sc;
|
||||
int rc = 1;
|
||||
|
||||
Debug(LDAP_DEBUG_ARGS, "==> sasl_bind: dn=%s, mech=%s, cred->bv_len=%d\n",
|
||||
Debug(LDAP_DEBUG_ARGS,
|
||||
"==> sasl_bind: dn=\"%s\" mech=%s cred->bv_len=%d\n",
|
||||
dn, mech, cred ? cred->bv_len : 0 );
|
||||
|
||||
if ( conn->c_sasl_bind_context == NULL ) {
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
#if defined( SLAPD_SCHEMA_DN )
|
||||
|
||||
void
|
||||
schema_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
|
||||
int
|
||||
schema_info( Entry **entry, char **text )
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
|
||||
|
|
@ -60,9 +60,8 @@ schema_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
|
|||
attr_merge( e, ad_objectClass, vals );
|
||||
|
||||
{
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
int rc;
|
||||
char *text;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
AttributeDescription *desc = NULL;
|
||||
#else
|
||||
char *desc;
|
||||
|
|
@ -71,11 +70,9 @@ schema_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
|
|||
val.bv_val = strchr( rdn, '=' );
|
||||
|
||||
if( val.bv_val == NULL ) {
|
||||
send_ldap_result( conn, op, LDAP_OTHER,
|
||||
NULL, "improperly configured subschema subentry",
|
||||
NULL, NULL );
|
||||
free( rdn );
|
||||
return;
|
||||
*text = "improperly configured subschema subentry";
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
|
||||
*val.bv_val = '\0';
|
||||
|
|
@ -85,11 +82,10 @@ schema_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
|
|||
rc = slap_str2ad( rdn, &desc, &text );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
send_ldap_result( conn, op, LDAP_OTHER,
|
||||
NULL, "improperly configured subschema subentry",
|
||||
NULL, NULL );
|
||||
free( rdn );
|
||||
return;
|
||||
entry_free( e );
|
||||
*text = "improperly configured subschema subentry";
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
#else
|
||||
desc = rdn;
|
||||
|
|
@ -106,17 +102,12 @@ schema_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
|
|||
{
|
||||
/* Out of memory, do something about it */
|
||||
entry_free( e );
|
||||
send_ldap_result( conn, op, LDAP_OTHER,
|
||||
NULL, "out of memory", NULL, NULL );
|
||||
return;
|
||||
text = "out of memory";
|
||||
return LDAP_OTHER;
|
||||
}
|
||||
|
||||
send_search_entry( &backends[0], conn, op,
|
||||
e, attrs, attrsonly, NULL );
|
||||
send_search_result( conn, op, LDAP_SUCCESS,
|
||||
NULL, NULL, NULL, NULL, 1 );
|
||||
|
||||
entry_free( e );
|
||||
*entry = e;
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -666,7 +666,7 @@ struct slap_schema_ad_map {
|
|||
offsetof(struct slap_internal_schema, si_ad_entry) },
|
||||
{ "children",
|
||||
offsetof(struct slap_internal_schema, si_ad_children) },
|
||||
{ NULL, NULL }
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -160,29 +160,41 @@ do_search(
|
|||
op->o_connid, op->o_opid, base, scope, fstr );
|
||||
|
||||
if ( scope == LDAP_SCOPE_BASE ) {
|
||||
Entry *entry = NULL;
|
||||
|
||||
if ( strcasecmp( nbase, LDAP_ROOT_DSE ) == 0 ) {
|
||||
rc = root_dse_info( &entry, &text );
|
||||
}
|
||||
|
||||
#if defined( SLAPD_MONITOR_DN )
|
||||
if ( strcasecmp( nbase, SLAPD_MONITOR_DN ) == 0 ) {
|
||||
monitor_info( conn, op, attrs, attrsonly );
|
||||
goto return_results;
|
||||
else if ( strcasecmp( nbase, SLAPD_MONITOR_DN ) == 0 ) {
|
||||
rc = monitor_info( &entry, &text );
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined( SLAPD_CONFIG_DN )
|
||||
if ( strcasecmp( nbase, SLAPD_CONFIG_DN ) == 0 ) {
|
||||
config_info( conn, op, attrs, attrsonly );
|
||||
goto return_results;
|
||||
else if ( strcasecmp( nbase, SLAPD_CONFIG_DN ) == 0 ) {
|
||||
rc = config_info( &entry, &text );
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined( SLAPD_SCHEMA_DN )
|
||||
if ( strcasecmp( nbase, SLAPD_SCHEMA_DN ) == 0 ) {
|
||||
schema_info( conn, op, attrs, attrsonly );
|
||||
goto return_results;
|
||||
else if ( strcasecmp( nbase, SLAPD_SCHEMA_DN ) == 0 ) {
|
||||
rc= schema_info( &entry, &text );
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( strcasecmp( nbase, LDAP_ROOT_DSE ) == 0 ) {
|
||||
root_dse_info( conn, op, attrs, attrsonly );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
send_ldap_result( conn, op, rc,
|
||||
NULL, text, NULL, NULL );
|
||||
goto return_results;
|
||||
|
||||
} else if ( entry != NULL ) {
|
||||
send_search_entry( &backends[0], conn, op,
|
||||
entry, attrs, attrsonly, NULL );
|
||||
send_ldap_result( conn, op, LDAP_SUCCESS,
|
||||
NULL, NULL, NULL, NULL );
|
||||
entry_free( entry );
|
||||
goto return_results;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue