浏览代码

Ticket #47634 support AttributeTypeDescription USAGE userApplications distributedOperation dSAOperation

https://fedorahosted.org/389/ticket/47634
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: When reading schema, flag the attribute as distributedOperation
or dSAOperation.  When writing schema, make sure the USAGE is specified
correctly based on the flag.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
Rich Megginson 12 年之前
父节点
当前提交
ee7565f846
共有 2 个文件被更改,包括 37 次插入1 次删除
  1. 19 1
      ldap/servers/slapd/schema.c
  2. 18 0
      ldap/servers/slapd/slapi-plugin.h

+ 19 - 1
ldap/servers/slapd/schema.c

@@ -1420,7 +1420,11 @@ schema_attr_enum_callback(struct asyntaxinfo *asip, void *arg)
 		if (asip->asi_flags & SLAPI_ATTR_FLAG_NOUSERMOD ) {
 			outp += strcpy_count( outp, 1 + schema_nousermod_with_spaces );
 		}
-		if (asip->asi_flags & SLAPI_ATTR_FLAG_OPATTR) {
+		if (asip->asi_flags & SLAPI_ATTR_FLAG_DISTRIBUTED_OPERATION) {
+			outp += strcpy_count(outp, "USAGE distributedOperation ");
+		} else if (asip->asi_flags & SLAPI_ATTR_FLAG_DSA_OPERATION) {
+			outp += strcpy_count(outp, "USAGE dSAOperation ");
+		} else if (asip->asi_flags & SLAPI_ATTR_FLAG_OPATTR) {
 			outp += strcpy_count(outp, "USAGE directoryOperation ");
 		}
 
@@ -3551,6 +3555,14 @@ read_at_ldif(const char *input, struct asyntaxinfo **asipp, char *errorbuf,
                     strlen("directoryOperation"))) {
                 flags |= SLAPI_ATTR_FLAG_OPATTR;
             }
+            if ( !PL_strncmp(ss, "distributedOperation",
+                    strlen("distributedOperation"))) {
+                flags |= SLAPI_ATTR_FLAG_OPATTR|SLAPI_ATTR_FLAG_DISTRIBUTED_OPERATION;
+            }
+            if ( !PL_strncmp(ss, "dSAOperation",
+                    strlen("dSAOperation"))) {
+                flags |= SLAPI_ATTR_FLAG_OPATTR|SLAPI_ATTR_FLAG_DSA_OPERATION;
+            }
             if ( NULL == ( nextinput = strchr( ss, ' ' ))) {
                 nextinput = ss + strlen(ss);
             }
@@ -3885,6 +3897,12 @@ parse_attr_str(const char *input, struct asyntaxinfo **asipp, char *errorbuf,
     if(atype->at_usage == LDAP_SCHEMA_DIRECTORY_OPERATION){
         flags |= SLAPI_ATTR_FLAG_OPATTR;
     }
+    if(atype->at_usage == LDAP_SCHEMA_DISTRIBUTED_OPERATION){
+        flags |= SLAPI_ATTR_FLAG_OPATTR|SLAPI_ATTR_FLAG_DISTRIBUTED_OPERATION;
+    }
+    if(atype->at_usage == LDAP_SCHEMA_DSA_OPERATION){
+        flags |= SLAPI_ATTR_FLAG_OPATTR|SLAPI_ATTR_FLAG_DSA_OPERATION;
+    }
     /*
      * Check the superior, and use it fill in any missing oids on this attribute
      */

+ 18 - 0
ldap/servers/slapd/slapi-plugin.h

@@ -198,6 +198,24 @@ NSPR_API(PRUint32) PR_fprintf(struct PRFileDesc* fd, const char *fmt, ...)
  */
 #define SLAPI_ATTR_FLAG_NOEXPOSE	0x0800	/* the attr value is not exposed */
 
+/**
+ * Flag to indicate that the attribute value is LDAP_SCHEMA_DISTRIBUTED_OPERATION
+ * If this is set, SLAPI_ATTR_FLAG_OPATTR must also be set
+ *
+ * \see slapi_value_set_flags()
+ * \see slapi_values_set_flags()
+*/
+#define SLAPI_ATTR_FLAG_DISTRIBUTED_OPERATION	0x1000	/* USAGE distributedOperation */
+
+/**
+ * Flag to indicate that the attribute value is LDAP_SCHEMA_DSA_OPERATION
+ * If this is set, SLAPI_ATTR_FLAG_OPATTR must also be set
+ *
+ * \see slapi_value_set_flags()
+ * \see slapi_values_set_flags()
+ */
+#define SLAPI_ATTR_FLAG_DSA_OPERATION	0x2000	/* USAGE dSAOperation */
+
 /* operation flags */
 #define SLAPI_OP_FLAG_INTERNAL		0x00020 /* An operation generated by the core server or a plugin. */
 #define SLAPI_OP_FLAG_NEVER_CHAIN	0x00800 /* Do not chain the operation */