2 Unix SMB/CIFS mplementation.
5 Copyright (C) Stefan Metzmacher <metze@samba.org> 2006-2007
6 Copyright (C) Andrew Bartlett <abartlet@samba.org> 2006-2008
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #include "dsdb/samdb/samdb.h"
25 #include "lib/ldb/include/ldb_errors.h"
26 #include "../lib/util/dlinklist.h"
27 #include "librpc/gen_ndr/ndr_misc.h"
28 #include "librpc/gen_ndr/ndr_drsuapi.h"
29 #include "librpc/gen_ndr/ndr_drsblobs.h"
30 #include "param/param.h"
31 #include "lib/ldb/include/ldb_module.h"
32 #include "../lib/util/asn1.h"
35 struct dsdb_schema *dsdb_new_schema(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience)
37 struct dsdb_schema *schema = talloc_zero(mem_ctx, struct dsdb_schema);
42 schema->iconv_convenience = iconv_convenience;
47 WERROR dsdb_load_prefixmap_from_drsuapi(struct dsdb_schema *schema,
48 const struct drsuapi_DsReplicaOIDMapping_Ctr *ctr)
51 const char *schema_info;
52 struct dsdb_schema_prefixmap *pfm;
54 werr = dsdb_schema_pfm_from_drsuapi_pfm(ctr, true, schema, &pfm, &schema_info);
55 W_ERROR_NOT_OK_RETURN(werr);
57 /* set loaded prefixMap */
58 talloc_free(schema->prefixmap);
59 schema->prefixmap = pfm;
61 talloc_free(discard_const(schema->schema_info));
62 schema->schema_info = schema_info;
67 static WERROR _dsdb_prefixmap_from_ldb_val(const struct ldb_val *pfm_ldb_val,
68 struct smb_iconv_convenience *iconv_convenience,
70 struct dsdb_schema_prefixmap **_pfm)
73 enum ndr_err_code ndr_err;
74 struct prefixMapBlob pfm_blob;
76 TALLOC_CTX *temp_ctx = talloc_new(mem_ctx);
77 W_ERROR_HAVE_NO_MEMORY(temp_ctx);
79 ndr_err = ndr_pull_struct_blob(pfm_ldb_val, temp_ctx,
80 iconv_convenience, &pfm_blob,
81 (ndr_pull_flags_fn_t)ndr_pull_prefixMapBlob);
82 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
83 NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err);
84 talloc_free(temp_ctx);
85 return ntstatus_to_werror(nt_status);
88 if (pfm_blob.version != PREFIX_MAP_VERSION_DSDB) {
89 DEBUG(0,("_dsdb_prefixmap_from_ldb_val: pfm_blob->version incorrect\n"));
90 talloc_free(temp_ctx);
91 return WERR_VERSION_PARSE_ERROR;
94 /* call the drsuapi version */
95 werr = dsdb_schema_pfm_from_drsuapi_pfm(&pfm_blob.ctr.dsdb, false, mem_ctx, _pfm, NULL);
97 talloc_free(temp_ctx);
102 WERROR dsdb_load_oid_mappings_ldb(struct dsdb_schema *schema,
103 const struct ldb_val *prefixMap,
104 const struct ldb_val *schemaInfo)
107 const char *schema_info;
108 struct dsdb_schema_prefixmap *pfm;
111 /* verify input params */
112 if (schemaInfo->length != 21) {
113 return WERR_INVALID_PARAMETER;
115 if (schemaInfo->data[0] != 0xFF) {
116 return WERR_INVALID_PARAMETER;
119 mem_ctx = talloc_new(schema);
120 W_ERROR_HAVE_NO_MEMORY(mem_ctx);
122 /* fetch prefixMap */
123 status = _dsdb_prefixmap_from_ldb_val(prefixMap,
124 schema->iconv_convenience,
126 W_ERROR_NOT_OK_RETURN(status);
128 /* decode schema_info */
129 schema_info = hex_encode_talloc(mem_ctx,
133 talloc_free(mem_ctx);
137 /* store prefixMap and schema_info into cached Schema */
138 talloc_free(schema->prefixmap);
139 schema->prefixmap = talloc_steal(schema, pfm);
141 talloc_free(discard_const(schema->schema_info));
142 schema->schema_info = talloc_steal(schema, schema_info);
144 /* clean up locally allocated mem */
145 talloc_free(mem_ctx);
150 WERROR dsdb_get_oid_mappings_drsuapi(const struct dsdb_schema *schema,
151 bool include_schema_info,
153 struct drsuapi_DsReplicaOIDMapping_Ctr **_ctr)
155 return dsdb_drsuapi_pfm_from_schema_pfm(schema->prefixmap,
156 include_schema_info ? schema->schema_info : NULL,
160 WERROR dsdb_get_oid_mappings_ldb(const struct dsdb_schema *schema,
162 struct ldb_val *prefixMap,
163 struct ldb_val *schemaInfo)
166 enum ndr_err_code ndr_err;
167 struct drsuapi_DsReplicaOIDMapping_Ctr *ctr;
168 struct prefixMapBlob pfm;
170 status = dsdb_get_oid_mappings_drsuapi(schema, false, mem_ctx, &ctr);
171 W_ERROR_NOT_OK_RETURN(status);
173 pfm.version = PREFIX_MAP_VERSION_DSDB;
177 ndr_err = ndr_push_struct_blob(prefixMap, mem_ctx, schema->iconv_convenience, &pfm, (ndr_push_flags_fn_t)ndr_push_prefixMapBlob);
179 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
180 NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err);
181 return ntstatus_to_werror(nt_status);
184 *schemaInfo = strhex_to_data_blob(mem_ctx, schema->schema_info);
185 W_ERROR_HAVE_NO_MEMORY(schemaInfo->data);
192 * this function is called from within a ldb transaction from the schema_fsmo module
194 WERROR dsdb_create_prefix_mapping(struct ldb_context *ldb, struct dsdb_schema *schema, const char *full_oid)
199 struct dsdb_schema_prefixmap *pfm;
201 mem_ctx = talloc_new(ldb);
202 W_ERROR_HAVE_NO_MEMORY(mem_ctx);
204 /* Read prefixes from disk*/
205 status = dsdb_read_prefixes_from_ldb(ldb, mem_ctx, &pfm);
206 if (!W_ERROR_IS_OK(status)) {
207 DEBUG(0,("dsdb_create_prefix_mapping: dsdb_read_prefixes_from_ldb: %s\n",
208 win_errstr(status)));
209 talloc_free(mem_ctx);
213 /* Check if there is a prefix for the oid in the prefixes array*/
214 status = dsdb_schema_pfm_find_oid(pfm, full_oid, NULL);
215 if (W_ERROR_IS_OK(status)) {
217 talloc_free(mem_ctx);
219 } else if (!W_ERROR_EQUAL(WERR_DS_NO_MSDS_INTID, status)) {
221 DEBUG(0,("dsdb_create_prefix_mapping: dsdb_find_prefix_for_oid: %s\n",
222 win_errstr(status)));
223 talloc_free(mem_ctx);
227 /* Create the new mapping for the prefix of full_oid */
228 status = dsdb_schema_pfm_make_attid(pfm, full_oid, &attid);
229 if (!W_ERROR_IS_OK(status)) {
230 DEBUG(0,("dsdb_create_prefix_mapping: dsdb_schema_pfm_make_attid: %s\n",
231 win_errstr(status)));
232 talloc_free(mem_ctx);
236 talloc_unlink(schema, schema->prefixmap);
237 schema->prefixmap = talloc_steal(schema, pfm);
239 /* Update prefixMap in ldb*/
240 status = dsdb_write_prefixes_from_schema_to_ldb(mem_ctx, ldb, schema);
241 if (!W_ERROR_IS_OK(status)) {
242 DEBUG(0,("dsdb_create_prefix_mapping: dsdb_write_prefixes_to_ldb: %s\n",
243 win_errstr(status)));
244 talloc_free(mem_ctx);
248 DEBUG(2,(__location__ " Added prefixMap %s - now have %u prefixes\n",
249 full_oid, schema->prefixmap->length));
251 talloc_free(mem_ctx);
255 WERROR dsdb_prefix_map_update(TALLOC_CTX *mem_ctx, uint32_t *num_prefixes, struct dsdb_schema_oid_prefix **prefixes, const char *oid)
257 uint32_t new_num_prefixes, index_new_prefix, new_entry_id;
258 const char* lastDotOffset;
261 new_num_prefixes = *num_prefixes + 1;
262 index_new_prefix = *num_prefixes;
265 * this is the algorithm we use to create new mappings for now
267 * TODO: find what algorithm windows use
269 new_entry_id = (*num_prefixes)<<16;
271 /* Extract the prefix from the oid*/
272 lastDotOffset = strrchr(oid, '.');
273 if (lastDotOffset == NULL) {
274 DEBUG(0,("dsdb_prefix_map_update: failed to find the last dot\n"));
275 return WERR_NOT_FOUND;
278 /* Calculate the size of the remainig string that should be the prefix of it */
279 size = strlen(oid) - strlen(lastDotOffset);
281 DEBUG(0,("dsdb_prefix_map_update: size of the remaining string invalid\n"));
285 /* Create a spot in the prefixMap for one more prefix*/
286 (*prefixes) = talloc_realloc(mem_ctx, *prefixes, struct dsdb_schema_oid_prefix, new_num_prefixes);
287 W_ERROR_HAVE_NO_MEMORY(*prefixes);
289 /* Add the new prefix entry*/
290 (*prefixes)[index_new_prefix].id = new_entry_id;
291 (*prefixes)[index_new_prefix].oid = talloc_strndup(mem_ctx, oid, size);
292 (*prefixes)[index_new_prefix].oid_len = strlen((*prefixes)[index_new_prefix].oid);
294 /* Increase num_prefixes because new prefix has been added */
300 WERROR dsdb_find_prefix_for_oid(uint32_t num_prefixes, const struct dsdb_schema_oid_prefix *prefixes, const char *in, uint32_t *out)
308 /* make oid prefix, i.e. oid w/o last subidentifier */
309 pstr = strrchr(in, '.');
310 if (!pstr) return WERR_INVALID_PARAM;
311 if (pstr < in) return WERR_INVALID_PARAM;
312 if ((pstr - in) < 4) return WERR_INVALID_PARAM;
314 oid_prefix = talloc_strndup(0, in, pstr - in);
316 for (i=0; i < num_prefixes; i++) {
317 if (strcmp(prefixes[i].oid, oid_prefix) == 0) {
322 talloc_free(oid_prefix);
324 if (i < num_prefixes) {
325 /* move next to '.' char */
328 val = strtoul(pstr, &end_str, 10);
329 if (end_str[0] != '\0') {
330 return WERR_INVALID_PARAM;
331 } else if (val > 0xFFFF) {
332 return WERR_INVALID_PARAM;
335 *out = prefixes[i].id | val;
339 DEBUG(5,(__location__ " Failed to find oid %s - have %u prefixes\n", in, num_prefixes));
341 return WERR_DS_NO_MSDS_INTID;
344 WERROR dsdb_write_prefixes_from_schema_to_ldb(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
345 const struct dsdb_schema *schema)
349 struct ldb_message *msg;
350 struct ldb_dn *schema_dn;
351 struct prefixMapBlob pfm_blob;
352 struct ldb_val ndr_blob;
353 enum ndr_err_code ndr_err;
354 TALLOC_CTX *temp_ctx;
355 struct drsuapi_DsReplicaOIDMapping_Ctr *ctr;
357 schema_dn = samdb_schema_dn(ldb);
359 DEBUG(0,("dsdb_write_prefixes_from_schema_to_ldb: no schema dn present\n"));
363 temp_ctx = talloc_new(mem_ctx);
364 W_ERROR_HAVE_NO_MEMORY(temp_ctx);
366 /* convert schema_prefixMap to prefixMap blob */
367 status = dsdb_get_oid_mappings_drsuapi(schema, false, temp_ctx, &ctr);
368 if (!W_ERROR_IS_OK(status)) {
369 talloc_free(temp_ctx);
373 pfm_blob.version = PREFIX_MAP_VERSION_DSDB;
374 pfm_blob.ctr.dsdb = *ctr;
376 ndr_err = ndr_push_struct_blob(&ndr_blob, temp_ctx,
377 lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")),
379 (ndr_push_flags_fn_t)ndr_push_prefixMapBlob);
380 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
381 talloc_free(temp_ctx);
385 /* write serialized prefixMap into LDB */
386 msg = ldb_msg_new(temp_ctx);
388 talloc_free(temp_ctx);
393 ldb_ret = ldb_msg_add_value(msg, "prefixMap", &ndr_blob, NULL);
395 talloc_free(temp_ctx);
396 DEBUG(0,("dsdb_write_prefixes_from_schema_to_ldb: ldb_msg_add_value failed\n"));
400 ldb_ret = samdb_replace( ldb, msg, msg );
402 talloc_free(temp_ctx);
405 DEBUG(0,("dsdb_write_prefixes_from_schema_to_ldb: samdb_replace failed\n"));
412 WERROR dsdb_read_prefixes_from_ldb(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, struct dsdb_schema_prefixmap **_pfm)
416 const struct ldb_val *prefix_val;
417 struct smb_iconv_convenience *iconv_convenience;
418 struct ldb_dn *schema_dn;
419 struct ldb_result *schema_res = NULL;
420 static const char *schema_attrs[] = {
425 schema_dn = samdb_schema_dn(ldb);
427 DEBUG(0,("dsdb_read_prefixes_from_ldb: no schema dn present\n"));
431 ldb_ret = ldb_search(ldb, mem_ctx, &schema_res, schema_dn, LDB_SCOPE_BASE, schema_attrs, NULL);
432 if (ldb_ret == LDB_ERR_NO_SUCH_OBJECT) {
433 DEBUG(0,("dsdb_read_prefixes_from_ldb: no prefix map present\n"));
434 talloc_free(schema_res);
436 } else if (ldb_ret != LDB_SUCCESS) {
437 DEBUG(0,("dsdb_read_prefixes_from_ldb: failed to search the schema head\n"));
438 talloc_free(schema_res);
442 prefix_val = ldb_msg_find_ldb_val(schema_res->msgs[0], "prefixMap");
444 DEBUG(0,("dsdb_read_prefixes_from_ldb: no prefixMap attribute found\n"));
445 talloc_free(schema_res);
449 iconv_convenience = lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm"));
451 werr = _dsdb_prefixmap_from_ldb_val(prefix_val,
455 talloc_free(schema_res);
456 W_ERROR_NOT_OK_RETURN(werr);
462 this will be replaced with something that looks at the right part of
463 the schema once we know where unique indexing information is hidden
465 static bool dsdb_schema_unique_attribute(const char *attr)
467 const char *attrs[] = { "objectGUID", "objectSID" , NULL };
469 for (i=0;attrs[i];i++) {
470 if (strcasecmp(attr, attrs[i]) == 0) {
479 setup the ldb_schema_attribute field for a dsdb_attribute
481 static int dsdb_schema_setup_ldb_schema_attribute(struct ldb_context *ldb,
482 struct dsdb_attribute *attr)
484 const char *syntax = attr->syntax->ldb_syntax;
485 const struct ldb_schema_syntax *s;
486 struct ldb_schema_attribute *a;
489 syntax = attr->syntax->ldap_oid;
492 s = ldb_samba_syntax_by_lDAPDisplayName(ldb, attr->lDAPDisplayName);
494 s = ldb_samba_syntax_by_name(ldb, syntax);
497 s = ldb_standard_syntax_by_name(ldb, syntax);
501 return LDB_ERR_OPERATIONS_ERROR;
504 attr->ldb_schema_attribute = a = talloc(attr, struct ldb_schema_attribute);
505 if (attr->ldb_schema_attribute == NULL) {
507 return LDB_ERR_OPERATIONS_ERROR;
510 a->name = attr->lDAPDisplayName;
514 if (dsdb_schema_unique_attribute(a->name)) {
515 a->flags |= LDB_ATTR_FLAG_UNIQUE_INDEX;
517 if (attr->isSingleValued) {
518 a->flags |= LDB_ATTR_FLAG_SINGLE_VALUE;
526 #define GET_STRING_LDB(msg, attr, mem_ctx, p, elem, strict) do { \
527 const struct ldb_val *get_string_val = ldb_msg_find_ldb_val(msg, attr); \
528 if (get_string_val == NULL) { \
530 d_printf("%s: %s == NULL\n", __location__, attr); \
531 return WERR_INVALID_PARAM; \
536 (p)->elem = talloc_strndup(mem_ctx, \
537 (const char *)get_string_val->data, \
538 get_string_val->length); \
540 d_printf("%s: talloc_strndup failed for %s\n", __location__, attr); \
546 #define GET_STRING_LIST_LDB(msg, attr, mem_ctx, p, elem, strict) do { \
547 int get_string_list_counter; \
548 struct ldb_message_element *get_string_list_el = ldb_msg_find_element(msg, attr); \
549 if (get_string_list_el == NULL) { \
551 d_printf("%s: %s == NULL\n", __location__, attr); \
552 return WERR_INVALID_PARAM; \
558 (p)->elem = talloc_array(mem_ctx, const char *, get_string_list_el->num_values + 1); \
559 for (get_string_list_counter=0; \
560 get_string_list_counter < get_string_list_el->num_values; \
561 get_string_list_counter++) { \
562 (p)->elem[get_string_list_counter] = talloc_strndup((p)->elem, \
563 (const char *)get_string_list_el->values[get_string_list_counter].data, \
564 get_string_list_el->values[get_string_list_counter].length); \
565 if (!(p)->elem[get_string_list_counter]) { \
566 d_printf("%s: talloc_strndup failed for %s\n", __location__, attr); \
569 (p)->elem[get_string_list_counter+1] = NULL; \
571 talloc_steal(mem_ctx, (p)->elem); \
574 #define GET_BOOL_LDB(msg, attr, p, elem, strict) do { \
576 str = samdb_result_string(msg, attr, NULL);\
579 d_printf("%s: %s == NULL\n", __location__, attr); \
580 return WERR_INVALID_PARAM; \
584 } else if (strcasecmp("TRUE", str) == 0) { \
586 } else if (strcasecmp("FALSE", str) == 0) { \
589 d_printf("%s: %s == %s\n", __location__, attr, str); \
590 return WERR_INVALID_PARAM; \
594 #define GET_UINT32_LDB(msg, attr, p, elem) do { \
595 (p)->elem = samdb_result_uint(msg, attr, 0);\
598 #define GET_UINT32_PTR_LDB(msg, attr, p, elem) do { \
599 uint64_t _v = samdb_result_uint64(msg, attr, UINT64_MAX);\
600 if (_v == UINT64_MAX) { \
602 } else if (_v > UINT32_MAX) { \
603 d_printf("%s: %s == 0x%llX\n", __location__, \
604 attr, (unsigned long long)_v); \
605 return WERR_INVALID_PARAM; \
607 (p)->elem = talloc(mem_ctx, uint32_t); \
609 d_printf("%s: talloc failed for %s\n", __location__, attr); \
612 *(p)->elem = (uint32_t)_v; \
616 #define GET_GUID_LDB(msg, attr, p, elem) do { \
617 (p)->elem = samdb_result_guid(msg, attr);\
620 #define GET_BLOB_LDB(msg, attr, mem_ctx, p, elem) do { \
621 const struct ldb_val *_val;\
622 _val = ldb_msg_find_ldb_val(msg, attr);\
625 talloc_steal(mem_ctx, (p)->elem.data);\
627 ZERO_STRUCT((p)->elem);\
631 WERROR dsdb_attribute_from_ldb(struct ldb_context *ldb,
632 const struct dsdb_schema *schema,
633 struct ldb_message *msg,
635 struct dsdb_attribute *attr)
639 GET_STRING_LDB(msg, "cn", mem_ctx, attr, cn, false);
640 GET_STRING_LDB(msg, "lDAPDisplayName", mem_ctx, attr, lDAPDisplayName, true);
641 GET_STRING_LDB(msg, "attributeID", mem_ctx, attr, attributeID_oid, true);
642 if (schema->num_prefixes == 0) {
643 /* set an invalid value */
644 attr->attributeID_id = 0xFFFFFFFF;
646 status = dsdb_schema_pfm_make_attid(schema->prefixmap,
647 attr->attributeID_oid,
648 &attr->attributeID_id);
649 if (!W_ERROR_IS_OK(status)) {
650 DEBUG(0,("%s: '%s': unable to map attributeID %s: %s\n",
651 __location__, attr->lDAPDisplayName, attr->attributeID_oid,
652 win_errstr(status)));
656 GET_GUID_LDB(msg, "schemaIDGUID", attr, schemaIDGUID);
657 GET_UINT32_LDB(msg, "mAPIID", attr, mAPIID);
659 GET_GUID_LDB(msg, "attributeSecurityGUID", attr, attributeSecurityGUID);
661 GET_UINT32_LDB(msg, "searchFlags", attr, searchFlags);
662 GET_UINT32_LDB(msg, "systemFlags", attr, systemFlags);
663 GET_BOOL_LDB(msg, "isMemberOfPartialAttributeSet", attr, isMemberOfPartialAttributeSet, false);
664 GET_UINT32_LDB(msg, "linkID", attr, linkID);
666 GET_STRING_LDB(msg, "attributeSyntax", mem_ctx, attr, attributeSyntax_oid, true);
667 if (schema->num_prefixes == 0) {
668 /* set an invalid value */
669 attr->attributeSyntax_id = 0xFFFFFFFF;
671 status = dsdb_schema_pfm_make_attid(schema->prefixmap,
672 attr->attributeSyntax_oid,
673 &attr->attributeSyntax_id);
674 if (!W_ERROR_IS_OK(status)) {
675 DEBUG(0,("%s: '%s': unable to map attributeSyntax_ %s: %s\n",
676 __location__, attr->lDAPDisplayName, attr->attributeSyntax_oid,
677 win_errstr(status)));
681 GET_UINT32_LDB(msg, "oMSyntax", attr, oMSyntax);
682 GET_BLOB_LDB(msg, "oMObjectClass", mem_ctx, attr, oMObjectClass);
684 GET_BOOL_LDB(msg, "isSingleValued", attr, isSingleValued, true);
685 GET_UINT32_PTR_LDB(msg, "rangeLower", attr, rangeLower);
686 GET_UINT32_PTR_LDB(msg, "rangeUpper", attr, rangeUpper);
687 GET_BOOL_LDB(msg, "extendedCharsAllowed", attr, extendedCharsAllowed, false);
689 GET_UINT32_LDB(msg, "schemaFlagsEx", attr, schemaFlagsEx);
690 GET_BLOB_LDB(msg, "msDs-Schema-Extensions", mem_ctx, attr, msDs_Schema_Extensions);
692 GET_BOOL_LDB(msg, "showInAdvancedViewOnly", attr, showInAdvancedViewOnly, false);
693 GET_STRING_LDB(msg, "adminDisplayName", mem_ctx, attr, adminDisplayName, false);
694 GET_STRING_LDB(msg, "adminDescription", mem_ctx, attr, adminDescription, false);
695 GET_STRING_LDB(msg, "classDisplayName", mem_ctx, attr, classDisplayName, false);
696 GET_BOOL_LDB(msg, "isEphemeral", attr, isEphemeral, false);
697 GET_BOOL_LDB(msg, "isDefunct", attr, isDefunct, false);
698 GET_BOOL_LDB(msg, "systemOnly", attr, systemOnly, false);
700 attr->syntax = dsdb_syntax_for_attribute(attr);
702 return WERR_DS_ATT_SCHEMA_REQ_SYNTAX;
705 if (dsdb_schema_setup_ldb_schema_attribute(ldb, attr) != LDB_SUCCESS) {
706 return WERR_DS_ATT_SCHEMA_REQ_SYNTAX;
712 WERROR dsdb_class_from_ldb(const struct dsdb_schema *schema,
713 struct ldb_message *msg,
715 struct dsdb_class *obj)
719 GET_STRING_LDB(msg, "cn", mem_ctx, obj, cn, false);
720 GET_STRING_LDB(msg, "lDAPDisplayName", mem_ctx, obj, lDAPDisplayName, true);
721 GET_STRING_LDB(msg, "governsID", mem_ctx, obj, governsID_oid, true);
722 if (schema->num_prefixes == 0) {
723 /* set an invalid value */
724 obj->governsID_id = 0xFFFFFFFF;
726 status = dsdb_schema_pfm_make_attid(schema->prefixmap,
729 if (!W_ERROR_IS_OK(status)) {
730 DEBUG(0,("%s: '%s': unable to map governsID %s: %s\n",
731 __location__, obj->lDAPDisplayName, obj->governsID_oid,
732 win_errstr(status)));
736 GET_GUID_LDB(msg, "schemaIDGUID", obj, schemaIDGUID);
738 GET_UINT32_LDB(msg, "objectClassCategory", obj, objectClassCategory);
739 GET_STRING_LDB(msg, "rDNAttID", mem_ctx, obj, rDNAttID, false);
740 GET_STRING_LDB(msg, "defaultObjectCategory", mem_ctx, obj, defaultObjectCategory, true);
742 GET_STRING_LDB(msg, "subClassOf", mem_ctx, obj, subClassOf, true);
744 GET_STRING_LIST_LDB(msg, "systemAuxiliaryClass", mem_ctx, obj, systemAuxiliaryClass, false);
745 GET_STRING_LIST_LDB(msg, "auxiliaryClass", mem_ctx, obj, auxiliaryClass, false);
747 GET_STRING_LIST_LDB(msg, "systemMustContain", mem_ctx, obj, systemMustContain, false);
748 GET_STRING_LIST_LDB(msg, "systemMayContain", mem_ctx, obj, systemMayContain, false);
749 GET_STRING_LIST_LDB(msg, "mustContain", mem_ctx, obj, mustContain, false);
750 GET_STRING_LIST_LDB(msg, "mayContain", mem_ctx, obj, mayContain, false);
752 GET_STRING_LIST_LDB(msg, "systemPossSuperiors", mem_ctx, obj, systemPossSuperiors, false);
753 GET_STRING_LIST_LDB(msg, "possSuperiors", mem_ctx, obj, possSuperiors, false);
755 GET_STRING_LDB(msg, "defaultSecurityDescriptor", mem_ctx, obj, defaultSecurityDescriptor, false);
757 GET_UINT32_LDB(msg, "schemaFlagsEx", obj, schemaFlagsEx);
758 GET_BLOB_LDB(msg, "msDs-Schema-Extensions", mem_ctx, obj, msDs_Schema_Extensions);
760 GET_BOOL_LDB(msg, "showInAdvancedViewOnly", obj, showInAdvancedViewOnly, false);
761 GET_STRING_LDB(msg, "adminDisplayName", mem_ctx, obj, adminDisplayName, false);
762 GET_STRING_LDB(msg, "adminDescription", mem_ctx, obj, adminDescription, false);
763 GET_STRING_LDB(msg, "classDisplayName", mem_ctx, obj, classDisplayName, false);
764 GET_BOOL_LDB(msg, "defaultHidingValue", obj, defaultHidingValue, false);
765 GET_BOOL_LDB(msg, "isDefunct", obj, isDefunct, false);
766 GET_BOOL_LDB(msg, "systemOnly", obj, systemOnly, false);
771 #define dsdb_oom(error_string, mem_ctx) *error_string = talloc_asprintf(mem_ctx, "dsdb out of memory at %s:%d\n", __FILE__, __LINE__)
774 Create a DSDB schema from the ldb results provided. This is called
775 directly when the schema is provisioned from an on-disk LDIF file, or
776 from dsdb_schema_from_schema_dn in schema_fsmo
779 int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
780 struct smb_iconv_convenience *iconv_convenience,
781 struct ldb_result *schema_res,
782 struct ldb_result *attrs_res, struct ldb_result *objectclass_res,
783 struct dsdb_schema **schema_out,
788 const struct ldb_val *prefix_val;
789 const struct ldb_val *info_val;
790 struct ldb_val info_val_default;
791 struct dsdb_schema *schema;
793 schema = dsdb_new_schema(mem_ctx, iconv_convenience);
795 dsdb_oom(error_string, mem_ctx);
796 return LDB_ERR_OPERATIONS_ERROR;
799 prefix_val = ldb_msg_find_ldb_val(schema_res->msgs[0], "prefixMap");
801 *error_string = talloc_asprintf(mem_ctx,
802 "schema_fsmo_init: no prefixMap attribute found");
803 DEBUG(0,(__location__ ": %s\n", *error_string));
804 return LDB_ERR_CONSTRAINT_VIOLATION;
806 info_val = ldb_msg_find_ldb_val(schema_res->msgs[0], "schemaInfo");
808 info_val_default = strhex_to_data_blob(mem_ctx, "FF0000000000000000000000000000000000000000");
809 if (!info_val_default.data) {
810 dsdb_oom(error_string, mem_ctx);
811 return LDB_ERR_OPERATIONS_ERROR;
813 info_val = &info_val_default;
816 status = dsdb_load_oid_mappings_ldb(schema, prefix_val, info_val);
817 if (!W_ERROR_IS_OK(status)) {
818 *error_string = talloc_asprintf(mem_ctx,
819 "schema_fsmo_init: failed to load oid mappings: %s",
821 DEBUG(0,(__location__ ": %s\n", *error_string));
822 return LDB_ERR_CONSTRAINT_VIOLATION;
825 for (i=0; i < attrs_res->count; i++) {
826 struct dsdb_attribute *sa;
828 sa = talloc_zero(schema, struct dsdb_attribute);
830 dsdb_oom(error_string, mem_ctx);
831 return LDB_ERR_OPERATIONS_ERROR;
834 status = dsdb_attribute_from_ldb(ldb, schema, attrs_res->msgs[i], sa, sa);
835 if (!W_ERROR_IS_OK(status)) {
836 *error_string = talloc_asprintf(mem_ctx,
837 "schema_fsmo_init: failed to load attribute definition: %s:%s",
838 ldb_dn_get_linearized(attrs_res->msgs[i]->dn),
840 DEBUG(0,(__location__ ": %s\n", *error_string));
841 return LDB_ERR_CONSTRAINT_VIOLATION;
844 DLIST_ADD(schema->attributes, sa);
847 for (i=0; i < objectclass_res->count; i++) {
848 struct dsdb_class *sc;
850 sc = talloc_zero(schema, struct dsdb_class);
852 dsdb_oom(error_string, mem_ctx);
853 return LDB_ERR_OPERATIONS_ERROR;
856 status = dsdb_class_from_ldb(schema, objectclass_res->msgs[i], sc, sc);
857 if (!W_ERROR_IS_OK(status)) {
858 *error_string = talloc_asprintf(mem_ctx,
859 "schema_fsmo_init: failed to load class definition: %s:%s",
860 ldb_dn_get_linearized(objectclass_res->msgs[i]->dn),
862 DEBUG(0,(__location__ ": %s\n", *error_string));
863 return LDB_ERR_CONSTRAINT_VIOLATION;
866 DLIST_ADD(schema->classes, sc);
869 schema->fsmo.master_dn = ldb_msg_find_attr_as_dn(ldb, schema, schema_res->msgs[0], "fSMORoleOwner");
870 if (ldb_dn_compare(samdb_ntds_settings_dn(ldb), schema->fsmo.master_dn) == 0) {
871 schema->fsmo.we_are_master = true;
873 schema->fsmo.we_are_master = false;
876 DEBUG(5, ("schema_fsmo_init: we are master: %s\n",
877 (schema->fsmo.we_are_master?"yes":"no")));
879 *schema_out = schema;
884 static const struct {
887 } name_mappings[] = {
889 { "name", "1.2.840.113556.1.4.1" },
890 { "lDAPDisplayName", "1.2.840.113556.1.2.460" },
891 { "attributeID", "1.2.840.113556.1.2.30" },
892 { "schemaIDGUID", "1.2.840.113556.1.4.148" },
893 { "mAPIID", "1.2.840.113556.1.2.49" },
894 { "attributeSecurityGUID", "1.2.840.113556.1.4.149" },
895 { "searchFlags", "1.2.840.113556.1.2.334" },
896 { "systemFlags", "1.2.840.113556.1.4.375" },
897 { "isMemberOfPartialAttributeSet", "1.2.840.113556.1.4.639" },
898 { "linkID", "1.2.840.113556.1.2.50" },
899 { "attributeSyntax", "1.2.840.113556.1.2.32" },
900 { "oMSyntax", "1.2.840.113556.1.2.231" },
901 { "oMObjectClass", "1.2.840.113556.1.2.218" },
902 { "isSingleValued", "1.2.840.113556.1.2.33" },
903 { "rangeLower", "1.2.840.113556.1.2.34" },
904 { "rangeUpper", "1.2.840.113556.1.2.35" },
905 { "extendedCharsAllowed", "1.2.840.113556.1.2.380" },
906 { "schemaFlagsEx", "1.2.840.113556.1.4.120" },
907 { "msDs-Schema-Extensions", "1.2.840.113556.1.4.1440" },
908 { "showInAdvancedViewOnly", "1.2.840.113556.1.2.169" },
909 { "adminDisplayName", "1.2.840.113556.1.2.194" },
910 { "adminDescription", "1.2.840.113556.1.2.226" },
911 { "classDisplayName", "1.2.840.113556.1.4.610" },
912 { "isEphemeral", "1.2.840.113556.1.4.1212" },
913 { "isDefunct", "1.2.840.113556.1.4.661" },
914 { "systemOnly", "1.2.840.113556.1.4.170" },
915 { "governsID", "1.2.840.113556.1.2.22" },
916 { "objectClassCategory", "1.2.840.113556.1.2.370" },
917 { "rDNAttID", "1.2.840.113556.1.2.26" },
918 { "defaultObjectCategory", "1.2.840.113556.1.4.783" },
919 { "subClassOf", "1.2.840.113556.1.2.21" },
920 { "systemAuxiliaryClass", "1.2.840.113556.1.4.198" },
921 { "systemPossSuperiors", "1.2.840.113556.1.4.195" },
922 { "systemMustContain", "1.2.840.113556.1.4.197" },
923 { "systemMayContain", "1.2.840.113556.1.4.196" },
924 { "auxiliaryClass", "1.2.840.113556.1.2.351" },
925 { "possSuperiors", "1.2.840.113556.1.2.8" },
926 { "mustContain", "1.2.840.113556.1.2.24" },
927 { "mayContain", "1.2.840.113556.1.2.25" },
928 { "defaultSecurityDescriptor", "1.2.840.113556.1.4.224" },
929 { "defaultHidingValue", "1.2.840.113556.1.4.518" },
932 static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb_schema *schema,
933 struct drsuapi_DsReplicaObject *obj,
939 const char *oid = NULL;
941 for(i=0; i < ARRAY_SIZE(name_mappings); i++) {
942 if (strcmp(name_mappings[i].name, name) != 0) continue;
944 oid = name_mappings[i].oid;
952 status = dsdb_schema_pfm_make_attid(schema->prefixmap, oid, &attid);
953 if (!W_ERROR_IS_OK(status)) {
957 for (i=0; i < obj->attribute_ctr.num_attributes; i++) {
958 if (obj->attribute_ctr.attributes[i].attid != attid) continue;
961 return &obj->attribute_ctr.attributes[i];
967 #define GET_STRING_DS(s, r, attr, mem_ctx, p, elem, strict) do { \
968 struct drsuapi_DsReplicaAttribute *_a; \
969 _a = dsdb_find_object_attr_name(s, r, attr, NULL); \
970 if (strict && !_a) { \
971 d_printf("%s: %s == NULL\n", __location__, attr); \
972 return WERR_INVALID_PARAM; \
974 if (strict && _a->value_ctr.num_values != 1) { \
975 d_printf("%s: %s num_values == %u\n", __location__, attr, \
976 _a->value_ctr.num_values); \
977 return WERR_INVALID_PARAM; \
979 if (_a && _a->value_ctr.num_values >= 1) { \
981 if (!convert_string_talloc_convenience(mem_ctx, s->iconv_convenience, CH_UTF16, CH_UNIX, \
982 _a->value_ctr.values[0].blob->data, \
983 _a->value_ctr.values[0].blob->length, \
984 (void **)discard_const(&(p)->elem), &_ret, false)) { \
985 DEBUG(0,("%s: invalid data!\n", attr)); \
987 _a->value_ctr.values[0].blob->data, \
988 _a->value_ctr.values[0].blob->length); \
989 return WERR_FOOBAR; \
996 #define GET_UINT32_LIST_DS(s, r, attr, mem_ctx, p, elem) do { \
998 struct drsuapi_DsReplicaAttribute *_a; \
999 _a = dsdb_find_object_attr_name(s, r, attr, NULL); \
1000 (p)->elem = _a ? talloc_array(mem_ctx, uint32_t, _a->value_ctr.num_values + 1) : NULL; \
1001 for (list_counter=0; \
1002 _a && list_counter < _a->value_ctr.num_values; \
1004 if (_a->value_ctr.values[list_counter].blob->length != 4) { \
1005 return WERR_INVALID_PARAM; \
1007 (p)->elem[list_counter] = IVAL(_a->value_ctr.values[list_counter].blob->data, 0); \
1009 if (_a) (p)->elem[list_counter] = 0; \
1012 #define GET_DN_DS(s, r, attr, mem_ctx, p, elem, strict) do { \
1013 struct drsuapi_DsReplicaAttribute *_a; \
1014 _a = dsdb_find_object_attr_name(s, r, attr, NULL); \
1015 if (strict && !_a) { \
1016 d_printf("%s: %s == NULL\n", __location__, attr); \
1017 return WERR_INVALID_PARAM; \
1019 if (strict && _a->value_ctr.num_values != 1) { \
1020 d_printf("%s: %s num_values == %u\n", __location__, attr, \
1021 _a->value_ctr.num_values); \
1022 return WERR_INVALID_PARAM; \
1024 if (strict && !_a->value_ctr.values[0].blob) { \
1025 d_printf("%s: %s data == NULL\n", __location__, attr); \
1026 return WERR_INVALID_PARAM; \
1028 if (_a && _a->value_ctr.num_values >= 1 \
1029 && _a->value_ctr.values[0].blob) { \
1030 struct drsuapi_DsReplicaObjectIdentifier3 _id3; \
1031 enum ndr_err_code _ndr_err; \
1032 _ndr_err = ndr_pull_struct_blob_all(_a->value_ctr.values[0].blob, \
1033 mem_ctx, s->iconv_convenience, &_id3,\
1034 (ndr_pull_flags_fn_t)ndr_pull_drsuapi_DsReplicaObjectIdentifier3);\
1035 if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
1036 NTSTATUS _nt_status = ndr_map_error2ntstatus(_ndr_err); \
1037 return ntstatus_to_werror(_nt_status); \
1039 (p)->elem = _id3.dn; \
1045 #define GET_BOOL_DS(s, r, attr, p, elem, strict) do { \
1046 struct drsuapi_DsReplicaAttribute *_a; \
1047 _a = dsdb_find_object_attr_name(s, r, attr, NULL); \
1048 if (strict && !_a) { \
1049 d_printf("%s: %s == NULL\n", __location__, attr); \
1050 return WERR_INVALID_PARAM; \
1052 if (strict && _a->value_ctr.num_values != 1) { \
1053 d_printf("%s: %s num_values == %u\n", __location__, attr, \
1054 (unsigned int)_a->value_ctr.num_values); \
1055 return WERR_INVALID_PARAM; \
1057 if (strict && !_a->value_ctr.values[0].blob) { \
1058 d_printf("%s: %s data == NULL\n", __location__, attr); \
1059 return WERR_INVALID_PARAM; \
1061 if (strict && _a->value_ctr.values[0].blob->length != 4) { \
1062 d_printf("%s: %s length == %u\n", __location__, attr, \
1063 (unsigned int)_a->value_ctr.values[0].blob->length); \
1064 return WERR_INVALID_PARAM; \
1066 if (_a && _a->value_ctr.num_values >= 1 \
1067 && _a->value_ctr.values[0].blob \
1068 && _a->value_ctr.values[0].blob->length == 4) { \
1069 (p)->elem = (IVAL(_a->value_ctr.values[0].blob->data,0)?true:false);\
1071 (p)->elem = false; \
1075 #define GET_UINT32_DS(s, r, attr, p, elem) do { \
1076 struct drsuapi_DsReplicaAttribute *_a; \
1077 _a = dsdb_find_object_attr_name(s, r, attr, NULL); \
1078 if (_a && _a->value_ctr.num_values >= 1 \
1079 && _a->value_ctr.values[0].blob \
1080 && _a->value_ctr.values[0].blob->length == 4) { \
1081 (p)->elem = IVAL(_a->value_ctr.values[0].blob->data,0);\
1087 #define GET_UINT32_PTR_DS(s, r, attr, p, elem) do { \
1088 struct drsuapi_DsReplicaAttribute *_a; \
1089 _a = dsdb_find_object_attr_name(s, r, attr, NULL); \
1090 if (_a && _a->value_ctr.num_values >= 1 \
1091 && _a->value_ctr.values[0].blob \
1092 && _a->value_ctr.values[0].blob->length == 4) { \
1093 (p)->elem = talloc(mem_ctx, uint32_t); \
1095 d_printf("%s: talloc failed for %s\n", __location__, attr); \
1096 return WERR_NOMEM; \
1098 *(p)->elem = IVAL(_a->value_ctr.values[0].blob->data,0);\
1104 #define GET_GUID_DS(s, r, attr, mem_ctx, p, elem) do { \
1105 struct drsuapi_DsReplicaAttribute *_a; \
1106 _a = dsdb_find_object_attr_name(s, r, attr, NULL); \
1107 if (_a && _a->value_ctr.num_values >= 1 \
1108 && _a->value_ctr.values[0].blob \
1109 && _a->value_ctr.values[0].blob->length == 16) { \
1110 enum ndr_err_code _ndr_err; \
1111 _ndr_err = ndr_pull_struct_blob_all(_a->value_ctr.values[0].blob, \
1112 mem_ctx, s->iconv_convenience, &(p)->elem, \
1113 (ndr_pull_flags_fn_t)ndr_pull_GUID); \
1114 if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
1115 NTSTATUS _nt_status = ndr_map_error2ntstatus(_ndr_err); \
1116 return ntstatus_to_werror(_nt_status); \
1119 ZERO_STRUCT((p)->elem);\
1123 #define GET_BLOB_DS(s, r, attr, mem_ctx, p, elem) do { \
1124 struct drsuapi_DsReplicaAttribute *_a; \
1125 _a = dsdb_find_object_attr_name(s, r, attr, NULL); \
1126 if (_a && _a->value_ctr.num_values >= 1 \
1127 && _a->value_ctr.values[0].blob) { \
1128 (p)->elem = *_a->value_ctr.values[0].blob;\
1129 talloc_steal(mem_ctx, (p)->elem.data); \
1131 ZERO_STRUCT((p)->elem);\
1135 WERROR dsdb_attribute_from_drsuapi(struct ldb_context *ldb,
1136 struct dsdb_schema *schema,
1137 struct drsuapi_DsReplicaObject *r,
1138 TALLOC_CTX *mem_ctx,
1139 struct dsdb_attribute *attr)
1143 GET_STRING_DS(schema, r, "name", mem_ctx, attr, cn, true);
1144 GET_STRING_DS(schema, r, "lDAPDisplayName", mem_ctx, attr, lDAPDisplayName, true);
1145 GET_UINT32_DS(schema, r, "attributeID", attr, attributeID_id);
1146 status = dsdb_schema_pfm_oid_from_attid(schema->prefixmap, attr->attributeID_id,
1147 mem_ctx, &attr->attributeID_oid);
1148 if (!W_ERROR_IS_OK(status)) {
1149 DEBUG(0,("%s: '%s': unable to map attributeID 0x%08X: %s\n",
1150 __location__, attr->lDAPDisplayName, attr->attributeID_id,
1151 win_errstr(status)));
1154 GET_GUID_DS(schema, r, "schemaIDGUID", mem_ctx, attr, schemaIDGUID);
1155 GET_UINT32_DS(schema, r, "mAPIID", attr, mAPIID);
1157 GET_GUID_DS(schema, r, "attributeSecurityGUID", mem_ctx, attr, attributeSecurityGUID);
1159 GET_UINT32_DS(schema, r, "searchFlags", attr, searchFlags);
1160 GET_UINT32_DS(schema, r, "systemFlags", attr, systemFlags);
1161 GET_BOOL_DS(schema, r, "isMemberOfPartialAttributeSet", attr, isMemberOfPartialAttributeSet, false);
1162 GET_UINT32_DS(schema, r, "linkID", attr, linkID);
1164 GET_UINT32_DS(schema, r, "attributeSyntax", attr, attributeSyntax_id);
1165 status = dsdb_schema_pfm_oid_from_attid(schema->prefixmap, attr->attributeSyntax_id,
1166 mem_ctx, &attr->attributeSyntax_oid);
1167 if (!W_ERROR_IS_OK(status)) {
1168 DEBUG(0,("%s: '%s': unable to map attributeSyntax 0x%08X: %s\n",
1169 __location__, attr->lDAPDisplayName, attr->attributeSyntax_id,
1170 win_errstr(status)));
1173 GET_UINT32_DS(schema, r, "oMSyntax", attr, oMSyntax);
1174 GET_BLOB_DS(schema, r, "oMObjectClass", mem_ctx, attr, oMObjectClass);
1176 GET_BOOL_DS(schema, r, "isSingleValued", attr, isSingleValued, true);
1177 GET_UINT32_PTR_DS(schema, r, "rangeLower", attr, rangeLower);
1178 GET_UINT32_PTR_DS(schema, r, "rangeUpper", attr, rangeUpper);
1179 GET_BOOL_DS(schema, r, "extendedCharsAllowed", attr, extendedCharsAllowed, false);
1181 GET_UINT32_DS(schema, r, "schemaFlagsEx", attr, schemaFlagsEx);
1182 GET_BLOB_DS(schema, r, "msDs-Schema-Extensions", mem_ctx, attr, msDs_Schema_Extensions);
1184 GET_BOOL_DS(schema, r, "showInAdvancedViewOnly", attr, showInAdvancedViewOnly, false);
1185 GET_STRING_DS(schema, r, "adminDisplayName", mem_ctx, attr, adminDisplayName, false);
1186 GET_STRING_DS(schema, r, "adminDescription", mem_ctx, attr, adminDescription, false);
1187 GET_STRING_DS(schema, r, "classDisplayName", mem_ctx, attr, classDisplayName, false);
1188 GET_BOOL_DS(schema, r, "isEphemeral", attr, isEphemeral, false);
1189 GET_BOOL_DS(schema, r, "isDefunct", attr, isDefunct, false);
1190 GET_BOOL_DS(schema, r, "systemOnly", attr, systemOnly, false);
1192 attr->syntax = dsdb_syntax_for_attribute(attr);
1193 if (!attr->syntax) {
1194 return WERR_DS_ATT_SCHEMA_REQ_SYNTAX;
1197 if (dsdb_schema_setup_ldb_schema_attribute(ldb, attr) != LDB_SUCCESS) {
1198 return WERR_DS_ATT_SCHEMA_REQ_SYNTAX;
1204 WERROR dsdb_class_from_drsuapi(struct dsdb_schema *schema,
1205 struct drsuapi_DsReplicaObject *r,
1206 TALLOC_CTX *mem_ctx,
1207 struct dsdb_class *obj)
1211 GET_STRING_DS(schema, r, "name", mem_ctx, obj, cn, true);
1212 GET_STRING_DS(schema, r, "lDAPDisplayName", mem_ctx, obj, lDAPDisplayName, true);
1213 GET_UINT32_DS(schema, r, "governsID", obj, governsID_id);
1214 status = dsdb_schema_pfm_oid_from_attid(schema->prefixmap, obj->governsID_id,
1215 mem_ctx, &obj->governsID_oid);
1216 if (!W_ERROR_IS_OK(status)) {
1217 DEBUG(0,("%s: '%s': unable to map governsID 0x%08X: %s\n",
1218 __location__, obj->lDAPDisplayName, obj->governsID_id,
1219 win_errstr(status)));
1222 GET_GUID_DS(schema, r, "schemaIDGUID", mem_ctx, obj, schemaIDGUID);
1224 GET_UINT32_DS(schema, r, "objectClassCategory", obj, objectClassCategory);
1225 GET_STRING_DS(schema, r, "rDNAttID", mem_ctx, obj, rDNAttID, false);
1226 GET_DN_DS(schema, r, "defaultObjectCategory", mem_ctx, obj, defaultObjectCategory, true);
1228 GET_UINT32_DS(schema, r, "subClassOf", obj, subClassOf_id);
1230 GET_UINT32_LIST_DS(schema, r, "systemAuxiliaryClass", mem_ctx, obj, systemAuxiliaryClass_ids);
1231 GET_UINT32_LIST_DS(schema, r, "auxiliaryClass", mem_ctx, obj, auxiliaryClass_ids);
1233 GET_UINT32_LIST_DS(schema, r, "systemMustContain", mem_ctx, obj, systemMustContain_ids);
1234 GET_UINT32_LIST_DS(schema, r, "systemMayContain", mem_ctx, obj, systemMayContain_ids);
1235 GET_UINT32_LIST_DS(schema, r, "mustContain", mem_ctx, obj, mustContain_ids);
1236 GET_UINT32_LIST_DS(schema, r, "mayContain", mem_ctx, obj, mayContain_ids);
1238 GET_UINT32_LIST_DS(schema, r, "systemPossSuperiors", mem_ctx, obj, systemPossSuperiors_ids);
1239 GET_UINT32_LIST_DS(schema, r, "possSuperiors", mem_ctx, obj, possSuperiors_ids);
1241 GET_STRING_DS(schema, r, "defaultSecurityDescriptor", mem_ctx, obj, defaultSecurityDescriptor, false);
1243 GET_UINT32_DS(schema, r, "schemaFlagsEx", obj, schemaFlagsEx);
1244 GET_BLOB_DS(schema, r, "msDs-Schema-Extensions", mem_ctx, obj, msDs_Schema_Extensions);
1246 GET_BOOL_DS(schema, r, "showInAdvancedViewOnly", obj, showInAdvancedViewOnly, false);
1247 GET_STRING_DS(schema, r, "adminDisplayName", mem_ctx, obj, adminDisplayName, false);
1248 GET_STRING_DS(schema, r, "adminDescription", mem_ctx, obj, adminDescription, false);
1249 GET_STRING_DS(schema, r, "classDisplayName", mem_ctx, obj, classDisplayName, false);
1250 GET_BOOL_DS(schema, r, "defaultHidingValue", obj, defaultHidingValue, false);
1251 GET_BOOL_DS(schema, r, "isDefunct", obj, isDefunct, false);
1252 GET_BOOL_DS(schema, r, "systemOnly", obj, systemOnly, false);