2 Unix SMB/CIFS mplementation.
5 Copyright (C) Stefan Metzmacher <metze@samba.org> 2006
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef _DSDB_SCHEMA_H
23 #define _DSDB_SCHEMA_H
25 #include "prefixmap.h"
27 struct dsdb_attribute;
31 struct dsdb_syntax_ctx {
32 struct ldb_context *ldb;
33 const struct dsdb_schema *schema;
35 /* set when converting objects under Schema NC */
44 struct ldb_val oMObjectClass;
45 const char *attributeSyntax_oid;
47 const char *substring;
49 const char *ldb_syntax;
51 WERROR (*drsuapi_to_ldb)(const struct dsdb_syntax_ctx *ctx,
52 const struct dsdb_attribute *attr,
53 const struct drsuapi_DsReplicaAttribute *in,
55 struct ldb_message_element *out);
56 WERROR (*ldb_to_drsuapi)(const struct dsdb_syntax_ctx *ctx,
57 const struct dsdb_attribute *attr,
58 const struct ldb_message_element *in,
60 struct drsuapi_DsReplicaAttribute *out);
61 WERROR (*validate_ldb)(const struct dsdb_syntax_ctx *ctx,
62 const struct dsdb_attribute *attr,
63 const struct ldb_message_element *in);
66 struct dsdb_attribute {
67 struct dsdb_attribute *prev, *next;
70 const char *lDAPDisplayName;
71 const char *attributeID_oid;
72 uint32_t attributeID_id;
73 struct GUID schemaIDGUID;
77 struct GUID attributeSecurityGUID;
78 struct GUID objectGUID;
82 bool isMemberOfPartialAttributeSet;
85 const char *attributeSyntax_oid;
86 uint32_t attributeSyntax_id;
88 struct ldb_val oMObjectClass;
93 bool extendedCharsAllowed;
95 uint32_t schemaFlagsEx;
96 struct ldb_val msDs_Schema_Extensions;
98 bool showInAdvancedViewOnly;
99 const char *adminDisplayName;
100 const char *adminDescription;
101 const char *classDisplayName;
107 const struct dsdb_syntax *syntax;
108 const struct ldb_schema_attribute *ldb_schema_attribute;
112 struct dsdb_class *prev, *next;
115 const char *lDAPDisplayName;
116 const char *governsID_oid;
117 uint32_t governsID_id;
118 struct GUID schemaIDGUID;
119 struct GUID objectGUID;
121 uint32_t objectClassCategory;
122 const char *rDNAttID;
123 const char *defaultObjectCategory;
125 const char *subClassOf;
127 const char **systemAuxiliaryClass;
128 const char **systemPossSuperiors;
129 const char **systemMustContain;
130 const char **systemMayContain;
132 const char **auxiliaryClass;
133 const char **possSuperiors;
134 const char **mustContain;
135 const char **mayContain;
136 const char **possibleInferiors;
137 const char **systemPossibleInferiors;
139 const char *defaultSecurityDescriptor;
141 uint32_t schemaFlagsEx;
142 struct ldb_val msDs_Schema_Extensions;
144 bool showInAdvancedViewOnly;
145 const char *adminDisplayName;
146 const char *adminDescription;
147 const char *classDisplayName;
148 bool defaultHidingValue;
152 const char **supclasses;
153 const char **subclasses;
154 const char **subclasses_direct;
155 const char **posssuperiors;
156 uint32_t subClassOf_id;
157 uint32_t *systemAuxiliaryClass_ids;
158 uint32_t *auxiliaryClass_ids;
159 uint32_t *systemMayContain_ids;
160 uint32_t *systemMustContain_ids;
161 uint32_t *possSuperiors_ids;
162 uint32_t *mustContain_ids;
163 uint32_t *mayContain_ids;
164 uint32_t *systemPossSuperiors_ids;
166 /* An ordered index showing how this subClass fits into the
167 * subClass tree. that is, an objectclass that is not
168 * subClassOf anything is 0 (just in case), and top is 1, and
169 * subClasses of top are 2, subclasses of those classes are
171 uint32_t subClass_order;
175 * data stored in schemaInfo attribute
177 struct dsdb_schema_info {
179 struct GUID invocation_id;
184 struct ldb_dn *base_dn;
186 struct dsdb_schema_prefixmap *prefixmap;
189 * the last element of the prefix mapping table isn't a oid,
190 * it starts with 0xFF and has 21 bytes and is maybe a schema
193 * this is the content of the schemaInfo attribute of the
194 * Schema-Partition head object.
196 const char *schema_info;
198 /* We can also tell the schema version from the USN on the partition */
201 struct dsdb_attribute *attributes;
202 struct dsdb_class *classes;
204 /* lists of classes sorted by various attributes, for faster
206 uint32_t num_classes;
207 struct dsdb_class **classes_by_lDAPDisplayName;
208 struct dsdb_class **classes_by_governsID_id;
209 struct dsdb_class **classes_by_governsID_oid;
210 struct dsdb_class **classes_by_cn;
212 /* lists of attributes sorted by various fields */
213 uint32_t num_attributes;
214 struct dsdb_attribute **attributes_by_lDAPDisplayName;
215 struct dsdb_attribute **attributes_by_attributeID_id;
216 struct dsdb_attribute **attributes_by_attributeID_oid;
217 struct dsdb_attribute **attributes_by_linkID;
218 uint32_t num_int_id_attr;
219 struct dsdb_attribute **attributes_by_msDS_IntId;
223 struct ldb_dn *master_dn;
226 /* Was this schema loaded from ldb (if so, then we will reload it when we detect a change in ldb) */
227 struct ldb_module *loaded_from_module;
228 struct dsdb_schema *(*refresh_fn)(struct ldb_module *module, struct dsdb_schema *schema, bool is_global_schema);
229 bool refresh_in_progress;
230 /* an 'opaque' sequence number that the reload function may also wish to use */
231 uint64_t reload_seq_number;
233 /* Should the syntax handlers in this case handle all incoming OIDs automatically, assigning them as an OID if no text name is known? */
234 bool relax_OID_conversions;
237 enum dsdb_attr_list_query {
239 DSDB_SCHEMA_ALL_MUST,
241 DSDB_SCHEMA_SYS_MUST,
247 enum dsdb_schema_convert_target {
250 TARGET_AD_SCHEMA_SUBENTRY
253 #include "dsdb/schema/proto.h"
255 #endif /* _DSDB_SCHEMA_H */