LDAPext discussions).
Add attrs and attrsonly support to monitor/config info.
Add rdn attributes to schema/monitor/config.
Add extensibleObject objectclass to schema/monitor/config.
Add top objectclass to rootdse/monitor/config.
Remove opattrs option from send_search_entry().
#define LDAP_ROOT_DSE ""
#define LDAP_NO_ATTRS "1.1"
#define LDAP_ALL_USER_ATTRIBUTES "*"
+#define LDAP_ALL_OPERATIONAL_ATTRIBUTES "+"
/*
* LDAP_OPTions defined by draft-ldapext-ldap-c-api-02
if (e) {
switch ( send_search_entry( be, conn, op, e,
- attrs, attrsonly, 0, NULL ) ) {
+ attrs, attrsonly, NULL ) ) {
case 0: /* entry sent ok */
nentries++;
break;
if (!attr->a_vals)
attr->a_vals = &dummy;
}
- send_search_entry( be, lc->conn, op, &ent, attrs, attrsonly, 0, NULL );
+ send_search_entry( be, lc->conn, op, &ent, attrs, attrsonly, NULL );
for (;ent.e_attrs;) {
attr=ent.e_attrs;
ent.e_attrs = attr->a_next;
if (e) {
switch ( send_search_entry( be, conn, op, e,
- attrs, attrsonly, 0, NULL ) ) {
+ attrs, attrsonly, NULL ) ) {
case 0: /* entry sent ok */
nentries++;
break;
if ( test_filter( be, conn, op, e, filter ) == 0 ) {
send_search_entry( be, conn, op,
- e, attrs, attrsonly, 0, NULL );
+ e, attrs, attrsonly, NULL );
sent++;
}
}
}
send_search_entry( be, conn, op,
- e, attrs, attrsonly, 0, NULL );
+ e, attrs, attrsonly, NULL );
sent++;
}
if ( test_filter( be, conn, op, e, filter ) == 0 ) {
send_search_entry( be, conn, op,
- e, attrs, attrsonly, 0, NULL );
+ e, attrs, attrsonly, NULL );
sent++;
}
} else {
send_search_entry( be, conn, op,
- e, attrs, attrsonly, 0, NULL );
+ e, attrs, attrsonly, NULL );
entry_free( e );
}
*/
void
-config_info( Connection *conn, Operation *op )
+config_info(
+ Connection *conn,
+ Operation *op,
+ char **attrs,
+ int attrsonly )
{
Entry *e;
char buf[BUFSIZ];
(void) dn_normalize_case( e->e_ndn );
e->e_private = NULL;
+ {
+ char *rdn = ch_strdup( SLAPD_CONFIG_DN );
+ val.bv_val = strchr( rdn, '=' );
+
+ if( val.bv_val != NULL ) {
+ *val.bv_val = '\0';
+ val.bv_len = strlen( ++val.bv_val );
+
+ attr_merge( e, rdn, vals );
+ }
+
+ free( rdn );
+ }
+
for ( i = 0; i < nbackends; i++ ) {
strcpy( buf, backends[i].be_type );
for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) {
attr_merge( e, "database", vals );
}
+ val.bv_val = "top";
+ val.bv_len = sizeof("top")-1;
+ attr_merge( e, "objectClass", vals );
+
+ val.bv_val = "extenisbleObject";
+ val.bv_len = sizeof("extenisbleObject")-1;
+ attr_merge( e, "objectClass", vals );
+
send_search_entry( &backends[0], conn, op, e,
- NULL, 0, 1, NULL );
+ attrs, attrsonly, NULL );
send_search_result( conn, op, LDAP_SUCCESS,
NULL, NULL, NULL, NULL, 1 );
#if defined( SLAPD_MONITOR_DN )
void
-monitor_info( Connection *conn, Operation *op )
+monitor_info(
+ Connection *conn,
+ Operation *op,
+ char ** attrs,
+ int attrsonly )
{
Entry *e;
char buf[BUFSIZ];
(void) dn_normalize_case( e->e_ndn );
e->e_private = NULL;
+ {
+ char *rdn = ch_strdup( SLAPD_MONITOR_DN );
+ val.bv_val = strchr( rdn, '=' );
+
+ if( val.bv_val != NULL ) {
+ *val.bv_val = '\0';
+ val.bv_len = strlen( ++val.bv_val );
+
+ attr_merge( e, rdn, vals );
+ }
+
+ free( rdn );
+ }
+
val.bv_val = (char *) Versionstr;
if (( p = strchr( Versionstr, '\n' )) == NULL ) {
val.bv_len = strlen( Versionstr );
attr_merge( e, "concurrency", vals );
#endif
+ val.bv_val = "top";
+ val.bv_len = sizeof("top")-1;
+ attr_merge( e, "objectClass", vals );
+
+ val.bv_val = "extensibleObject";
+ val.bv_len = sizeof("extensibleObject")-1;
+ attr_merge( e, "objectClass", vals );
+
send_search_entry( &backends[0], conn, op, e,
- NULL, 0, 1, NULL );
+ attrs, attrsonly, NULL );
send_search_result( conn, op, LDAP_SUCCESS,
NULL, NULL, NULL, NULL, 1 );
extern char *supportedControls[];
extern char *supportedSASLMechanisms[];
-void monitor_info LDAP_P(( Connection *conn, Operation *op ));
+void monitor_info LDAP_P((
+ Connection *conn,
+ Operation *op,
+ char ** attrs,
+ int attrsonly ));
/*
* operation.c
int send_search_entry LDAP_P((
Backend *be, Connection *conn, Operation *op,
- Entry *e, char **attrs, int attrsonly, int opattrs,
+ Entry *e, char **attrs, int attrsonly,
LDAPControl **ctrls ));
int str2result LDAP_P(( char *s,
extern void slap_set_shutdown LDAP_P((int sig));
extern void slap_do_nothing LDAP_P((int sig));
-extern void config_info LDAP_P((Connection *conn, Operation *op));
-extern void root_dse_info LDAP_P((Connection *conn, Operation *op, char **attrs, int attrsonly));
+extern void config_info LDAP_P((
+ Connection *conn,
+ Operation *op,
+ char ** attrs,
+ int attrsonly ));
+
+extern void root_dse_info LDAP_P((
+ Connection *conn,
+ Operation *op,
+ char ** attrs,
+ int attrsonly ));
extern int do_abandon LDAP_P((Connection *conn, Operation *op));
extern int do_add LDAP_P((Connection *conn, Operation *op));
Entry *e,
char **attrs,
int attrsonly,
- int opattrs,
LDAPControl **ctrls
)
{
int i, rc=-1, bytes;
AccessControl *acl;
char *edn;
- int allattrs;
+ int userattrs;
+ int opattrs;
Debug( LDAP_DEBUG_TRACE, "=> send_search_entry: \"%s\"\n", e->e_dn, 0, 0 );
goto error_return;
}
- /* check for special all user attributes ("*") attribute */
- allattrs = ( attrs == NULL ) ? 1
+ /* check for special all user attributes ("*") type */
+ userattrs = ( attrs == NULL ) ? 1
: charray_inlist( attrs, LDAP_ALL_USER_ATTRIBUTES );
+ /* check for special all operational attributes ("+") type */
+ opattrs = ( attrs == NULL ) ? 0
+ : charray_inlist( attrs, LDAP_ALL_OPERATIONAL_ATTRIBUTES );
+
for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
regmatch_t matches[MAXREMATCHES];
} else {
/* specific addrs requested */
- if ( allattrs ) {
- /* user requested all user attributes */
- /* if operational, make sure it's in list */
-
- if( oc_check_operational_attr( a->a_type )
- && !charray_inlist( attrs, a->a_type ) )
+ if ( oc_check_operational_attr( a->a_type ) ) {
+ if( !opattrs && !charray_inlist( attrs, a->a_type ) )
+ {
+ continue;
+ }
+ } else {
+ if (!userattrs && !charray_inlist( attrs, a->a_type ) )
{
continue;
}
-
- } else if ( !charray_inlist( attrs, a->a_type ) ) {
- continue;
}
}
}
#ifdef SLAPD_SCHEMA_DN
+ /* eventually will loop through generated operational attributes */
+ /* only have subschemaSubentry implemented */
a = backend_subschemasubentry( be );
do {
} else {
/* specific addrs requested */
- if ( allattrs ) {
- /* user requested all user attributes */
- /* if operational, make sure it's in list */
-
- if( oc_check_operational_attr( a->a_type )
- && !charray_inlist( attrs, a->a_type ) )
+ if ( oc_check_operational_attr( a->a_type ) ) {
+ if( !opattrs && !charray_inlist( attrs, a->a_type ) )
+ {
+ continue;
+ }
+ } else {
+ if (!userattrs && !charray_inlist( attrs, a->a_type ) )
{
continue;
}
-
- } else if ( !charray_inlist( attrs, a->a_type ) ) {
- continue;
}
}
int rc;
int bytes;
- Debug( LDAP_DEBUG_TRACE, "=> send_search_entry (%s)\n", e->e_dn, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "=> send_search_reference (%s)\n", e->e_dn, 0, 0 );
if ( ! access_allowed( be, conn, op, e,
"entry", NULL, ACL_READ ) )
Statslog( LDAP_DEBUG_STATS2, "conn=%ld op=%ld ENTRY dn=\"%s\"\n",
(long) conn->c_connid, (long) op->o_opid, e->e_dn, 0, 0 );
- Debug( LDAP_DEBUG_TRACE, "<= send_search_entry\n", 0, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "<= send_search_reference\n", 0, 0, 0 );
return 0;
}
attr_merge( e, "ref", default_referral );
}
+ val.bv_val = "top";
+ val.bv_len = sizeof("top")-1;
+ attr_merge( e, "objectClass", vals );
+
+ val.bv_val = "extenisbleObject";
+ val.bv_len = sizeof("extenisbleObject")-1;
+ attr_merge( e, "objectClass", vals );
+
send_search_entry( &backends[0], conn, op,
- e, attrs, attrsonly, 0, NULL );
+ e, attrs, attrsonly, NULL );
send_search_result( conn, op, LDAP_SUCCESS,
NULL, NULL, NULL, NULL, 1 );
(void) dn_normalize_case( e->e_ndn );
e->e_private = NULL;
- val.bv_val = ch_strdup( "top" );
- val.bv_len = strlen( val.bv_val );
- attr_merge( e, "objectClass", vals );
- ldap_memfree( val.bv_val );
+ {
+ char *rdn = ch_strdup( SLAPD_SCHEMA_DN );
+ val.bv_val = strchr( rdn, '=' );
- val.bv_val = ch_strdup( "subschema" );
- val.bv_len = strlen( val.bv_val );
- attr_merge( e, "objectClass", vals );
- ldap_memfree( val.bv_val );
+ if( val.bv_val != NULL ) {
+ *val.bv_val = '\0';
+ val.bv_len = strlen( ++val.bv_val );
+
+ attr_merge( e, rdn, vals );
+ }
+
+ free( rdn );
+ }
if ( syn_schema_info( e ) ) {
/* Out of memory, do something about it */
return;
}
+ val.bv_val = "top";
+ val.bv_len = sizeof("top")-1;
+ attr_merge( e, "objectClass", vals );
+
+ val.bv_val = "subschema";
+ val.bv_len = sizeof("subschema")-1;
+ attr_merge( e, "objectClass", vals );
+
+ val.bv_val = "extensibleObject";
+ val.bv_len = sizeof("extensibleObject")-1;
+ attr_merge( e, "objectClass", vals );
+
send_search_entry( &backends[0], conn, op,
- e, attrs, attrsonly, 0, NULL );
+ e, attrs, attrsonly, NULL );
send_search_result( conn, op, LDAP_SUCCESS,
NULL, NULL, NULL, NULL, 1 );
if ( scope == LDAP_SCOPE_BASE ) {
#if defined( SLAPD_MONITOR_DN )
if ( strcmp( base, SLAPD_MONITOR_DN ) == 0 ) {
- monitor_info( conn, op );
+ monitor_info( conn, op, attrs, attrsonly );
goto return_results;
}
#endif
#if defined( SLAPD_CONFIG_DN )
if ( strcmp( base, SLAPD_CONFIG_DN ) == 0 ) {
- config_info( conn, op );
+ config_info( conn, op, attrs, attrsonly );
goto return_results;
}
#endif
Entry *e,
char **attrs,
int attrsonly,
- int opattrs,
LDAPControl **ctrls
)
{