]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9121 slapo-dynlist, -memberof: define memberOf if needed
authorHoward Chu <hyc@openldap.org>
Tue, 18 Aug 2020 22:19:56 +0000 (23:19 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Tue, 18 Aug 2020 23:49:26 +0000 (23:49 +0000)
Ignore if it's defined already. Make it no-user-mod.

servers/slapd/overlays/dynlist.c
servers/slapd/overlays/memberof.c

index 182295ea6c330ca787fff3d9fa5eefa10f742c84..7fd113a289c6e7420f71768356710710d55607cb 100644 (file)
@@ -37,6 +37,7 @@
 #include "lutil.h"
 
 static AttributeDescription *ad_dgIdentity, *ad_dgAuthz;
+static AttributeDescription *ad_memberOf;
 
 typedef struct dynlist_map_t {
        AttributeDescription    *dlm_member_ad;
@@ -2626,8 +2627,29 @@ static
 int
 dynlist_initialize(void)
 {
+       const char *text;
        int     rc = 0;
 
+       /* See if we need to define memberOf opattr */
+       rc = slap_str2ad( "memberOf", &ad_memberOf, &text );
+       if ( rc ) {
+               rc = register_at(
+               "( 1.2.840.113556.1.2.102 "
+               "NAME 'memberOf' "
+               "DESC 'Group that the entry belongs to' "
+               "SYNTAX '1.3.6.1.4.1.1466.115.121.1.12' "
+               "EQUALITY distinguishedNameMatch "      /* added */
+               "USAGE dSAOperation "                   /* added; questioned */
+               "NO-USER-MODIFICATION "                 /* added */
+               "X-ORIGIN 'iPlanet Delegated Administrator' )",
+               &ad_memberOf, 0 );
+               if ( rc ) {
+                       Debug( LDAP_DEBUG_ANY,
+                               "dynlist_initialize: register_at (memberOf) failed\n" );
+                       return rc;
+               }
+       }
+
        dynlist.on_bi.bi_type = "dynlist";
 
 #ifdef TAKEOVER_DYNGROUP
index 6d60fc14435b2153028d98e9415e2fe07f7a74fc..8e159bc2f3c3d3f55ac44927107829576e3e66ea 100644 (file)
@@ -2155,7 +2155,7 @@ static struct {
                "SYNTAX '1.3.6.1.4.1.1466.115.121.1.12' "
                "EQUALITY distinguishedNameMatch "      /* added */
                "USAGE dSAOperation "                   /* added; questioned */
-               /* "NO-USER-MODIFICATION " */           /* add? */
+               "NO-USER-MODIFICATION "                 /* added */
                "X-ORIGIN 'iPlanet Delegated Administrator' )",
                &ad_memberOf },
        { NULL }
@@ -2170,8 +2170,8 @@ memberof_initialize( void )
        int                     code, i;
 
        for ( i = 0; as[ i ].desc != NULL; i++ ) {
-               code = register_at( as[ i ].desc, as[ i ].adp, 0 );
-               if ( code ) {
+               code = register_at( as[ i ].desc, as[ i ].adp, 1 );
+               if ( code && code != SLAP_SCHERR_ATTR_DUP ) {
                        Debug( LDAP_DEBUG_ANY,
                                "memberof_initialize: register_at #%d failed\n",
                                i );