]> git.sur5r.net Git - openldap/commitdiff
Add support for LDAP_ALL_OPERATIONAL_ATTRIBUTES ("+") (based on
authorKurt Zeilenga <kurt@openldap.org>
Sat, 24 Jul 1999 03:39:23 +0000 (03:39 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sat, 24 Jul 1999 03:39:23 +0000 (03:39 +0000)
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().

14 files changed:
include/ldap.h
servers/slapd/back-bdb2/search.c
servers/slapd/back-ldap/search.c
servers/slapd/back-ldbm/search.c
servers/slapd/back-passwd/search.c
servers/slapd/back-perl/search.c
servers/slapd/configinfo.c
servers/slapd/monitor.c
servers/slapd/proto-slap.h
servers/slapd/result.c
servers/slapd/root_dse.c
servers/slapd/schema.c
servers/slapd/search.c
servers/slapd/tools/mimic.c

index 6fbe9b1bed7514d9439f2ce92de663de59fd8386..70ab7318fec62587cd7cd8b5f25de8e55f50a40b 100644 (file)
@@ -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
index 63d709475cde4632ed4f4d83cdf9924b15a4bdb0..6fa45c895ae93fa397a4ed77f378797c5567fc3c 100644 (file)
@@ -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;
index f6054fa66e983d7687e706c9a3e7f1be662966b1..3541c99046ff7c1d2dcb06dc6a173d4d08ad966a 100644 (file)
@@ -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;
index dbbf761487bcf9632cccc1cd43fdc61d7052e3c7..11171e4039c7578ff40303c33f9e379a93829874 100644 (file)
@@ -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;
index 08c20b8900f69865c105baa53946a3bd30153135..c9668907577d2ec7907405e75bd971b4721ff6e0 100644 (file)
@@ -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++;
                }
 
index 16648d658c409ea603e7f68741dcafe8f93e08a7..f3dfe1565b792abe6998f7bb35cb68a27ebd9160 100644 (file)
@@ -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 );
                                }
index 5d45069fa91d2cb278f6f4b66ef80a145055da4d..565a606647e6a7fa7fe1929bd8383b0c2e9cb666 100644 (file)
  */
 
 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 );
 
index 891cbab2b10cb1d46c068583326d66a39dc3b1bd..659be6e99b5ecf12d36d8779e4379e233f426b23 100644 (file)
 #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 );
 
index 78d0c8594d6f5c0c87d134570ebca6cce81a63ce..adf380e80996132067486e3847f346bf5fed868e 100644 (file)
@@ -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));
index 4f2848e8dee7ef9a2f45f0944869a7c259f41367..061c6899c91158fd53824dc88f27a9738208ac24 100644 (file)
@@ -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;
 }
index 9da603c89cdd9a38268cf2a5f68a27deb096d95d..361f7bc4e34fd9d0ab0e961afb8560df256ddb78 100644 (file)
@@ -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 );
 
index 8c5b5f749366082d3ea8ea30a551c71355be5cf1..c7bafd9b8a51b2e5f068915c6b5c2d4901ca7f54 100644 (file)
@@ -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 );
 
index ef38c6a59184692bdc719a91034ed82d1c89175f..cc74378ba992e8e16199394ee1734bf6c4da0a17 100644 (file)
@@ -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
index ea598b18c6392b6cb39f819fb326814a760f8175..fba6ef6767add6ce2346c1654b8e9ff08d60586e 100644 (file)
@@ -71,7 +71,6 @@ send_search_entry(
        Entry   *e,
        char    **attrs,
        int             attrsonly,
-       int             opattrs,
        LDAPControl **ctrls
 )        
 {