mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-08 08:02:16 -05:00
Add support for LDAP_ALL_OPERATIONAL_ATTRIBUTES ("+") (based on
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().
This commit is contained in:
parent
06b667b8c6
commit
a39cf6f93d
14 changed files with 143 additions and 52 deletions
|
|
@ -72,6 +72,7 @@ LDAP_BEGIN_DECL
|
|||
#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
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ bdb2i_back_search_internal(
|
|||
|
||||
if (e) {
|
||||
switch ( send_search_entry( be, conn, op, e,
|
||||
attrs, attrsonly, 0, NULL ) ) {
|
||||
attrs, attrsonly, NULL ) ) {
|
||||
case 0: /* entry sent ok */
|
||||
nentries++;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ ldap_send_entry(
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ ldbm_back_search(
|
|||
|
||||
if (e) {
|
||||
switch ( send_search_entry( be, conn, op, e,
|
||||
attrs, attrsonly, 0, NULL ) ) {
|
||||
attrs, attrsonly, NULL ) ) {
|
||||
case 0: /* entry sent ok */
|
||||
nentries++;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ passwd_back_search(
|
|||
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
|
@ -145,7 +145,7 @@ passwd_back_search(
|
|||
}
|
||||
|
||||
send_search_entry( be, conn, op,
|
||||
e, attrs, attrsonly, 0, NULL );
|
||||
e, attrs, attrsonly, NULL );
|
||||
sent++;
|
||||
}
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ passwd_back_search(
|
|||
|
||||
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++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ perl_back_search(
|
|||
|
||||
} else {
|
||||
send_search_entry( be, conn, op,
|
||||
e, attrs, attrsonly, 0, NULL );
|
||||
e, attrs, attrsonly, NULL );
|
||||
|
||||
entry_free( e );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,11 @@
|
|||
*/
|
||||
|
||||
void
|
||||
config_info( Connection *conn, Operation *op )
|
||||
config_info(
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
char **attrs,
|
||||
int attrsonly )
|
||||
{
|
||||
Entry *e;
|
||||
char buf[BUFSIZ];
|
||||
|
|
@ -46,6 +50,20 @@ config_info( Connection *conn, Operation *op )
|
|||
(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++ ) {
|
||||
|
|
@ -57,8 +75,16 @@ config_info( Connection *conn, Operation *op )
|
|||
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 );
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,11 @@
|
|||
#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];
|
||||
|
|
@ -50,6 +54,20 @@ monitor_info( Connection *conn, Operation *op )
|
|||
(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 );
|
||||
|
|
@ -246,8 +264,16 @@ monitor_info( Connection *conn, Operation *op )
|
|||
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 );
|
||||
|
||||
|
|
|
|||
|
|
@ -241,7 +241,11 @@ extern char *supportedExtensions[];
|
|||
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
|
||||
|
|
@ -304,7 +308,7 @@ int send_search_reference LDAP_P((
|
|||
|
||||
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,
|
||||
|
|
@ -436,8 +440,17 @@ extern void slapd_remove LDAP_P((ber_socket_t s, int wake));
|
|||
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));
|
||||
|
|
|
|||
|
|
@ -491,7 +491,6 @@ send_search_entry(
|
|||
Entry *e,
|
||||
char **attrs,
|
||||
int attrsonly,
|
||||
int opattrs,
|
||||
LDAPControl **ctrls
|
||||
)
|
||||
{
|
||||
|
|
@ -500,7 +499,8 @@ send_search_entry(
|
|||
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 );
|
||||
|
||||
|
|
@ -534,10 +534,14 @@ send_search_entry(
|
|||
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];
|
||||
|
||||
|
|
@ -549,18 +553,16 @@ send_search_entry(
|
|||
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -611,6 +613,8 @@ send_search_entry(
|
|||
}
|
||||
|
||||
#ifdef SLAPD_SCHEMA_DN
|
||||
/* eventually will loop through generated operational attributes */
|
||||
/* only have subschemaSubentry implemented */
|
||||
a = backend_subschemasubentry( be );
|
||||
|
||||
do {
|
||||
|
|
@ -624,18 +628,16 @@ send_search_entry(
|
|||
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -738,7 +740,7 @@ send_search_reference(
|
|||
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 ) )
|
||||
|
|
@ -806,7 +808,7 @@ send_search_reference(
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,8 +98,16 @@ root_dse_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
|
|||
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 );
|
||||
|
||||
|
|
|
|||
|
|
@ -1120,15 +1120,19 @@ schema_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
|
|||
(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 */
|
||||
|
|
@ -1151,8 +1155,20 @@ schema_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
|
|||
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 );
|
||||
|
||||
|
|
|
|||
|
|
@ -163,14 +163,14 @@ do_search(
|
|||
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
|
||||
|
|
|
|||
|
|
@ -71,7 +71,6 @@ send_search_entry(
|
|||
Entry *e,
|
||||
char **attrs,
|
||||
int attrsonly,
|
||||
int opattrs,
|
||||
LDAPControl **ctrls
|
||||
)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue