]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/aclparse.c
Install *.schema only
[openldap] / servers / slapd / aclparse.c
index bcd648cfafc426323a93aefa3f9ab7c9d8dfd7ed..23faa9f3f66084973898b34902c638c5cce8743e 100644 (file)
@@ -98,14 +98,6 @@ parse_acl(
 #ifdef SLAPD_SCHEMA_NOT_COMPAT
        int rc;
        const char *text;
-       AttributeDescription *ad_distinguishedName = slap_schema.si_ad_distinguishedName;
-       AttributeDescription *ad_member = slap_schema.si_ad_member;
-#ifdef SLAPD_ACI_ENABLED
-       AttributeDescription *ad_aci = slap_schema.si_ad_aci;
-#endif
-#else
-       static char *ad_aci = "aci";
-       static char *ad_member = "member";
 #endif
 
        a = NULL;
@@ -343,11 +335,12 @@ parse_acl(
                                        }
 
 
-                                       if( b->a_dn_at->ad_type->sat_syntax
-                                               != ad_distinguishedName->ad_type->sat_syntax )
+                                       if( !is_at_syntax( b->a_dn_at->ad_type,
+                                               SLAPD_DN_SYNTAX ) )
                                        {
                                                fprintf( stderr,
-                                                       "%s: line %d: dnattr \"%s\": inappropriate syntax: %s\n",
+                                                       "%s: line %d: dnattr \"%s\": "
+                                                       "inappropriate syntax: %s\n",
                                                        fname, lineno, right,
                                                        b->a_dn_at->ad_type->sat_syntax_oid );
                                                acl_usage();
@@ -389,43 +382,54 @@ parse_acl(
 #else
                                                b->a_group_oc = ch_strdup(value);
 #endif
+                                               *--value = '/';
+
                                                if( b->a_group_oc == NULL ) {
                                                        fprintf( stderr,
-                                                               "%s: line %d: group objectclass \"%s\" unknown\n",
+                                                               "%s: line %d: group objectclass "
+                                                               "\"%s\" unknown\n",
                                                                fname, lineno, value );
                                                        acl_usage();
                                                }
-
+                                       } else {
 #ifdef SLAPD_SCHEMA_NOT_COMPAT
-                                               if( is_object_subclass( b->a_group_oc,
-                                                       slap_schema.si_oc_referral ) )
-                                               {
-                                                       fprintf( stderr,
-                                                               "%s: line %d: group objectclass \"%s\" is subclass of referral\n",
-                                                               fname, lineno, value );
-                                                       acl_usage();
-                                               }
+                                               b->a_group_oc = oc_find(SLAPD_GROUP_CLASS);
 
-                                               if( is_object_subclass( b->a_group_oc,
-                                                       slap_schema.si_oc_alias ) )
-                                               {
+                                               if( b->a_group_oc == NULL ) {
                                                        fprintf( stderr,
-                                                               "%s: line %d: group objectclass \"%s\" is subclass of alias\n",
-                                                               fname, lineno, value );
+                                                               "%s: line %d: group default objectclass "
+                                                               "\"%s\" unknown\n",
+                                                               fname, lineno, SLAPD_GROUP_CLASS );
                                                        acl_usage();
                                                }
+#else
+                                               b->a_group_oc = ch_strdup(SLAPD_GROUP_CLASS);
 #endif
+                                       }
 
-                                               *--value = '/';
-
-                                       } else {
 #ifdef SLAPD_SCHEMA_NOT_COMPAT
-                                               b->a_group_oc = slap_schema.si_oc_groupOfNames;
-#else
-                                               b->a_group_oc = ch_strdup("groupOfNames");
-#endif
+#if 0
+                                       if( is_object_subclass( b->a_group_oc,
+                                               slap_schema.si_oc_referral ) )
+                                       {
+                                               fprintf( stderr,
+                                                       "%s: line %d: group objectclass \"%s\" "
+                                                       "is subclass of referral\n",
+                                                       fname, lineno, value );
+                                               acl_usage();
                                        }
 
+                                       if( is_object_subclass( b->a_group_oc,
+                                               slap_schema.si_oc_alias ) )
+                                       {
+                                               fprintf( stderr,
+                                                       "%s: line %d: group objectclass \"%s\" "
+                                                       "is subclass of alias\n",
+                                                       fname, lineno, value );
+                                               acl_usage();
+                                       }
+#endif
+#endif
 
                                        if (name && *name) {
 #ifdef SLAPD_SCHEMA_NOT_COMPAT
@@ -437,34 +441,33 @@ parse_acl(
                                                                fname, lineno, right, text );
                                                        acl_usage();
                                                }
-
-                                               if( b->a_group_at->ad_type->sat_syntax
-                                                       != ad_member->ad_type->sat_syntax )
-                                               {
-                                                       fprintf( stderr,
-                                                               "%s: line %d: group \"%s\": inappropriate syntax: %s\n",
-                                                               fname, lineno, right,
-                                                               b->a_group_at->ad_type->sat_syntax_oid );
-                                                       acl_usage();
-                                               }
 #else
                                                b->a_group_at = ch_strdup(name);
 #endif
                                                *--name = '/';
-
                                        } else {
 #ifdef SLAPD_SCHEMA_NOT_COMPAT
-                                               b->a_group_at = ad_dup( ad_member );
+                                               rc = slap_str2ad( SLAPD_GROUP_ATTR, &b->a_group_at, &text );
+
+                                               if( rc != LDAP_SUCCESS ) {
+                                                       fprintf( stderr,
+                                                               "%s: line %d: group \"%s\": %s\n",
+                                                               fname, lineno, SLAPD_GROUP_ATTR, text );
+                                                       acl_usage();
+                                               }
 #else
-                                               b->a_group_at = ch_strdup( ad_member );
+                                               b->a_group_at = ch_strdup( SLAPD_GROUP_ATTR );
 #endif
                                        }
 
 #ifdef SLAPD_SCHEMA_NOT_COMPAT
-                                       if( b->a_group_at == NULL ) {
+                                       if( !is_at_syntax( b->a_group_at->ad_type,
+                                               SLAPD_DN_SYNTAX ) )
+                                       {
                                                fprintf( stderr,
-                                                       "%s: line %d: group attribute type undefined.\n",
-                                                       fname, lineno );
+                                                       "%s: line %d: group \"%s\": inappropriate syntax: %s\n",
+                                                       fname, lineno, right,
+                                                       b->a_group_at->ad_type->sat_syntax_oid );
                                                acl_usage();
                                        }
 
@@ -491,8 +494,7 @@ parse_acl(
                                                        acl_usage();
                                                }
                                        }
