diff options
author | Andrew Bartlett <abartlet@samba.org> | 2009-11-16 18:40:24 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-11-17 10:38:02 +1100 |
commit | 39b8f31d669d157ab750e11952c7c1d26ad5e29f (patch) | |
tree | b43decc36c42c32ca424bec766d37b35b5bcc215 /source4/dsdb/schema | |
parent | 6710becbd46020512a14a262d39d5085d06458fe (diff) | |
download | samba-39b8f31d669d157ab750e11952c7c1d26ad5e29f.tar.gz samba-39b8f31d669d157ab750e11952c7c1d26ad5e29f.tar.bz2 samba-39b8f31d669d157ab750e11952c7c1d26ad5e29f.zip |
s4:dsdb Load objectGUID and extended DN defaultObjectCategory into the schema
The load of defaultObjectCategory as an extended DN means we need to
use the common parsing functions I just split out, rather than the
GET_DS_DN macro.
The objectGUIDs are loaded so that we can create the extended DN when
we load from LDIF (and are loaded for the other cases for
consistency).
Also adapt callers to API changes needed for common parsing code
Andrew Bartlett
Diffstat (limited to 'source4/dsdb/schema')
-rw-r--r-- | source4/dsdb/schema/schema.h | 2 | ||||
-rw-r--r-- | source4/dsdb/schema/schema_init.c | 60 |
2 files changed, 27 insertions, 35 deletions
diff --git a/source4/dsdb/schema/schema.h b/source4/dsdb/schema/schema.h index 033dc6e1e6..fa687d0728 100644 --- a/source4/dsdb/schema/schema.h +++ b/source4/dsdb/schema/schema.h @@ -64,6 +64,7 @@ struct dsdb_attribute { uint32_t mAPIID; struct GUID attributeSecurityGUID; + struct GUID objectGUID; uint32_t searchFlags; uint32_t systemFlags; @@ -104,6 +105,7 @@ struct dsdb_class { const char *governsID_oid; uint32_t governsID_id; struct GUID schemaIDGUID; + struct GUID objectGUID; uint32_t objectClassCategory; const char *rDNAttID; diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c index 19c72735cc..069da95611 100644 --- a/source4/dsdb/schema/schema_init.c +++ b/source4/dsdb/schema/schema_init.c @@ -573,6 +573,8 @@ WERROR dsdb_attribute_from_ldb(struct ldb_context *ldb, GET_GUID_LDB(msg, "attributeSecurityGUID", attr, attributeSecurityGUID); + GET_GUID_LDB(msg, "objectGUID", attr, objectGUID); + GET_UINT32_LDB(msg, "searchFlags", attr, searchFlags); GET_UINT32_LDB(msg, "systemFlags", attr, systemFlags); GET_BOOL_LDB(msg, "isMemberOfPartialAttributeSet", attr, isMemberOfPartialAttributeSet, false); @@ -651,6 +653,7 @@ WERROR dsdb_class_from_ldb(struct dsdb_schema *schema, } } GET_GUID_LDB(msg, "schemaIDGUID", obj, schemaIDGUID); + GET_GUID_LDB(msg, "objectGUID", obj, objectGUID); GET_UINT32_LDB(msg, "objectClassCategory", obj, objectClassCategory); GET_STRING_LDB(msg, "rDNAttID", obj, obj, rDNAttID, false); @@ -907,39 +910,6 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb if (_a) (p)->elem[list_counter] = 0; \ } while (0) -#define GET_DN_DS(s, r, attr, mem_ctx, p, elem, strict) do { \ - struct drsuapi_DsReplicaAttribute *_a; \ - _a = dsdb_find_object_attr_name(s, r, attr, NULL); \ - if (strict && !_a) { \ - d_printf("%s: %s == NULL\n", __location__, attr); \ - return WERR_INVALID_PARAM; \ - } \ - if (strict && _a->value_ctr.num_values != 1) { \ - d_printf("%s: %s num_values == %u\n", __location__, attr, \ - _a->value_ctr.num_values); \ - return WERR_INVALID_PARAM; \ - } \ - if (strict && !_a->value_ctr.values[0].blob) { \ - d_printf("%s: %s data == NULL\n", __location__, attr); \ - return WERR_INVALID_PARAM; \ - } \ - if (_a && _a->value_ctr.num_values >= 1 \ - && _a->value_ctr.values[0].blob) { \ - struct drsuapi_DsReplicaObjectIdentifier3 _id3; \ - enum ndr_err_code _ndr_err; \ - _ndr_err = ndr_pull_struct_blob_all(_a->value_ctr.values[0].blob, \ - mem_ctx, s->iconv_convenience, &_id3,\ - (ndr_pull_flags_fn_t)ndr_pull_drsuapi_DsReplicaObjectIdentifier3);\ - if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \ - NTSTATUS _nt_status = ndr_map_error2ntstatus(_ndr_err); \ - return ntstatus_to_werror(_nt_status); \ - } \ - (p)->elem = _id3.dn; \ - } else { \ - (p)->elem = NULL; \ - } \ -} while (0) - #define GET_BOOL_DS(s, r, attr, p, elem, strict) do { \ struct drsuapi_DsReplicaAttribute *_a; \ _a = dsdb_find_object_attr_name(s, r, attr, NULL); \ @@ -1054,6 +1024,8 @@ WERROR dsdb_attribute_from_drsuapi(struct ldb_context *ldb, GET_GUID_DS(schema, r, "attributeSecurityGUID", mem_ctx, attr, attributeSecurityGUID); + attr->objectGUID = r->identifier->guid; + GET_UINT32_DS(schema, r, "searchFlags", attr, searchFlags); GET_UINT32_DS(schema, r, "systemFlags", attr, systemFlags); GET_BOOL_DS(schema, r, "isMemberOfPartialAttributeSet", attr, isMemberOfPartialAttributeSet, false); @@ -1099,12 +1071,15 @@ WERROR dsdb_attribute_from_drsuapi(struct ldb_context *ldb, return WERR_OK; } -WERROR dsdb_class_from_drsuapi(struct dsdb_schema *schema, +WERROR dsdb_class_from_drsuapi(struct ldb_context *ldb, + struct dsdb_schema *schema, struct drsuapi_DsReplicaObject *r, TALLOC_CTX *mem_ctx, struct dsdb_class *obj) { WERROR status; + struct drsuapi_DsReplicaAttribute *attr; + DATA_BLOB blob; GET_STRING_DS(schema, r, "name", mem_ctx, obj, cn, true); GET_STRING_DS(schema, r, "lDAPDisplayName", mem_ctx, obj, lDAPDisplayName, true); @@ -1119,9 +1094,24 @@ WERROR dsdb_class_from_drsuapi(struct dsdb_schema *schema, } GET_GUID_DS(schema, r, "schemaIDGUID", mem_ctx, obj, schemaIDGUID); + obj->objectGUID = r->identifier->guid; + GET_UINT32_DS(schema, r, "objectClassCategory", obj, objectClassCategory); GET_STRING_DS(schema, r, "rDNAttID", mem_ctx, obj, rDNAttID, false); - GET_DN_DS(schema, r, "defaultObjectCategory", mem_ctx, obj, defaultObjectCategory, true); + + attr = dsdb_find_object_attr_name(schema, r, "defaultObjectCategory", NULL); + + if (!attr || attr->value_ctr.num_values != 1 || !attr->value_ctr.values[0].blob) { + d_printf("%s: no defaultObjectCategory supplied\n", __location__); + return WERR_INVALID_PARAM; + } + + status = dsdb_syntax_one_DN_drsuapi_to_ldb(mem_ctx, ldb, find_syntax_map_by_standard_oid(LDB_SYNTAX_DN), + schema->iconv_convenience, attr->value_ctr.values[0].blob, &blob); + if (!W_ERROR_IS_OK(status)) { + return status; + } + obj->defaultObjectCategory = (char *)blob.data; GET_UINT32_DS(schema, r, "subClassOf", obj, subClassOf_id); |