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 */
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 );
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 */
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
- /* not yet implemented */
+ ad_free( f->f_sub_desc, 1 );
#else
ch_free( f->f_sub_type );
#endif
*/
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
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 ));
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));
#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;
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;
}
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 ) {
#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;
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;
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';
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;
{
/* 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
offsetof(struct slap_internal_schema, si_ad_entry) },
{ "children",
offsetof(struct slap_internal_schema, si_ad_children) },
- { NULL, NULL }
+ { NULL, 0 }
};
#endif
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;
}
}