From 370d576009aa20af0d1d6dd0d82cbbdbaa1ed8b2 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 19 Dec 2013 10:49:27 -0700 Subject: [PATCH 1/2] Ticket #47634 support AttributeTypeDescription USAGE userApplications distributedOperation dSAOperation https://fedorahosted.org/389/ticket/47634 Reviewed by: ??? 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 --- ldap/servers/slapd/schema.c | 20 +++++++++++++++++++- ldap/servers/slapd/slapi-plugin.h | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletions(-) diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c index 414e7f0..85063a5 100644 --- a/ldap/servers/slapd/schema.c +++ b/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 */ diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h index fbd5d9f..f3856ad 100644 --- a/ldap/servers/slapd/slapi-plugin.h +++ b/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 */ -- 1.7.1