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
,
178 (ndr_push_flags_fn_t
)ndr_push_prefixMapBlob
);
180 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err
)) {
181 NTSTATUS nt_status
= ndr_map_error2ntstatus(ndr_err
);
182 return ntstatus_to_werror(nt_status
);
185 *schemaInfo
= strhex_to_data_blob(mem_ctx
, schema
->schema_info
);
186 W_ERROR_HAVE_NO_MEMORY(schemaInfo
->data
);
193 * this function is called from within a ldb transaction from the schema_fsmo module
195 WERROR
dsdb_create_prefix_mapping(struct ldb_context
*ldb
, struct dsdb_schema
*schema
, const char *full_oid
)
200 struct dsdb_schema_prefixmap
*pfm
;
202 mem_ctx
= talloc_new(ldb
);
203 W_ERROR_HAVE_NO_MEMORY(mem_ctx
);
205 /* Read prefixes from disk*/
206 status
= dsdb_read_prefixes_from_ldb(ldb
, mem_ctx
, &pfm
);
207 if (!W_ERROR_IS_OK(status
)) {
208 DEBUG(0,("dsdb_create_prefix_mapping: dsdb_read_prefixes_from_ldb: %s\n",
209 win_errstr(status
)));
210 talloc_free(mem_ctx
);
214 /* Check if there is a prefix for the oid in the prefixes array*/
215 status
= dsdb_schema_pfm_find_oid(pfm
, full_oid
, NULL
);
216 if (W_ERROR_IS_OK(status
)) {
218 talloc_free(mem_ctx
);
220 } else if (!W_ERROR_EQUAL(WERR_DS_NO_MSDS_INTID
, status
)) {
222 DEBUG(0,("dsdb_create_prefix_mapping: dsdb_find_prefix_for_oid: %s\n",
223 win_errstr(status
)));
224 talloc_free(mem_ctx
);
228 /* Create the new mapping for the prefix of full_oid */
229 status
= dsdb_schema_pfm_make_attid(pfm
, full_oid
, &attid
);
230 if (!W_ERROR_IS_OK(status
)) {
231 DEBUG(0,("dsdb_create_prefix_mapping: dsdb_schema_pfm_make_attid: %s\n",
232 win_errstr(status
)));
233 talloc_free(mem_ctx
);
237 talloc_unlink(schema
, schema
->prefixmap
);
238 schema
->prefixmap
= talloc_steal(schema
, pfm
);
240 /* Update prefixMap in ldb*/
241 status
= dsdb_write_prefixes_from_schema_to_ldb(mem_ctx
, ldb
, schema
);
242 if (!W_ERROR_IS_OK(status
)) {
243 DEBUG(0,("dsdb_create_prefix_mapping: dsdb_write_prefixes_to_ldb: %s\n",
244 win_errstr(status
)));
245 talloc_free(mem_ctx
);
249 DEBUG(2,(__location__
" Added prefixMap %s - now have %u prefixes\n",
250 full_oid
, schema
->prefixmap
->length
));
252 talloc_free(mem_ctx
);
257 WERROR
dsdb_write_prefixes_from_schema_to_ldb(TALLOC_CTX
*mem_ctx
, struct ldb_context
*ldb
,
258 const struct dsdb_schema
*schema
)
262 struct ldb_message
*msg
;
263 struct ldb_dn
*schema_dn
;
264 struct prefixMapBlob pfm_blob
;
265 struct ldb_val ndr_blob
;
266 enum ndr_err_code ndr_err
;
267 TALLOC_CTX
*temp_ctx
;
268 struct drsuapi_DsReplicaOIDMapping_Ctr
*ctr
;
270 schema_dn
= samdb_schema_dn(ldb
);
272 DEBUG(0,("dsdb_write_prefixes_from_schema_to_ldb: no schema dn present\n"));
276 temp_ctx
= talloc_new(mem_ctx
);
277 W_ERROR_HAVE_NO_MEMORY(temp_ctx
);
279 /* convert schema_prefixMap to prefixMap blob */
280 status
= dsdb_get_oid_mappings_drsuapi(schema
, false, temp_ctx
, &ctr
);
281 if (!W_ERROR_IS_OK(status
)) {
282 talloc_free(temp_ctx
);
286 pfm_blob
.version
= PREFIX_MAP_VERSION_DSDB
;
287 pfm_blob
.ctr
.dsdb
= *ctr
;
289 ndr_err
= ndr_push_struct_blob(&ndr_blob
, temp_ctx
,
290 lp_iconv_convenience(ldb_get_opaque(ldb
, "loadparm")),
292 (ndr_push_flags_fn_t
)ndr_push_prefixMapBlob
);
293 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err
)) {
294 talloc_free(temp_ctx
);
298 /* write serialized prefixMap into LDB */
299 msg
= ldb_msg_new(temp_ctx
);
301 talloc_free(temp_ctx
);
306 ldb_ret
= ldb_msg_add_value(msg
, "prefixMap", &ndr_blob
, NULL
);
308 talloc_free(temp_ctx
);
309 DEBUG(0,("dsdb_write_prefixes_from_schema_to_ldb: ldb_msg_add_value failed\n"));
313 ldb_ret
= samdb_replace( ldb
, msg
, msg
);
315 talloc_free(temp_ctx
);
318 DEBUG(0,("dsdb_write_prefixes_from_schema_to_ldb: samdb_replace failed\n"));
325 WERROR
dsdb_read_prefixes_from_ldb(struct ldb_context
*ldb
, TALLOC_CTX
*mem_ctx
, struct dsdb_schema_prefixmap
**_pfm
)
329 const struct ldb_val
*prefix_val
;
330 struct smb_iconv_convenience
*iconv_convenience
;
331 struct ldb_dn
*schema_dn
;
332 struct ldb_result
*schema_res
= NULL
;
333 static const char *schema_attrs
[] = {
338 schema_dn
= samdb_schema_dn(ldb
);
340 DEBUG(0,("dsdb_read_prefixes_from_ldb: no schema dn present\n"));
344 ldb_ret
= ldb_search(ldb
, mem_ctx
, &schema_res
, schema_dn
, LDB_SCOPE_BASE
, schema_attrs
, NULL
);
345 if (ldb_ret
== LDB_ERR_NO_SUCH_OBJECT
) {
346 DEBUG(0,("dsdb_read_prefixes_from_ldb: no prefix map present\n"));
347 talloc_free(schema_res
);
349 } else if (ldb_ret
!= LDB_SUCCESS
) {
350 DEBUG(0,("dsdb_read_prefixes_from_ldb: failed to search the schema head\n"));
351 talloc_free(schema_res
);
355 prefix_val
= ldb_msg_find_ldb_val(schema_res
->msgs
[0], "prefixMap");
357 DEBUG(0,("dsdb_read_prefixes_from_ldb: no prefixMap attribute found\n"));
358 talloc_free(schema_res
);
362 iconv_convenience
= lp_iconv_convenience(ldb_get_opaque(ldb
, "loadparm"));
364 werr
= _dsdb_prefixmap_from_ldb_val(prefix_val
,
368 talloc_free(schema_res
);
369 W_ERROR_NOT_OK_RETURN(werr
);
375 this will be replaced with something that looks at the right part of
376 the schema once we know where unique indexing information is hidden
378 static bool dsdb_schema_unique_attribute(const char *attr
)
380 const char *attrs
[] = { "objectGUID", "objectSID" , NULL
};
382 for (i
=0;attrs
[i
];i
++) {
383 if (strcasecmp(attr
, attrs
[i
]) == 0) {
392 setup the ldb_schema_attribute field for a dsdb_attribute
394 static int dsdb_schema_setup_ldb_schema_attribute(struct ldb_context
*ldb
,
395 struct dsdb_attribute
*attr
)
397 const char *syntax
= attr
->syntax
->ldb_syntax
;
398 const struct ldb_schema_syntax
*s
;
399 struct ldb_schema_attribute
*a
;
402 syntax
= attr
->syntax
->ldap_oid
;
405 s
= ldb_samba_syntax_by_lDAPDisplayName(ldb
, attr
->lDAPDisplayName
);
407 s
= ldb_samba_syntax_by_name(ldb
, syntax
);
410 s
= ldb_standard_syntax_by_name(ldb
, syntax
);
414 return LDB_ERR_OPERATIONS_ERROR
;
417 attr
->ldb_schema_attribute
= a
= talloc(attr
, struct ldb_schema_attribute
);
418 if (attr
->ldb_schema_attribute
== NULL
) {
420 return LDB_ERR_OPERATIONS_ERROR
;
423 a
->name
= attr
->lDAPDisplayName
;
427 if (dsdb_schema_unique_attribute(a
->name
)) {
428 a
->flags
|= LDB_ATTR_FLAG_UNIQUE_INDEX
;
430 if (attr
->isSingleValued
) {
431 a
->flags
|= LDB_ATTR_FLAG_SINGLE_VALUE
;
439 #define GET_STRING_LDB(msg, attr, mem_ctx, p, elem, strict) do { \
440 const struct ldb_val *get_string_val = ldb_msg_find_ldb_val(msg, attr); \
441 if (get_string_val == NULL) { \
443 d_printf("%s: %s == NULL\n", __location__, attr); \
444 return WERR_INVALID_PARAM; \
449 (p)->elem = talloc_strndup(mem_ctx, \
450 (const char *)get_string_val->data, \
451 get_string_val->length); \
453 d_printf("%s: talloc_strndup failed for %s\n", __location__, attr); \
459 #define GET_STRING_LIST_LDB(msg, attr, mem_ctx, p, elem, strict) do { \
460 int get_string_list_counter; \
461 struct ldb_message_element *get_string_list_el = ldb_msg_find_element(msg, attr); \
462 if (get_string_list_el == NULL) { \
464 d_printf("%s: %s == NULL\n", __location__, attr); \
465 return WERR_INVALID_PARAM; \
471 (p)->elem = talloc_array(mem_ctx, const char *, get_string_list_el->num_values + 1); \
472 for (get_string_list_counter=0; \
473 get_string_list_counter < get_string_list_el->num_values; \
474 get_string_list_counter++) { \
475 (p)->elem[get_string_list_counter] = talloc_strndup((p)->elem, \
476 (const char *)get_string_list_el->values[get_string_list_counter].data, \
477 get_string_list_el->values[get_string_list_counter].length); \
478 if (!(p)->elem[get_string_list_counter]) { \
479 d_printf("%s: talloc_strndup failed for %s\n", __location__, attr); \
482 (p)->elem[get_string_list_counter+1] = NULL; \
484 talloc_steal(mem_ctx, (p)->elem); \
487 #define GET_BOOL_LDB(msg, attr, p, elem, strict) do { \
489 str = samdb_result_string(msg, attr, NULL);\
492 d_printf("%s: %s == NULL\n", __location__, attr); \
493 return WERR_INVALID_PARAM; \
497 } else if (strcasecmp("TRUE", str) == 0) { \
499 } else if (strcasecmp("FALSE", str) == 0) { \
502 d_printf("%s: %s == %s\n", __location__, attr, str); \
503 return WERR_INVALID_PARAM; \
507 #define GET_UINT32_LDB(msg, attr, p, elem) do { \
508 (p)->elem = samdb_result_uint(msg, attr, 0);\
511 #define GET_UINT32_PTR_LDB(msg, attr, mem_ctx, p, elem) do { \
512 uint64_t _v = samdb_result_uint64(msg, attr, UINT64_MAX);\
513 if (_v == UINT64_MAX) { \
515 } else if (_v > UINT32_MAX) { \
516 d_printf("%s: %s == 0x%llX\n", __location__, \
517 attr, (unsigned long long)_v); \
518 return WERR_INVALID_PARAM; \
520 (p)->elem = talloc(mem_ctx, uint32_t); \
522 d_printf("%s: talloc failed for %s\n", __location__, attr); \
525 *(p)->elem = (uint32_t)_v; \
529 #define GET_GUID_LDB(msg, attr, p, elem) do { \
530 (p)->elem = samdb_result_guid(msg, attr);\
533 #define GET_BLOB_LDB(msg, attr, mem_ctx, p, elem) do { \
534 const struct ldb_val *_val;\
535 _val = ldb_msg_find_ldb_val(msg, attr);\
538 talloc_steal(mem_ctx, (p)->elem.data);\
540 ZERO_STRUCT((p)->elem);\
544 WERROR
dsdb_attribute_from_ldb(struct ldb_context
*ldb
,
545 struct dsdb_schema
*schema
,
546 struct ldb_message
*msg
)
549 struct dsdb_attribute
*attr
= talloc_zero(schema
, struct dsdb_attribute
);
554 GET_STRING_LDB(msg
, "cn", attr
, attr
, cn
, false);
555 GET_STRING_LDB(msg
, "lDAPDisplayName", attr
, attr
, lDAPDisplayName
, true);
556 GET_STRING_LDB(msg
, "attributeID", attr
, attr
, attributeID_oid
, true);
557 if (!schema
->prefixmap
|| schema
->prefixmap
->length
== 0) {
558 /* set an invalid value */
559 attr
->attributeID_id
= 0xFFFFFFFF;
561 status
= dsdb_schema_pfm_make_attid(schema
->prefixmap
,
562 attr
->attributeID_oid
,
563 &attr
->attributeID_id
);
564 if (!W_ERROR_IS_OK(status
)) {
565 DEBUG(0,("%s: '%s': unable to map attributeID %s: %s\n",
566 __location__
, attr
->lDAPDisplayName
, attr
->attributeID_oid
,
567 win_errstr(status
)));
571 GET_GUID_LDB(msg
, "schemaIDGUID", attr
, schemaIDGUID
);
572 GET_UINT32_LDB(msg
, "mAPIID", attr
, mAPIID
);
574 GET_GUID_LDB(msg
, "attributeSecurityGUID", attr
, attributeSecurityGUID
);
576 GET_GUID_LDB(msg
, "objectGUID", attr
, objectGUID
);
578 GET_UINT32_LDB(msg
, "searchFlags", attr
, searchFlags
);
579 GET_UINT32_LDB(msg
, "systemFlags", attr
, systemFlags
);
580 GET_BOOL_LDB(msg
, "isMemberOfPartialAttributeSet", attr
, isMemberOfPartialAttributeSet
, false);
581 GET_UINT32_LDB(msg
, "linkID", attr
, linkID
);
583 GET_STRING_LDB(msg
, "attributeSyntax", attr
, attr
, attributeSyntax_oid
, true);
584 if (!schema
->prefixmap
|| schema
->prefixmap
->length
== 0) {
585 /* set an invalid value */
586 attr
->attributeSyntax_id
= 0xFFFFFFFF;
588 status
= dsdb_schema_pfm_make_attid(schema
->prefixmap
,
589 attr
->attributeSyntax_oid
,
590 &attr
->attributeSyntax_id
);
591 if (!W_ERROR_IS_OK(status
)) {
592 DEBUG(0,("%s: '%s': unable to map attributeSyntax_ %s: %s\n",
593 __location__
, attr
->lDAPDisplayName
, attr
->attributeSyntax_oid
,
594 win_errstr(status
)));
598 GET_UINT32_LDB(msg
, "oMSyntax", attr
, oMSyntax
);
599 GET_BLOB_LDB(msg
, "oMObjectClass", attr
, attr
, oMObjectClass
);
601 GET_BOOL_LDB(msg
, "isSingleValued", attr
, isSingleValued
, true);
602 GET_UINT32_PTR_LDB(msg
, "rangeLower", attr
, attr
, rangeLower
);
603 GET_UINT32_PTR_LDB(msg
, "rangeUpper", attr
, attr
, rangeUpper
);
604 GET_BOOL_LDB(msg
, "extendedCharsAllowed", attr
, extendedCharsAllowed
, false);
606 GET_UINT32_LDB(msg
, "schemaFlagsEx", attr
, schemaFlagsEx
);
607 GET_BLOB_LDB(msg
, "msDs-Schema-Extensions", attr
, attr
, msDs_Schema_Extensions
);
609 GET_BOOL_LDB(msg
, "showInAdvancedViewOnly", attr
, showInAdvancedViewOnly
, false);
610 GET_STRING_LDB(msg
, "adminDisplayName", attr
, attr
, adminDisplayName
, false);
611 GET_STRING_LDB(msg
, "adminDescription", attr
, attr
, adminDescription
, false);
612 GET_STRING_LDB(msg
, "classDisplayName", attr
, attr
, classDisplayName
, false);
613 GET_BOOL_LDB(msg
, "isEphemeral", attr
, isEphemeral
, false);
614 GET_BOOL_LDB(msg
, "isDefunct", attr
, isDefunct
, false);
615 GET_BOOL_LDB(msg
, "systemOnly", attr
, systemOnly
, false);
617 attr
->syntax
= dsdb_syntax_for_attribute(attr
);
619 return WERR_DS_ATT_SCHEMA_REQ_SYNTAX
;
622 if (dsdb_schema_setup_ldb_schema_attribute(ldb
, attr
) != LDB_SUCCESS
) {
623 return WERR_DS_ATT_SCHEMA_REQ_SYNTAX
;
626 DLIST_ADD(schema
->attributes
, attr
);
630 WERROR
dsdb_class_from_ldb(struct dsdb_schema
*schema
,
631 struct ldb_message
*msg
)
634 struct dsdb_class
*obj
= talloc_zero(schema
, struct dsdb_class
);
638 GET_STRING_LDB(msg
, "cn", obj
, obj
, cn
, false);
639 GET_STRING_LDB(msg
, "lDAPDisplayName", obj
, obj
, lDAPDisplayName
, true);
640 GET_STRING_LDB(msg
, "governsID", obj
, obj
, governsID_oid
, true);
641 if (!schema
->prefixmap
|| schema
->prefixmap
->length
== 0) {
642 /* set an invalid value */
643 obj
->governsID_id
= 0xFFFFFFFF;
645 status
= dsdb_schema_pfm_make_attid(schema
->prefixmap
,
648 if (!W_ERROR_IS_OK(status
)) {
649 DEBUG(0,("%s: '%s': unable to map governsID %s: %s\n",
650 __location__
, obj
->lDAPDisplayName
, obj
->governsID_oid
,
651 win_errstr(status
)));
655 GET_GUID_LDB(msg
, "schemaIDGUID", obj
, schemaIDGUID
);
656 GET_GUID_LDB(msg
, "objectGUID", obj
, objectGUID
);
658 GET_UINT32_LDB(msg
, "objectClassCategory", obj
, objectClassCategory
);
659 GET_STRING_LDB(msg
, "rDNAttID", obj
, obj
, rDNAttID
, false);
660 GET_STRING_LDB(msg
, "defaultObjectCategory", obj
, obj
, defaultObjectCategory
, true);
662 GET_STRING_LDB(msg
, "subClassOf", obj
, obj
, subClassOf
, true);
664 GET_STRING_LIST_LDB(msg
, "systemAuxiliaryClass", obj
, obj
, systemAuxiliaryClass
, false);
665 GET_STRING_LIST_LDB(msg
, "auxiliaryClass", obj
, obj
, auxiliaryClass
, false);
667 GET_STRING_LIST_LDB(msg
, "systemMustContain", obj
, obj
, systemMustContain
, false);
668 GET_STRING_LIST_LDB(msg
, "systemMayContain", obj
, obj
, systemMayContain
, false);
669 GET_STRING_LIST_LDB(msg
, "mustContain", obj
, obj
, mustContain
, false);
670 GET_STRING_LIST_LDB(msg
, "mayContain", obj
, obj
, mayContain
, false);
672 GET_STRING_LIST_LDB(msg
, "systemPossSuperiors", obj
, obj
, systemPossSuperiors
, false);
673 GET_STRING_LIST_LDB(msg
, "possSuperiors", obj
, obj
, possSuperiors
, false);
675 GET_STRING_LDB(msg
, "defaultSecurityDescriptor", obj
, obj
, defaultSecurityDescriptor
, false);
677 GET_UINT32_LDB(msg
, "schemaFlagsEx", obj
, schemaFlagsEx
);
678 GET_BLOB_LDB(msg
, "msDs-Schema-Extensions", obj
, obj
, msDs_Schema_Extensions
);
680 GET_BOOL_LDB(msg
, "showInAdvancedViewOnly", obj
, showInAdvancedViewOnly
, false);
681 GET_STRING_LDB(msg
, "adminDisplayName", obj
, obj
, adminDisplayName
, false);
682 GET_STRING_LDB(msg
, "adminDescription", obj
, obj
, adminDescription
, false);
683 GET_STRING_LDB(msg
, "classDisplayName", obj
, obj
, classDisplayName
, false);
684 GET_BOOL_LDB(msg
, "defaultHidingValue", obj
, defaultHidingValue
, false);
685 GET_BOOL_LDB(msg
, "isDefunct", obj
, isDefunct
, false);
686 GET_BOOL_LDB(msg
, "systemOnly", obj
, systemOnly
, false);
688 DLIST_ADD(schema
->classes
, obj
);
692 #define dsdb_oom(error_string, mem_ctx) *error_string = talloc_asprintf(mem_ctx, "dsdb out of memory at %s:%d\n", __FILE__, __LINE__)
695 Create a DSDB schema from the ldb results provided. This is called
696 directly when the schema is provisioned from an on-disk LDIF file, or
697 from dsdb_schema_from_schema_dn in schema_fsmo
700 int dsdb_schema_from_ldb_results(TALLOC_CTX
*mem_ctx
, struct ldb_context
*ldb
,
701 struct smb_iconv_convenience
*iconv_convenience
,
702 struct ldb_result
*schema_res
,
703 struct ldb_result
*attrs_res
, struct ldb_result
*objectclass_res
,
704 struct dsdb_schema
**schema_out
,
709 const struct ldb_val
*prefix_val
;
710 const struct ldb_val
*info_val
;
711 struct ldb_val info_val_default
;
712 struct dsdb_schema
*schema
;
714 schema
= dsdb_new_schema(mem_ctx
, iconv_convenience
);
716 dsdb_oom(error_string
, mem_ctx
);
717 return LDB_ERR_OPERATIONS_ERROR
;
720 prefix_val
= ldb_msg_find_ldb_val(schema_res
->msgs
[0], "prefixMap");
722 *error_string
= talloc_asprintf(mem_ctx
,
723 "schema_fsmo_init: no prefixMap attribute found");
724 DEBUG(0,(__location__
": %s\n", *error_string
));
725 return LDB_ERR_CONSTRAINT_VIOLATION
;
727 info_val
= ldb_msg_find_ldb_val(schema_res
->msgs
[0], "schemaInfo");
729 info_val_default
= strhex_to_data_blob(mem_ctx
, "FF0000000000000000000000000000000000000000");
730 if (!info_val_default
.data
) {
731 dsdb_oom(error_string
, mem_ctx
);
732 return LDB_ERR_OPERATIONS_ERROR
;
734 info_val
= &info_val_default
;
737 status
= dsdb_load_oid_mappings_ldb(schema
, prefix_val
, info_val
);
738 if (!W_ERROR_IS_OK(status
)) {
739 *error_string
= talloc_asprintf(mem_ctx
,
740 "schema_fsmo_init: failed to load oid mappings: %s",
742 DEBUG(0,(__location__
": %s\n", *error_string
));
743 return LDB_ERR_CONSTRAINT_VIOLATION
;
746 for (i
=0; i
< attrs_res
->count
; i
++) {
747 status
= dsdb_attribute_from_ldb(ldb
, schema
, attrs_res
->msgs
[i
]);
748 if (!W_ERROR_IS_OK(status
)) {
749 *error_string
= talloc_asprintf(mem_ctx
,
750 "schema_fsmo_init: failed to load attribute definition: %s:%s",
751 ldb_dn_get_linearized(attrs_res
->msgs
[i
]->dn
),
753 DEBUG(0,(__location__
": %s\n", *error_string
));
754 return LDB_ERR_CONSTRAINT_VIOLATION
;
758 for (i
=0; i
< objectclass_res
->count
; i
++) {
759 status
= dsdb_class_from_ldb(schema
, objectclass_res
->msgs
[i
]);
760 if (!W_ERROR_IS_OK(status
)) {
761 *error_string
= talloc_asprintf(mem_ctx
,
762 "schema_fsmo_init: failed to load class definition: %s:%s",
763 ldb_dn_get_linearized(objectclass_res
->msgs
[i
]->dn
),
765 DEBUG(0,(__location__
": %s\n", *error_string
));
766 return LDB_ERR_CONSTRAINT_VIOLATION
;
770 schema
->fsmo
.master_dn
= ldb_msg_find_attr_as_dn(ldb
, schema
, schema_res
->msgs
[0], "fSMORoleOwner");
771 if (ldb_dn_compare(samdb_ntds_settings_dn(ldb
), schema
->fsmo
.master_dn
) == 0) {
772 schema
->fsmo
.we_are_master
= true;
774 schema
->fsmo
.we_are_master
= false;
777 DEBUG(5, ("schema_fsmo_init: we are master: %s\n",
778 (schema
->fsmo
.we_are_master
?"yes":"no")));
780 *schema_out
= schema
;
785 static const struct {
788 } name_mappings
[] = {
790 { "name", "1.2.840.113556.1.4.1" },
791 { "lDAPDisplayName", "1.2.840.113556.1.2.460" },
792 { "attributeID", "1.2.840.113556.1.2.30" },
793 { "schemaIDGUID", "1.2.840.113556.1.4.148" },
794 { "mAPIID", "1.2.840.113556.1.2.49" },
795 { "attributeSecurityGUID", "1.2.840.113556.1.4.149" },
796 { "searchFlags", "1.2.840.113556.1.2.334" },
797 { "systemFlags", "1.2.840.113556.1.4.375" },
798 { "isMemberOfPartialAttributeSet", "1.2.840.113556.1.4.639" },
799 { "linkID", "1.2.840.113556.1.2.50" },
800 { "attributeSyntax", "1.2.840.113556.1.2.32" },
801 { "oMSyntax", "1.2.840.113556.1.2.231" },
802 { "oMObjectClass", "1.2.840.113556.1.2.218" },
803 { "isSingleValued", "1.2.840.113556.1.2.33" },
804 { "rangeLower", "1.2.840.113556.1.2.34" },
805 { "rangeUpper", "1.2.840.113556.1.2.35" },
806 { "extendedCharsAllowed", "1.2.840.113556.1.2.380" },
807 { "schemaFlagsEx", "1.2.840.113556.1.4.120" },
808 { "msDs-Schema-Extensions", "1.2.840.113556.1.4.1440" },
809 { "showInAdvancedViewOnly", "1.2.840.113556.1.2.169" },
810 { "adminDisplayName", "1.2.840.113556.1.2.194" },
811 { "adminDescription", "1.2.840.113556.1.2.226" },
812 { "classDisplayName", "1.2.840.113556.1.4.610" },
813 { "isEphemeral", "1.2.840.113556.1.4.1212" },
814 { "isDefunct", "1.2.840.113556.1.4.661" },
815 { "systemOnly", "1.2.840.113556.1.4.170" },
816 { "governsID", "1.2.840.113556.1.2.22" },
817 { "objectClassCategory", "1.2.840.113556.1.2.370" },
818 { "rDNAttID", "1.2.840.113556.1.2.26" },
819 { "defaultObjectCategory", "1.2.840.113556.1.4.783" },
820 { "subClassOf", "1.2.840.113556.1.2.21" },
821 { "systemAuxiliaryClass", "1.2.840.113556.1.4.198" },
822 { "systemPossSuperiors", "1.2.840.113556.1.4.195" },
823 { "systemMustContain", "1.2.840.113556.1.4.197" },
824 { "systemMayContain", "1.2.840.113556.1.4.196" },
825 { "auxiliaryClass", "1.2.840.113556.1.2.351" },
826 { "possSuperiors", "1.2.840.113556.1.2.8" },
827 { "mustContain", "1.2.840.113556.1.2.24" },
828 { "mayContain", "1.2.840.113556.1.2.25" },
829 { "defaultSecurityDescriptor", "1.2.840.113556.1.4.224" },
830 { "defaultHidingValue", "1.2.840.113556.1.4.518" },
833 static struct drsuapi_DsReplicaAttribute
*dsdb_find_object_attr_name(struct dsdb_schema
*schema
,
834 struct drsuapi_DsReplicaObject
*obj
,
840 const char *oid
= NULL
;
842 for(i
=0; i
< ARRAY_SIZE(name_mappings
); i
++) {
843 if (strcmp(name_mappings
[i
].name
, name
) != 0) continue;
845 oid
= name_mappings
[i
].oid
;
853 status
= dsdb_schema_pfm_make_attid(schema
->prefixmap
, oid
, &attid
);
854 if (!W_ERROR_IS_OK(status
)) {
858 for (i
=0; i
< obj
->attribute_ctr
.num_attributes
; i
++) {
859 if (obj
->attribute_ctr
.attributes
[i
].attid
!= attid
) continue;
862 return &obj
->attribute_ctr
.attributes
[i
];
868 #define GET_STRING_DS(s, r, attr, mem_ctx, p, elem, strict) do { \
869 struct drsuapi_DsReplicaAttribute *_a; \
870 _a = dsdb_find_object_attr_name(s, r, attr, NULL); \
871 if (strict && !_a) { \
872 d_printf("%s: %s == NULL\n", __location__, attr); \
873 return WERR_INVALID_PARAM; \
875 if (strict && _a->value_ctr.num_values != 1) { \
876 d_printf("%s: %s num_values == %u\n", __location__, attr, \
877 _a->value_ctr.num_values); \
878 return WERR_INVALID_PARAM; \
880 if (_a && _a->value_ctr.num_values >= 1) { \
882 if (!convert_string_talloc_convenience(mem_ctx, s->iconv_convenience, CH_UTF16, CH_UNIX, \
883 _a->value_ctr.values[0].blob->data, \
884 _a->value_ctr.values[0].blob->length, \
885 (void **)discard_const(&(p)->elem), &_ret, false)) { \
886 DEBUG(0,("%s: invalid data!\n", attr)); \
888 _a->value_ctr.values[0].blob->data, \
889 _a->value_ctr.values[0].blob->length); \
890 return WERR_FOOBAR; \
897 #define GET_UINT32_LIST_DS(s, r, attr, mem_ctx, p, elem) do { \
899 struct drsuapi_DsReplicaAttribute *_a; \
900 _a = dsdb_find_object_attr_name(s, r, attr, NULL); \
901 (p)->elem = _a ? talloc_array(mem_ctx, uint32_t, _a->value_ctr.num_values + 1) : NULL; \
902 for (list_counter=0; \
903 _a && list_counter < _a->value_ctr.num_values; \
905 if (_a->value_ctr.values[list_counter].blob->length != 4) { \
906 return WERR_INVALID_PARAM; \
908 (p)->elem[list_counter] = IVAL(_a->value_ctr.values[list_counter].blob->data, 0); \
910 if (_a) (p)->elem[list_counter] = 0; \
913 #define GET_BOOL_DS(s, r, attr, p, elem, strict) do { \
914 struct drsuapi_DsReplicaAttribute *_a; \
915 _a = dsdb_find_object_attr_name(s, r, attr, NULL); \
916 if (strict && !_a) { \
917 d_printf("%s: %s == NULL\n", __location__, attr); \
918 return WERR_INVALID_PARAM; \
920 if (strict && _a->value_ctr.num_values != 1) { \
921 d_printf("%s: %s num_values == %u\n", __location__, attr, \
922 (unsigned int)_a->value_ctr.num_values); \
923 return WERR_INVALID_PARAM; \
925 if (strict && !_a->value_ctr.values[0].blob) { \
926 d_printf("%s: %s data == NULL\n", __location__, attr); \
927 return WERR_INVALID_PARAM; \
929 if (strict && _a->value_ctr.values[0].blob->length != 4) { \
930 d_printf("%s: %s length == %u\n", __location__, attr, \
931 (unsigned int)_a->value_ctr.values[0].blob->length); \
932 return WERR_INVALID_PARAM; \
934 if (_a && _a->value_ctr.num_values >= 1 \
935 && _a->value_ctr.values[0].blob \
936 && _a->value_ctr.values[0].blob->length == 4) { \
937 (p)->elem = (IVAL(_a->value_ctr.values[0].blob->data,0)?true:false);\
943 #define GET_UINT32_DS(s, r, attr, p, elem) do { \
944 struct drsuapi_DsReplicaAttribute *_a; \
945 _a = dsdb_find_object_attr_name(s, r, attr, NULL); \
946 if (_a && _a->value_ctr.num_values >= 1 \
947 && _a->value_ctr.values[0].blob \
948 && _a->value_ctr.values[0].blob->length == 4) { \
949 (p)->elem = IVAL(_a->value_ctr.values[0].blob->data,0);\
955 #define GET_UINT32_PTR_DS(s, r, attr, p, elem) do { \
956 struct drsuapi_DsReplicaAttribute *_a; \
957 _a = dsdb_find_object_attr_name(s, r, attr, NULL); \
958 if (_a && _a->value_ctr.num_values >= 1 \
959 && _a->value_ctr.values[0].blob \
960 && _a->value_ctr.values[0].blob->length == 4) { \
961 (p)->elem = talloc(mem_ctx, uint32_t); \
963 d_printf("%s: talloc failed for %s\n", __location__, attr); \
966 *(p)->elem = IVAL(_a->value_ctr.values[0].blob->data,0);\
972 #define GET_GUID_DS(s, r, attr, mem_ctx, p, elem) do { \
973 struct drsuapi_DsReplicaAttribute *_a; \
974 _a = dsdb_find_object_attr_name(s, r, attr, NULL); \
975 if (_a && _a->value_ctr.num_values >= 1 \
976 && _a->value_ctr.values[0].blob \
977 && _a->value_ctr.values[0].blob->length == 16) { \
978 enum ndr_err_code _ndr_err; \
979 _ndr_err = ndr_pull_struct_blob_all(_a->value_ctr.values[0].blob, \
980 mem_ctx, s->iconv_convenience, &(p)->elem, \
981 (ndr_pull_flags_fn_t)ndr_pull_GUID); \
982 if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
983 NTSTATUS _nt_status = ndr_map_error2ntstatus(_ndr_err); \
984 return ntstatus_to_werror(_nt_status); \
987 ZERO_STRUCT((p)->elem);\
991 #define GET_BLOB_DS(s, r, attr, mem_ctx, p, elem) do { \
992 struct drsuapi_DsReplicaAttribute *_a; \
993 _a = dsdb_find_object_attr_name(s, r, attr, NULL); \
994 if (_a && _a->value_ctr.num_values >= 1 \
995 && _a->value_ctr.values[0].blob) { \
996 (p)->elem = *_a->value_ctr.values[0].blob;\
997 talloc_steal(mem_ctx, (p)->elem.data); \
999 ZERO_STRUCT((p)->elem);\
1003 WERROR
dsdb_attribute_from_drsuapi(struct ldb_context
*ldb
,
1004 struct dsdb_schema
*schema
,
1005 struct drsuapi_DsReplicaObject
*r
,
1006 TALLOC_CTX
*mem_ctx
,
1007 struct dsdb_attribute
*attr
)
1011 GET_STRING_DS(schema
, r
, "name", mem_ctx
, attr
, cn
, true);
1012 GET_STRING_DS(schema
, r
, "lDAPDisplayName", mem_ctx
, attr
, lDAPDisplayName
, true);
1013 GET_UINT32_DS(schema
, r
, "attributeID", attr
, attributeID_id
);
1014 status
= dsdb_schema_pfm_oid_from_attid(schema
->prefixmap
, attr
->attributeID_id
,
1015 mem_ctx
, &attr
->attributeID_oid
);
1016 if (!W_ERROR_IS_OK(status
)) {
1017 DEBUG(0,("%s: '%s': unable to map attributeID 0x%08X: %s\n",
1018 __location__
, attr
->lDAPDisplayName
, attr
->attributeID_id
,
1019 win_errstr(status
)));
1022 GET_GUID_DS(schema
, r
, "schemaIDGUID", mem_ctx
, attr
, schemaIDGUID
);
1023 GET_UINT32_DS(schema
, r
, "mAPIID", attr
, mAPIID
);
1025 GET_GUID_DS(schema
, r
, "attributeSecurityGUID", mem_ctx
, attr
, attributeSecurityGUID
);
1027 attr
->objectGUID
= r
->identifier
->guid
;
1029 GET_UINT32_DS(schema
, r
, "searchFlags", attr
, searchFlags
);
1030 GET_UINT32_DS(schema
, r
, "systemFlags", attr
, systemFlags
);
1031 GET_BOOL_DS(schema
, r
, "isMemberOfPartialAttributeSet", attr
, isMemberOfPartialAttributeSet
, false);
1032 GET_UINT32_DS(schema
, r
, "linkID", attr
, linkID
);
1034 GET_UINT32_DS(schema
, r
, "attributeSyntax", attr
, attributeSyntax_id
);
1035 status
= dsdb_schema_pfm_oid_from_attid(schema
->prefixmap
, attr
->attributeSyntax_id
,
1036 mem_ctx
, &attr
->attributeSyntax_oid
);
1037 if (!W_ERROR_IS_OK(status
)) {
1038 DEBUG(0,("%s: '%s': unable to map attributeSyntax 0x%08X: %s\n",
1039 __location__
, attr
->lDAPDisplayName
, attr
->attributeSyntax_id
,
1040 win_errstr(status
)));
1043 GET_UINT32_DS(schema
, r
, "oMSyntax", attr
, oMSyntax
);
1044 GET_BLOB_DS(schema
, r
, "oMObjectClass", mem_ctx
, attr
, oMObjectClass
);
1046 GET_BOOL_DS(schema
, r
, "isSingleValued", attr
, isSingleValued
, true);
1047 GET_UINT32_PTR_DS(schema
, r
, "rangeLower", attr
, rangeLower
);
1048 GET_UINT32_PTR_DS(schema
, r
, "rangeUpper", attr
, rangeUpper
);
1049 GET_BOOL_DS(schema
, r
, "extendedCharsAllowed", attr
, extendedCharsAllowed
, false);
1051 GET_UINT32_DS(schema
, r
, "schemaFlagsEx", attr
, schemaFlagsEx
);
1052 GET_BLOB_DS(schema
, r
, "msDs-Schema-Extensions", mem_ctx
, attr
, msDs_Schema_Extensions
);
1054 GET_BOOL_DS(schema
, r
, "showInAdvancedViewOnly", attr
, showInAdvancedViewOnly
, false);
1055 GET_STRING_DS(schema
, r
, "adminDisplayName", mem_ctx
, attr
, adminDisplayName
, false);
1056 GET_STRING_DS(schema
, r
, "adminDescription", mem_ctx
, attr
, adminDescription
, false);
1057 GET_STRING_DS(schema
, r
, "classDisplayName", mem_ctx
, attr
, classDisplayName
, false);
1058 GET_BOOL_DS(schema
, r
, "isEphemeral", attr
, isEphemeral
, false);
1059 GET_BOOL_DS(schema
, r
, "isDefunct", attr
, isDefunct
, false);
1060 GET_BOOL_DS(schema
, r
, "systemOnly", attr
, systemOnly
, false);
1062 attr
->syntax
= dsdb_syntax_for_attribute(attr
);
1063 if (!attr
->syntax
) {
1064 return WERR_DS_ATT_SCHEMA_REQ_SYNTAX
;
1067 if (dsdb_schema_setup_ldb_schema_attribute(ldb
, attr
) != LDB_SUCCESS
) {
1068 return WERR_DS_ATT_SCHEMA_REQ_SYNTAX
;
1074 WERROR
dsdb_class_from_drsuapi(struct ldb_context
*ldb
,
1075 struct dsdb_schema
*schema
,
1076 struct drsuapi_DsReplicaObject
*r
,
1077 TALLOC_CTX
*mem_ctx
,
1078 struct dsdb_class
*obj
)
1081 struct drsuapi_DsReplicaAttribute
*attr
;
1084 GET_STRING_DS(schema
, r
, "name", mem_ctx
, obj
, cn
, true);
1085 GET_STRING_DS(schema
, r
, "lDAPDisplayName", mem_ctx
, obj
, lDAPDisplayName
, true);
1086 GET_UINT32_DS(schema
, r
, "governsID", obj
, governsID_id
);
1087 status
= dsdb_schema_pfm_oid_from_attid(schema
->prefixmap
, obj
->governsID_id
,
1088 mem_ctx
, &obj
->governsID_oid
);
1089 if (!W_ERROR_IS_OK(status
)) {
1090 DEBUG(0,("%s: '%s': unable to map governsID 0x%08X: %s\n",
1091 __location__
, obj
->lDAPDisplayName
, obj
->governsID_id
,
1092 win_errstr(status
)));
1095 GET_GUID_DS(schema
, r
, "schemaIDGUID", mem_ctx
, obj
, schemaIDGUID
);
1097 obj
->objectGUID
= r
->identifier
->guid
;
1099 GET_UINT32_DS(schema
, r
, "objectClassCategory", obj
, objectClassCategory
);
1100 GET_STRING_DS(schema
, r
, "rDNAttID", mem_ctx
, obj
, rDNAttID
, false);
1102 attr
= dsdb_find_object_attr_name(schema
, r
, "defaultObjectCategory", NULL
);
1104 if (!attr
|| attr
->value_ctr
.num_values
!= 1 || !attr
->value_ctr
.values
[0].blob
) {
1105 d_printf("%s: no defaultObjectCategory supplied\n", __location__
);
1106 return WERR_INVALID_PARAM
;
1109 status
= dsdb_syntax_one_DN_drsuapi_to_ldb(mem_ctx
, ldb
, find_syntax_map_by_standard_oid(LDB_SYNTAX_DN
),
1110 schema
->iconv_convenience
, attr
->value_ctr
.values
[0].blob
, &blob
);
1111 if (!W_ERROR_IS_OK(status
)) {
1114 obj
->defaultObjectCategory
= (char *)blob
.data
;
1116 GET_UINT32_DS(schema
, r
, "subClassOf", obj
, subClassOf_id
);
1118 GET_UINT32_LIST_DS(schema
, r
, "systemAuxiliaryClass", mem_ctx
, obj
, systemAuxiliaryClass_ids
);
1119 GET_UINT32_LIST_DS(schema
, r
, "auxiliaryClass", mem_ctx
, obj
, auxiliaryClass_ids
);
1121 GET_UINT32_LIST_DS(schema
, r
, "systemMustContain", mem_ctx
, obj
, systemMustContain_ids
);
1122 GET_UINT32_LIST_DS(schema
, r
, "systemMayContain", mem_ctx
, obj
, systemMayContain_ids
);
1123 GET_UINT32_LIST_DS(schema
, r
, "mustContain", mem_ctx
, obj
, mustContain_ids
);
1124 GET_UINT32_LIST_DS(schema
, r
, "mayContain", mem_ctx
, obj
, mayContain_ids
);
1126 GET_UINT32_LIST_DS(schema
, r
, "systemPossSuperiors", mem_ctx
, obj
, systemPossSuperiors_ids
);
1127 GET_UINT32_LIST_DS(schema
, r
, "possSuperiors", mem_ctx
, obj
, possSuperiors_ids
);
1129 GET_STRING_DS(schema
, r
, "defaultSecurityDescriptor", mem_ctx
, obj
, defaultSecurityDescriptor
, false);
1131 GET_UINT32_DS(schema
, r
, "schemaFlagsEx", obj
, schemaFlagsEx
);
1132 GET_BLOB_DS(schema
, r
, "msDs-Schema-Extensions", mem_ctx
, obj
, msDs_Schema_Extensions
);
1134 GET_BOOL_DS(schema
, r
, "showInAdvancedViewOnly", obj
, showInAdvancedViewOnly
, false);
1135 GET_STRING_DS(schema
, r
, "adminDisplayName", mem_ctx
, obj
, adminDisplayName
, false);
1136 GET_STRING_DS(schema
, r
, "adminDescription", mem_ctx
, obj
, adminDescription
, false);
1137 GET_STRING_DS(schema
, r
, "classDisplayName", mem_ctx
, obj
, classDisplayName
, false);
1138 GET_BOOL_DS(schema
, r
, "defaultHidingValue", obj
, defaultHidingValue
, false);
1139 GET_BOOL_DS(schema
, r
, "isDefunct", obj
, isDefunct
, false);
1140 GET_BOOL_DS(schema
, r
, "systemOnly", obj
, systemOnly
, false);