diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-12-10 14:36:12 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-12-10 17:51:29 +1100 |
commit | c7c97b61aef94d6adc786b3e6eb6e347d1d9382c (patch) | |
tree | cd9fef502f5622b511ea2b07f9eaa079632836c3 /source4/dsdb | |
parent | d35b7d0aa4bf66af25c23fe26699b2dc86584e26 (diff) | |
download | samba-c7c97b61aef94d6adc786b3e6eb6e347d1d9382c.tar.gz samba-c7c97b61aef94d6adc786b3e6eb6e347d1d9382c.tar.bz2 samba-c7c97b61aef94d6adc786b3e6eb6e347d1d9382c.zip |
s4-schema: use GUID_to_ndr_blob()
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/schema/schema_set.c | 8 | ||||
-rw-r--r-- | source4/dsdb/schema/schema_syntax.c | 24 |
2 files changed, 15 insertions, 17 deletions
diff --git a/source4/dsdb/schema/schema_set.c b/source4/dsdb/schema/schema_set.c index c321bc9cca..e65e372623 100644 --- a/source4/dsdb/schema/schema_set.c +++ b/source4/dsdb/schema/schema_set.c @@ -467,10 +467,11 @@ int dsdb_schema_fill_extended_dn(struct ldb_context *ldb, struct dsdb_schema *sc struct dsdb_class *cur; const struct dsdb_class *target_class; for (cur = schema->classes; cur; cur = cur->next) { - enum ndr_err_code ndr_err; const struct ldb_val *rdn; struct ldb_val guid; + NTSTATUS status; struct ldb_dn *dn = ldb_dn_new(NULL, ldb, cur->defaultObjectCategory); + if (!dn) { return LDB_ERR_INVALID_DN_SYNTAX; } @@ -485,9 +486,8 @@ int dsdb_schema_fill_extended_dn(struct ldb_context *ldb, struct dsdb_schema *sc return LDB_ERR_CONSTRAINT_VIOLATION; } - ndr_err = ndr_push_struct_blob(&guid, dn, NULL, &target_class->objectGUID, - (ndr_push_flags_fn_t)ndr_push_GUID); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + status = GUID_to_ndr_blob(&target_class->objectGUID, dn, &guid); + if (!NT_STATUS_IS_OK(status)) { talloc_free(dn); return LDB_ERR_OPERATIONS_ERROR; } diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c index 4ce10ff4ad..1989db0699 100644 --- a/source4/dsdb/schema/schema_syntax.c +++ b/source4/dsdb/schema/schema_syntax.c @@ -1040,6 +1040,7 @@ WERROR dsdb_syntax_one_DN_drsuapi_to_ldb(TALLOC_CTX *mem_ctx, struct ldb_context struct ldb_dn *dn; TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx); int ret; + NTSTATUS status; if (!tmp_ctx) { W_ERROR_HAVE_NO_MEMORY(tmp_ctx); @@ -1061,7 +1062,7 @@ WERROR dsdb_syntax_one_DN_drsuapi_to_ldb(TALLOC_CTX *mem_ctx, struct ldb_context tmp_ctx, iconv_convenience, &id3, (ndr_pull_flags_fn_t)ndr_pull_drsuapi_DsReplicaObjectIdentifier3); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - NTSTATUS status = ndr_map_error2ntstatus(ndr_err); + status = ndr_map_error2ntstatus(ndr_err); talloc_free(tmp_ctx); return ntstatus_to_werror(status); } @@ -1072,11 +1073,9 @@ WERROR dsdb_syntax_one_DN_drsuapi_to_ldb(TALLOC_CTX *mem_ctx, struct ldb_context /* If this fails, it must be out of memory, as it does not do much parsing */ W_ERROR_HAVE_NO_MEMORY(dn); } - - ndr_err = ndr_push_struct_blob(&guid_blob, tmp_ctx, iconv_convenience, &id3.guid, - (ndr_push_flags_fn_t)ndr_push_GUID); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - NTSTATUS status = ndr_map_error2ntstatus(ndr_err); + + status = GUID_to_ndr_blob(&id3.guid, tmp_ctx, &guid_blob); + if (!NT_STATUS_IS_OK(status)) { talloc_free(tmp_ctx); return ntstatus_to_werror(status); } @@ -1094,7 +1093,7 @@ WERROR dsdb_syntax_one_DN_drsuapi_to_ldb(TALLOC_CTX *mem_ctx, struct ldb_context ndr_err = ndr_push_struct_blob(&sid_blob, tmp_ctx, iconv_convenience, &id3.sid, (ndr_push_flags_fn_t)ndr_push_dom_sid); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - NTSTATUS status = ndr_map_error2ntstatus(ndr_err); + status = ndr_map_error2ntstatus(ndr_err); talloc_free(tmp_ctx); return ntstatus_to_werror(status); } @@ -1244,6 +1243,7 @@ static WERROR dsdb_syntax_DN_BINARY_drsuapi_to_ldb(struct ldb_context *ldb, DATA_BLOB guid_blob; struct ldb_dn *dn; struct dsdb_dn *dsdb_dn; + NTSTATUS status; TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx); if (!tmp_ctx) { W_ERROR_HAVE_NO_MEMORY(tmp_ctx); @@ -1265,7 +1265,7 @@ static WERROR dsdb_syntax_DN_BINARY_drsuapi_to_ldb(struct ldb_context *ldb, tmp_ctx, schema->iconv_convenience, &id3, (ndr_pull_flags_fn_t)ndr_pull_drsuapi_DsReplicaObjectIdentifier3Binary); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - NTSTATUS status = ndr_map_error2ntstatus(ndr_err); + status = ndr_map_error2ntstatus(ndr_err); talloc_free(tmp_ctx); return ntstatus_to_werror(status); } @@ -1277,10 +1277,8 @@ static WERROR dsdb_syntax_DN_BINARY_drsuapi_to_ldb(struct ldb_context *ldb, W_ERROR_HAVE_NO_MEMORY(dn); } - ndr_err = ndr_push_struct_blob(&guid_blob, tmp_ctx, schema->iconv_convenience, &id3.guid, - (ndr_push_flags_fn_t)ndr_push_GUID); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - NTSTATUS status = ndr_map_error2ntstatus(ndr_err); + status = GUID_to_ndr_blob(&id3.guid, tmp_ctx, &guid_blob); + if (!NT_STATUS_IS_OK(status)) { talloc_free(tmp_ctx); return ntstatus_to_werror(status); } @@ -1298,7 +1296,7 @@ static WERROR dsdb_syntax_DN_BINARY_drsuapi_to_ldb(struct ldb_context *ldb, ndr_err = ndr_push_struct_blob(&sid_blob, tmp_ctx, schema->iconv_convenience, &id3.sid, (ndr_push_flags_fn_t)ndr_push_dom_sid); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - NTSTATUS status = ndr_map_error2ntstatus(ndr_err); + status = ndr_map_error2ntstatus(ndr_err); talloc_free(tmp_ctx); return ntstatus_to_werror(status); } |