-
-#endif /* SLAPD_SCHEMA_NOT_COMPAT */
+#endif
                                        continue;
                                }
 
@@ -568,23 +570,24 @@ parse_acl(
                                                        acl_usage();
                                                }
 
-                                               if( b->a_aci_at->ad_type->sat_syntax
-                                                       != ad_aci->ad_type->sat_syntax )
-                                               {
+                                       } else {
+                                               rc = slap_str2ad( SLAPD_ACI_ATTR, &b->a_aci_at, &text );
+
+                                               if( rc != LDAP_SUCCESS ) {
                                                        fprintf( stderr,
-                                                               "%s: line %d: aci \"%s\": inappropriate syntax: %s\n",
-                                                               fname, lineno, right,
-                                                               b->a_aci_at->ad_type->sat_syntax_oid );
+                                                               "%s: line %d: aci \"%s\": %s\n",
+                                                               fname, lineno, SLAPD_ACI_ATTR, text );
                                                        acl_usage();
                                                }
-                                       } else {
-                                               b->a_aci_at = ad_dup( ad_aci );
                                        }
 
-                                       if( b->a_aci_at == NULL ) {
+                                       if( !is_at_syntax( b->a_aci_at->ad_type,
+                                               SLAPD_ACI_SYNTAX) )
+                                       {
                                                fprintf( stderr,
-                                                       "%s: line %d: aci attribute type undefined.\n",
-                                                       fname, lineno );
+                                                       "%s: line %d: aci \"%s\": inappropriate syntax: %s\n",
+                                                       fname, lineno, right,
+                                                       b->a_aci_at->ad_type->sat_syntax_oid );
                                                acl_usage();
                                        }
 
@@ -592,7 +595,7 @@ parse_acl(
                                        if ( right != NULL && *right != '\0' ) {
                                                b->a_aci_at = ch_strdup( right );
                                        } else {
-                                               b->a_aci_at = ch_strdup( SLAPD_ACI_DEFAULT_ATTR );
+                                               b->a_aci_at = ch_strdup( SLAPD_ACI_ATTR );
                                        }
 #endif
                                        continue;