summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-11-09 19:24:51 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:45:02 +0100
commit529763a9aa192a6785ba878aceeb1683c2510913 (patch)
tree5fc843ffa644969ecd967d8b4133fc19333c33b5 /source4/dsdb
parentb2ddeeb79d2622b3fd216465716dfa6b8c3e0b86 (diff)
downloadsamba-529763a9aa192a6785ba878aceeb1683c2510913.tar.gz
samba-529763a9aa192a6785ba878aceeb1683c2510913.tar.bz2
samba-529763a9aa192a6785ba878aceeb1683c2510913.zip
r25920: ndr: change NTSTAUS into enum ndr_err_code (samba4 callers)
lib/messaging/ lib/registry/ lib/ldb-samba/ librpc/rpc/ auth/auth_winbind.c auth/gensec/ auth/kerberos/ dsdb/repl/ dsdb/samdb/ dsdb/schema/ torture/ cluster/ctdb/ kdc/ ntvfs/ipc/ torture/rap/ ntvfs/ utils/getntacl.c ntptr/ smb_server/ libcli/wrepl/ wrepl_server/ libcli/cldap/ libcli/dgram/ libcli/ldap/ libcli/raw/ libcli/nbt/ libnet/ winbind/ rpc_server/ metze (This used to be commit 6223c7fddc972687eb577e04fc1c8e0604c35435)
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/repl/drepl_partitions.c18
-rw-r--r--source4/dsdb/repl/replicated_objects.c6
-rw-r--r--source4/dsdb/samdb/ldb_modules/entryUUID.c31
-rw-r--r--source4/dsdb/samdb/ldb_modules/objectclass.c9
-rw-r--r--source4/dsdb/samdb/ldb_modules/objectguid.c8
-rw-r--r--source4/dsdb/samdb/ldb_modules/password_hash.c53
-rw-r--r--source4/dsdb/samdb/ldb_modules/repl_meta_data.c70
-rw-r--r--source4/dsdb/samdb/ldb_modules/samba3sam.c23
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c9
-rw-r--r--source4/dsdb/samdb/samdb.c25
-rw-r--r--source4/dsdb/schema/schema_init.c32
-rw-r--r--source4/dsdb/schema/schema_syntax.c40
12 files changed, 177 insertions, 147 deletions
diff --git a/source4/dsdb/repl/drepl_partitions.c b/source4/dsdb/repl/drepl_partitions.c
index 8b57320bb1..8c0d8e5897 100644
--- a/source4/dsdb/repl/drepl_partitions.c
+++ b/source4/dsdb/repl/drepl_partitions.c
@@ -149,15 +149,16 @@ static WERROR dreplsrv_partition_add_source_dsa(struct dreplsrv_service *s,
const struct ldb_val *val)
{
WERROR status;
- NTSTATUS nt_status;
+ enum ndr_err_code ndr_err;
struct dreplsrv_partition_source_dsa *source;
source = talloc_zero(p, struct dreplsrv_partition_source_dsa);
W_ERROR_HAVE_NO_MEMORY(source);
- nt_status = ndr_pull_struct_blob(val, source, &source->_repsFromBlob,
- (ndr_pull_flags_fn_t)ndr_pull_repsFromToBlob);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ ndr_err = ndr_pull_struct_blob(val, source, &source->_repsFromBlob,
+ (ndr_pull_flags_fn_t)ndr_pull_repsFromToBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err);
return ntstatus_to_werror(nt_status);
}
/* NDR_PRINT_DEBUG(repsFromToBlob, &source->_repsFromBlob); */
@@ -180,7 +181,6 @@ static WERROR dreplsrv_refresh_partition(struct dreplsrv_service *s,
TALLOC_CTX *mem_ctx)
{
WERROR status;
- NTSTATUS nt_status;
const struct ldb_val *ouv_value;
struct replUpToDateVectorBlob ouv;
struct dom_sid *nc_sid;
@@ -220,9 +220,11 @@ static WERROR dreplsrv_refresh_partition(struct dreplsrv_service *s,
ouv_value = ldb_msg_find_ldb_val(r->msgs[0], "replUpToDateVector");
if (ouv_value) {
- nt_status = ndr_pull_struct_blob(ouv_value, mem_ctx, &ouv,
- (ndr_pull_flags_fn_t)ndr_pull_replUpToDateVectorBlob);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ enum ndr_err_code ndr_err;
+ ndr_err = ndr_pull_struct_blob(ouv_value, mem_ctx, &ouv,
+ (ndr_pull_flags_fn_t)ndr_pull_replUpToDateVectorBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err);
return ntstatus_to_werror(nt_status);
}
/* NDR_PRINT_DEBUG(replUpToDateVectorBlob, &ouv); */
diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c
index 6f34ac8556..c47108559d 100644
--- a/source4/dsdb/repl/replicated_objects.c
+++ b/source4/dsdb/repl/replicated_objects.c
@@ -195,6 +195,7 @@ static WERROR dsdb_convert_object(struct ldb_context *ldb,
struct dsdb_extended_replicated_object *out)
{
NTSTATUS nt_status;
+ enum ndr_err_code ndr_err;
WERROR status;
uint32_t i;
struct ldb_message *msg;
@@ -321,9 +322,10 @@ static WERROR dsdb_convert_object(struct ldb_context *ldb,
whenChanged_s = ldb_timestring(msg, whenChanged_t);
W_ERROR_HAVE_NO_MEMORY(whenChanged_s);
- nt_status = ndr_push_struct_blob(&guid_value, msg, &in->object.identifier->guid,
+ ndr_err = ndr_push_struct_blob(&guid_value, msg, &in->object.identifier->guid,
(ndr_push_flags_fn_t)ndr_push_GUID);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ nt_status = ndr_map_error2ntstatus(ndr_err);
return ntstatus_to_werror(nt_status);
}
diff --git a/source4/dsdb/samdb/ldb_modules/entryUUID.c b/source4/dsdb/samdb/ldb_modules/entryUUID.c
index 1a16cb8321..f4231d20d3 100644
--- a/source4/dsdb/samdb/ldb_modules/entryUUID.c
+++ b/source4/dsdb/samdb/ldb_modules/entryUUID.c
@@ -43,14 +43,15 @@ static struct ldb_val encode_guid(struct ldb_module *module, TALLOC_CTX *ctx, co
{
struct GUID guid;
NTSTATUS status = GUID_from_string((char *)val->data, &guid);
+ enum ndr_err_code ndr_err;
struct ldb_val out = data_blob(NULL, 0);
if (!NT_STATUS_IS_OK(status)) {
return out;
}
- status = ndr_push_struct_blob(&out, ctx, &guid,
- (ndr_push_flags_fn_t)ndr_push_GUID);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(&out, ctx, &guid,
+ (ndr_push_flags_fn_t)ndr_push_GUID);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return out;
}
@@ -60,18 +61,19 @@ static struct ldb_val encode_guid(struct ldb_module *module, TALLOC_CTX *ctx, co
static struct ldb_val guid_always_string(struct ldb_module *module, TALLOC_CTX *ctx, const struct ldb_val *val)
{
struct GUID *guid;
- NTSTATUS status;
struct ldb_val out = data_blob(NULL, 0);
if (val->length >= 32 && val->data[val->length] == '\0') {
ldb_handler_copy(module->ldb, ctx, val, &out);
} else {
+ enum ndr_err_code ndr_err;
+
guid = talloc(ctx, struct GUID);
if (guid == NULL) {
return out;
}
- status = ndr_pull_struct_blob(val, guid, guid,
- (ndr_pull_flags_fn_t)ndr_pull_GUID);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob(val, guid, guid,
+ (ndr_pull_flags_fn_t)ndr_pull_GUID);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(guid);
return out;
}
@@ -85,14 +87,15 @@ static struct ldb_val encode_ns_guid(struct ldb_module *module, TALLOC_CTX *ctx,
{
struct GUID guid;
NTSTATUS status = NS_GUID_from_string((char *)val->data, &guid);
+ enum ndr_err_code ndr_err;
struct ldb_val out = data_blob(NULL, 0);
if (!NT_STATUS_IS_OK(status)) {
return out;
}
- status = ndr_push_struct_blob(&out, ctx, &guid,
- (ndr_push_flags_fn_t)ndr_push_GUID);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(&out, ctx, &guid,
+ (ndr_push_flags_fn_t)ndr_push_GUID);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return out;
}
@@ -101,21 +104,21 @@ static struct ldb_val encode_ns_guid(struct ldb_module *module, TALLOC_CTX *ctx,
static struct ldb_val guid_ns_string(struct ldb_module *module, TALLOC_CTX *ctx, const struct ldb_val *val)
{
- NTSTATUS status;
struct ldb_val out = data_blob(NULL, 0);
if (val->length >= 32 && val->data[val->length] == '\0') {
struct GUID guid;
GUID_from_string((char *)val->data, &guid);
out = data_blob_string_const(NS_GUID_string(ctx, &guid));
} else {
+ enum ndr_err_code ndr_err;
struct GUID *guid_p;
guid_p = talloc(ctx, struct GUID);
if (guid_p == NULL) {
return out;
}
- status = ndr_pull_struct_blob(val, guid_p, guid_p,
- (ndr_pull_flags_fn_t)ndr_pull_GUID);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob(val, guid_p, guid_p,
+ (ndr_pull_flags_fn_t)ndr_pull_GUID);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(guid_p);
return out;
}
diff --git a/source4/dsdb/samdb/ldb_modules/objectclass.c b/source4/dsdb/samdb/ldb_modules/objectclass.c
index 0cd00e3834..50ea2ec4e2 100644
--- a/source4/dsdb/samdb/ldb_modules/objectclass.c
+++ b/source4/dsdb/samdb/ldb_modules/objectclass.c
@@ -250,7 +250,7 @@ static int objectclass_sort(struct ldb_module *module,
static DATA_BLOB *get_sd(struct ldb_module *module, TALLOC_CTX *mem_ctx,
const struct dsdb_class *objectclass)
{
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
DATA_BLOB *linear_sd;
struct auth_session_info *session_info
= ldb_get_opaque(module->ldb, "sessionInfo");
@@ -271,10 +271,9 @@ static DATA_BLOB *get_sd(struct ldb_module *module, TALLOC_CTX *mem_ctx,
return NULL;
}
- status = ndr_push_struct_blob(linear_sd, mem_ctx, sd,
- (ndr_push_flags_fn_t)ndr_push_security_descriptor);
-
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(linear_sd, mem_ctx, sd,
+ (ndr_push_flags_fn_t)ndr_push_security_descriptor);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return NULL;
}
diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c
index d7e74cf38d..e9d699d59c 100644
--- a/source4/dsdb/samdb/ldb_modules/objectguid.c
+++ b/source4/dsdb/samdb/ldb_modules/objectguid.c
@@ -111,7 +111,7 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req)
struct ldb_val v;
struct GUID guid;
uint64_t seq_num;
- NTSTATUS nt_status;
+ enum ndr_err_code ndr_err;
int ret;
time_t t = time(NULL);
@@ -143,9 +143,9 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req)
/* a new GUID */
guid = GUID_random();
- nt_status = ndr_push_struct_blob(&v, msg, &guid,
- (ndr_push_flags_fn_t)ndr_push_GUID);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ ndr_err = ndr_push_struct_blob(&v, msg, &guid,
+ (ndr_push_flags_fn_t)ndr_push_GUID);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(down_req);
return LDB_ERR_OPERATIONS_ERROR;
}
diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index 090cce2719..d0afae5395 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -229,7 +229,7 @@ static int setup_primary_kerberos(struct setup_password_fields_io *io,
struct package_PrimaryKerberosBlob _old_pkb;
struct package_PrimaryKerberosCtr3 *old_pkb3 = NULL;
uint32_t i;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
/* Many, many thanks to lukeh@padl.com for this
* algorithm, described in his Nov 10 2004 mail to
@@ -472,9 +472,10 @@ static int setup_primary_kerberos(struct setup_password_fields_io *io,
talloc_steal(io->ac, blob.data);
/* TODO: use ndr_pull_struct_blob_all(), when the ndr layer handles it correct with relative pointers */
- status = ndr_pull_struct_blob(&blob, io->ac, &_old_pkb,
- (ndr_pull_flags_fn_t)ndr_pull_package_PrimaryKerberosBlob);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob(&blob, io->ac, &_old_pkb,
+ (ndr_pull_flags_fn_t)ndr_pull_package_PrimaryKerberosBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
ldb_asprintf_errstring(io->ac->module->ldb,
"setup_primary_kerberos: "
"failed to pull old package_PrimaryKerberosBlob: %s",
@@ -863,7 +864,7 @@ static int setup_supplemental_field(struct setup_password_fields_io *io)
DATA_BLOB pcb_blob;
char *pcb_hexstr;
int ret;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
uint8_t zero16[16];
ZERO_STRUCT(zero16);
@@ -878,9 +879,10 @@ static int setup_supplemental_field(struct setup_password_fields_io *io)
/* if there's an old supplementaCredentials blob then parse it */
if (io->o.supplemental) {
- status = ndr_pull_struct_blob_all(io->o.supplemental, io->ac, &_old_scb,
- (ndr_pull_flags_fn_t)ndr_pull_supplementalCredentialsBlob);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob_all(io->o.supplemental, io->ac, &_old_scb,
+ (ndr_pull_flags_fn_t)ndr_pull_supplementalCredentialsBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
ldb_asprintf_errstring(io->ac->module->ldb,
"setup_supplemental_field: "
"failed to pull old supplementalCredentialsBlob: %s",
@@ -910,9 +912,10 @@ static int setup_supplemental_field(struct setup_password_fields_io *io)
return ret;
}
- status = ndr_push_struct_blob(&pkb_blob, io->ac, &pkb,
- (ndr_push_flags_fn_t)ndr_push_package_PrimaryKerberosBlob);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(&pkb_blob, io->ac, &pkb,
+ (ndr_push_flags_fn_t)ndr_push_package_PrimaryKerberosBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
ldb_asprintf_errstring(io->ac->module->ldb,
"setup_supplemental_field: "
"failed to push package_PrimaryKerberosBlob: %s",
@@ -948,9 +951,10 @@ static int setup_supplemental_field(struct setup_password_fields_io *io)
return ret;
}
- status = ndr_push_struct_blob(&pdb_blob, io->ac, &pdb,
- (ndr_push_flags_fn_t)ndr_push_package_PrimaryWDigestBlob);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(&pdb_blob, io->ac, &pdb,
+ (ndr_push_flags_fn_t)ndr_push_package_PrimaryWDigestBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
ldb_asprintf_errstring(io->ac->module->ldb,
"setup_supplemental_field: "
"failed to push package_PrimaryWDigestBlob: %s",
@@ -974,9 +978,10 @@ static int setup_supplemental_field(struct setup_password_fields_io *io)
pcb.cleartext = io->n.cleartext;
- status = ndr_push_struct_blob(&pcb_blob, io->ac, &pcb,
- (ndr_push_flags_fn_t)ndr_push_package_PrimaryCLEARTEXTBlob);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(&pcb_blob, io->ac, &pcb,
+ (ndr_push_flags_fn_t)ndr_push_package_PrimaryCLEARTEXTBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
ldb_asprintf_errstring(io->ac->module->ldb,
"setup_supplemental_field: "
"failed to push package_PrimaryCLEARTEXTBlob: %s",
@@ -996,9 +1001,10 @@ static int setup_supplemental_field(struct setup_password_fields_io *io)
/*
* setup 'Packages' element
*/
- status = ndr_push_struct_blob(&pb_blob, io->ac, &pb,
- (ndr_push_flags_fn_t)ndr_push_package_PackagesBlob);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(&pb_blob, io->ac, &pb,
+ (ndr_push_flags_fn_t)ndr_push_package_PackagesBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
ldb_asprintf_errstring(io->ac->module->ldb,
"setup_supplemental_field: "
"failed to push package_PackagesBlob: %s",
@@ -1020,9 +1026,10 @@ static int setup_supplemental_field(struct setup_password_fields_io *io)
scb.sub.num_packages = num_packages;
scb.sub.packages = packages;
- status = ndr_push_struct_blob(&io->g.supplemental, io->ac, &scb,
- (ndr_push_flags_fn_t)ndr_push_supplementalCredentialsBlob);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(&io->g.supplemental, io->ac, &scb,
+ (ndr_push_flags_fn_t)ndr_push_supplementalCredentialsBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
ldb_asprintf_errstring(io->ac->module->ldb,
"setup_supplemental_field: "
"failed to push supplementalCredentialsBlob: %s",
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index 42c91d03cc..497ee373de 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -291,7 +291,7 @@ static int replmd_add_originating(struct ldb_module *module,
const struct dsdb_schema *schema,
const struct dsdb_control_current_partition *partition)
{
- NTSTATUS nt_status;
+ enum ndr_err_code ndr_err;
struct ldb_request *down_req;
struct ldb_message *msg;
uint32_t instance_type;
@@ -518,16 +518,15 @@ static int replmd_add_originating(struct ldb_module *module,
replmd_replPropertyMetaDataCtr1_sort(&nmd.ctr.ctr1, &rdn_attr->attributeID_id);
/* generated NDR encoded values */
- nt_status = ndr_push_struct_blob(&guid_value, msg, &guid,
- (ndr_push_flags_fn_t)ndr_push_GUID);
- if (!NT_STATUS_IS_OK(nt_status)) {
- talloc_free(down_req);
+ ndr_err = ndr_push_struct_blob(&guid_value, msg, &guid,
+ (ndr_push_flags_fn_t)ndr_push_GUID);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
ldb_oom(module->ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
- nt_status = ndr_push_struct_blob(&nmd_value, msg, &nmd,
- (ndr_push_flags_fn_t)ndr_push_replPropertyMetaDataBlob);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ ndr_err = ndr_push_struct_blob(&nmd_value, msg, &nmd,
+ (ndr_push_flags_fn_t)ndr_push_replPropertyMetaDataBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(down_req);
ldb_oom(module->ldb);
return LDB_ERR_OPERATIONS_ERROR;
@@ -723,7 +722,7 @@ static int replmd_replicated_apply_add_callback(struct ldb_context *ldb,
static int replmd_replicated_apply_add(struct replmd_replicated_request *ar)
{
- NTSTATUS nt_status;
+ enum ndr_err_code ndr_err;
struct ldb_message *msg;
struct replPropertyMetaDataBlob *md;
struct ldb_val md_value;
@@ -774,9 +773,10 @@ static int replmd_replicated_apply_add(struct replmd_replicated_request *ar)
for (i=0; i < md->ctr.ctr1.count; i++) {
md->ctr.ctr1.array[i].local_usn = seq_num;
}
- nt_status = ndr_push_struct_blob(&md_value, msg, md,
- (ndr_push_flags_fn_t)ndr_push_replPropertyMetaDataBlob);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ ndr_err = ndr_push_struct_blob(&md_value, msg, md,
+ (ndr_push_flags_fn_t)ndr_push_replPropertyMetaDataBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err);
return replmd_replicated_request_werror(ar, ntstatus_to_werror(nt_status));
}
ret = ldb_msg_add_value(msg, "replPropertyMetaData", &md_value, NULL);
@@ -865,7 +865,7 @@ static int replmd_replicated_apply_merge_callback(struct ldb_context *ldb,
static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar)
{
- NTSTATUS nt_status;
+ enum ndr_err_code ndr_err;
struct ldb_message *msg;
struct replPropertyMetaDataBlob *rmd;
struct replPropertyMetaDataBlob omd;
@@ -902,9 +902,10 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar)
/* find existing meta data */
omd_value = ldb_msg_find_ldb_val(ar->sub.search_msg, "replPropertyMetaData");
if (omd_value) {
- nt_status = ndr_pull_struct_blob(omd_value, ar->sub.mem_ctx, &omd,
- (ndr_pull_flags_fn_t)ndr_pull_replPropertyMetaDataBlob);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ ndr_err = ndr_pull_struct_blob(omd_value, ar->sub.mem_ctx, &omd,
+ (ndr_pull_flags_fn_t)ndr_pull_replPropertyMetaDataBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err);
return replmd_replicated_request_werror(ar, ntstatus_to_werror(nt_status));
}
@@ -984,9 +985,10 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar)
}
/* create the meta data value */
- nt_status = ndr_push_struct_blob(&nmd_value, msg, &nmd,
- (ndr_push_flags_fn_t)ndr_push_replPropertyMetaDataBlob);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ ndr_err = ndr_push_struct_blob(&nmd_value, msg, &nmd,
+ (ndr_push_flags_fn_t)ndr_push_replPropertyMetaDataBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err);
return replmd_replicated_request_werror(ar, ntstatus_to_werror(nt_status));
}
@@ -1180,7 +1182,7 @@ static int replmd_drsuapi_DsReplicaCursor2_compare(const struct drsuapi_DsReplic
static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *ar)
{
- NTSTATUS nt_status;
+ enum ndr_err_code ndr_err;
struct ldb_message *msg;
struct replUpToDateVectorBlob ouv;
const struct ldb_val *ouv_value;
@@ -1223,9 +1225,10 @@ static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *a
*/
ouv_value = ldb_msg_find_ldb_val(ar->sub.search_msg, "replUpToDateVector");
if (ouv_value) {
- nt_status = ndr_pull_struct_blob(ouv_value, ar->sub.mem_ctx, &ouv,
- (ndr_pull_flags_fn_t)ndr_pull_replUpToDateVectorBlob);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ ndr_err = ndr_pull_struct_blob(ouv_value, ar->sub.mem_ctx, &ouv,
+ (ndr_pull_flags_fn_t)ndr_pull_replUpToDateVectorBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err);
return replmd_replicated_request_werror(ar, ntstatus_to_werror(nt_status));
}
@@ -1347,9 +1350,10 @@ static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *a
if (!msg) return replmd_replicated_request_werror(ar, WERR_NOMEM);
msg->dn = ar->sub.search_msg->dn;
- nt_status = ndr_push_struct_blob(&nuv_value, msg, &nuv,
- (ndr_push_flags_fn_t)ndr_push_replUpToDateVectorBlob);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ ndr_err = ndr_push_struct_blob(&nuv_value, msg, &nuv,
+ (ndr_push_flags_fn_t)ndr_push_replUpToDateVectorBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err);
return replmd_replicated_request_werror(ar, ntstatus_to_werror(nt_status));
}
ret = ldb_msg_add_value(msg, "replUpToDateVector", &nuv_value, &nuv_el);
@@ -1383,9 +1387,10 @@ static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *a
trf = talloc(ar->sub.mem_ctx, struct repsFromToBlob);
if (!trf) return replmd_replicated_request_werror(ar, WERR_NOMEM);
- nt_status = ndr_pull_struct_blob(&orf_el->values[i], trf, trf,
- (ndr_pull_flags_fn_t)ndr_pull_repsFromToBlob);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ ndr_err = ndr_pull_struct_blob(&orf_el->values[i], trf, trf,
+ (ndr_pull_flags_fn_t)ndr_pull_repsFromToBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err);
return replmd_replicated_request_werror(ar, ntstatus_to_werror(nt_status));
}
@@ -1432,9 +1437,10 @@ static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *a
}
/* we now fill the value which is already attached to ldb_message */
- nt_status = ndr_push_struct_blob(nrf_value, msg, &nrf,
- (ndr_push_flags_fn_t)ndr_push_repsFromToBlob);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ ndr_err = ndr_push_struct_blob(nrf_value, msg, &nrf,
+ (ndr_push_flags_fn_t)ndr_push_repsFromToBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err);
return replmd_replicated_request_werror(ar, ntstatus_to_werror(nt_status));
}
diff --git a/source4/dsdb/samdb/ldb_modules/samba3sam.c b/source4/dsdb/samdb/ldb_modules/samba3sam.c
index d5a1045f93..0d4fead2b5 100644
--- a/source4/dsdb/samdb/ldb_modules/samba3sam.c
+++ b/source4/dsdb/samdb/ldb_modules/samba3sam.c
@@ -84,7 +84,7 @@ static void generate_sambaPrimaryGroupSID(struct ldb_module *module, const char
const struct ldb_val *sidval;
char *sidstring;
struct dom_sid *sid;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
/* We need the domain, so we get it from the objectSid that we hope is here... */
sidval = ldb_msg_find_ldb_val(local, "objectSid");
@@ -96,8 +96,9 @@ static void generate_sambaPrimaryGroupSID(struct ldb_module *module, const char
if (sid == NULL) {
return;
}
- status = ndr_pull_struct_blob(sidval, sid, sid, (ndr_pull_flags_fn_t)ndr_pull_dom_sid);
- if (!NT_STATUS_IS_OK(status)) {
+
+ ndr_err = ndr_pull_struct_blob(sidval, sid, sid, (ndr_pull_flags_fn_t)ndr_pull_dom_sid);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(sid);
return;
}
@@ -179,17 +180,17 @@ static struct ldb_val encode_sid(struct ldb_module *module, TALLOC_CTX *ctx, con
{
struct ldb_val out = data_blob(NULL, 0);
struct dom_sid *sid;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
sid = dom_sid_parse_talloc(ctx, (char *)val->data);
if (sid == NULL) {
return out;
}
- status = ndr_push_struct_blob(&out, ctx, sid,
- (ndr_push_flags_fn_t)ndr_push_dom_sid);
+ ndr_err = ndr_push_struct_blob(&out, ctx, sid,
+ (ndr_push_flags_fn_t)ndr_push_dom_sid);
talloc_free(sid);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return out;
}
@@ -201,16 +202,16 @@ static struct ldb_val decode_sid(struct ldb_module *module, TALLOC_CTX *ctx, con
{
struct ldb_val out = data_blob(NULL, 0);
struct dom_sid *sid;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
sid = talloc(ctx, struct dom_sid);
if (sid == NULL) {
return out;
}
- status = ndr_pull_struct_blob(val, sid, sid,
- (ndr_pull_flags_fn_t)ndr_pull_dom_sid);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob(val, sid, sid,
+ (ndr_pull_flags_fn_t)ndr_pull_dom_sid);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
goto done;
}
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index c054feadce..128ec13242 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -47,10 +47,11 @@ int samldb_notice_sid(struct ldb_module *module,
static bool samldb_msg_add_sid(struct ldb_module *module, struct ldb_message *msg, const char *name, const struct dom_sid *sid)
{
struct ldb_val v;
- NTSTATUS status;
- status = ndr_push_struct_blob(&v, msg, sid,
- (ndr_push_flags_fn_t)ndr_push_dom_sid);
- if (!NT_STATUS_IS_OK(status)) {
+ enum ndr_err_code ndr_err;
+
+ ndr_err = ndr_push_struct_blob(&v, msg, sid,
+ (ndr_push_flags_fn_t)ndr_push_dom_sid);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return false;
}
return (ldb_msg_add_value(msg, name, &v, NULL) == 0);
diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c
index 7de873d77d..36e12e859e 100644
--- a/source4/dsdb/samdb/samdb.c
+++ b/source4/dsdb/samdb/samdb.c
@@ -388,7 +388,7 @@ struct dom_sid *samdb_result_dom_sid(TALLOC_CTX *mem_ctx, const struct ldb_messa
{
const struct ldb_val *v;
struct dom_sid *sid;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
v = ldb_msg_find_ldb_val(msg, attr);
if (v == NULL) {
return NULL;
@@ -397,9 +397,9 @@ struct dom_sid *samdb_result_dom_sid(TALLOC_CTX *mem_ctx, const struct ldb_messa
if (sid == NULL) {
return NULL;
}
- status = ndr_pull_struct_blob(v, sid, sid,
- (ndr_pull_flags_fn_t)ndr_pull_dom_sid);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob(v, sid, sid,
+ (ndr_pull_flags_fn_t)ndr_pull_dom_sid);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(sid);
return NULL;
}
@@ -412,7 +412,7 @@ struct dom_sid *samdb_result_dom_sid(TALLOC_CTX *mem_ctx, const struct ldb_messa
struct GUID samdb_result_guid(const struct ldb_message *msg, const char *attr)
{
const struct ldb_val *v;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
struct GUID guid;
TALLOC_CTX *mem_ctx;
@@ -423,10 +423,10 @@ struct GUID samdb_result_guid(const struct ldb_message *msg, const char *attr)
mem_ctx = talloc_named_const(NULL, 0, "samdb_result_guid");
if (!mem_ctx) return guid;
- status = ndr_pull_struct_blob(v, mem_ctx, &guid,
- (ndr_pull_flags_fn_t)ndr_pull_GUID);
+ ndr_err = ndr_pull_struct_blob(v, mem_ctx, &guid,
+ (ndr_pull_flags_fn_t)ndr_pull_GUID);
talloc_free(mem_ctx);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return guid;
}
@@ -758,10 +758,11 @@ int samdb_msg_add_dom_sid(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, stru
const char *attr_name, struct dom_sid *sid)
{
struct ldb_val v;
- NTSTATUS status;
- status = ndr_push_struct_blob(&v, mem_ctx, sid,
- (ndr_push_flags_fn_t)ndr_push_dom_sid);
- if (!NT_STATUS_IS_OK(status)) {
+ enum ndr_err_code ndr_err;
+
+ ndr_err = ndr_push_struct_blob(&v, mem_ctx, sid,
+ (ndr_push_flags_fn_t)ndr_push_dom_sid);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return -1;
}
return ldb_msg_add_value(msg, attr_name, &v, NULL);
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c
index ff853018a2..c592bf8de0 100644
--- a/source4/dsdb/schema/schema_init.c
+++ b/source4/dsdb/schema/schema_init.c
@@ -79,13 +79,14 @@ WERROR dsdb_load_oid_mappings_ldb(struct dsdb_schema *schema,
const struct ldb_val *schemaInfo)
{
WERROR status;
- NTSTATUS nt_status;
+ enum ndr_err_code ndr_err;
struct prefixMapBlob pfm;
char *schema_info;
- nt_status = ndr_pull_struct_blob(prefixMap, schema, &pfm,
- (ndr_pull_flags_fn_t)ndr_pull_prefixMapBlob);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ ndr_err = ndr_pull_struct_blob(prefixMap, schema, &pfm,
+ (ndr_pull_flags_fn_t)ndr_pull_prefixMapBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err);
return ntstatus_to_werror(nt_status);
}
@@ -160,7 +161,7 @@ WERROR dsdb_get_oid_mappings_ldb(const struct dsdb_schema *schema,
struct ldb_val *schemaInfo)
{
WERROR status;
- NTSTATUS nt_status;
+ enum ndr_err_code ndr_err;
struct drsuapi_DsReplicaOIDMapping_Ctr *ctr;
struct prefixMapBlob pfm;
@@ -171,10 +172,11 @@ WERROR dsdb_get_oid_mappings_ldb(const struct dsdb_schema *schema,
pfm.reserved = 0;
pfm.ctr.dsdb = *ctr;
- nt_status = ndr_push_struct_blob(prefixMap, mem_ctx, &pfm,
- (ndr_push_flags_fn_t)ndr_push_prefixMapBlob);
+ ndr_err = ndr_push_struct_blob(prefixMap, mem_ctx, &pfm,
+ (ndr_push_flags_fn_t)ndr_push_prefixMapBlob);
talloc_free(ctr);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err);
return ntstatus_to_werror(nt_status);
}
@@ -652,11 +654,12 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb
if (_a && _a->value_ctr.num_values >= 1 \
&& _a->value_ctr.values[0].blob) { \
struct drsuapi_DsReplicaObjectIdentifier3 _id3; \
- NTSTATUS _nt_status; \
- _nt_status = ndr_pull_struct_blob_all(_a->value_ctr.values[0].blob, \
+ enum ndr_err_code _ndr_err; \
+ _ndr_err = ndr_pull_struct_blob_all(_a->value_ctr.values[0].blob, \
mem_ctx, &_id3,\
(ndr_pull_flags_fn_t)ndr_pull_drsuapi_DsReplicaObjectIdentifier3);\
- if (!NT_STATUS_IS_OK(_nt_status)) { \
+ 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; \
@@ -713,11 +716,12 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb
if (_a && _a->value_ctr.num_values >= 1 \
&& _a->value_ctr.values[0].blob \
&& _a->value_ctr.values[0].blob->length == 16) { \
- NTSTATUS _nt_status; \
- _nt_status = ndr_pull_struct_blob_all(_a->value_ctr.values[0].blob, \
+ enum ndr_err_code _ndr_err; \
+ _ndr_err = ndr_pull_struct_blob_all(_a->value_ctr.values[0].blob, \
mem_ctx, &(p)->elem, \
(ndr_pull_flags_fn_t)ndr_pull_GUID); \
- if (!NT_STATUS_IS_OK(_nt_status)) { \
+ if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
+ NTSTATUS _nt_status = ndr_map_error2ntstatus(_ndr_err); \
return ntstatus_to_werror(_nt_status); \
} \
} else { \
diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c
index 760417b676..dd2da4f0f7 100644
--- a/source4/dsdb/schema/schema_syntax.c
+++ b/source4/dsdb/schema/schema_syntax.c
@@ -839,7 +839,7 @@ static WERROR dsdb_syntax_DN_drsuapi_to_ldb(const struct dsdb_schema *schema,
for (i=0; i < out->num_values; i++) {
struct drsuapi_DsReplicaObjectIdentifier3 id3;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
if (in->value_ctr.values[i].blob == NULL) {
return WERR_FOOBAR;
@@ -849,10 +849,11 @@ static WERROR dsdb_syntax_DN_drsuapi_to_ldb(const struct dsdb_schema *schema,
return WERR_FOOBAR;
}
- status = ndr_pull_struct_blob_all(in->value_ctr.values[i].blob,
- out->values, &id3,
- (ndr_pull_flags_fn_t)ndr_pull_drsuapi_DsReplicaObjectIdentifier3);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob_all(in->value_ctr.values[i].blob,
+ out->values, &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);
return ntstatus_to_werror(status);
}
@@ -887,8 +888,8 @@ static WERROR dsdb_syntax_DN_ldb_to_drsuapi(const struct dsdb_schema *schema,
W_ERROR_HAVE_NO_MEMORY(blobs);
for (i=0; i < in->num_values; i++) {
- NTSTATUS status;
struct drsuapi_DsReplicaObjectIdentifier3 id3;
+ enum ndr_err_code ndr_err;
out->value_ctr.values[i].blob = &blobs[i];
@@ -896,9 +897,10 @@ static WERROR dsdb_syntax_DN_ldb_to_drsuapi(const struct dsdb_schema *schema,
ZERO_STRUCT(id3);
id3.dn = (const char *)in->values[i].data;
- status = ndr_push_struct_blob(&blobs[i], blobs, &id3,
- (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(&blobs[i], blobs, &id3,
+ (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
return ntstatus_to_werror(status);
}
}
@@ -926,7 +928,7 @@ static WERROR dsdb_syntax_DN_BINARY_drsuapi_to_ldb(const struct dsdb_schema *sch
struct drsuapi_DsReplicaObjectIdentifier3Binary id3b;
char *binary;
char *str;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
if (in->value_ctr.values[i].blob == NULL) {
return WERR_FOOBAR;
@@ -936,10 +938,11 @@ static WERROR dsdb_syntax_DN_BINARY_drsuapi_to_ldb(const struct dsdb_schema *sch
return WERR_FOOBAR;
}
- status = ndr_pull_struct_blob_all(in->value_ctr.values[i].blob,
- out->values, &id3b,
- (ndr_pull_flags_fn_t)ndr_pull_drsuapi_DsReplicaObjectIdentifier3Binary);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob_all(in->value_ctr.values[i].blob,
+ out->values, &id3b,
+ (ndr_pull_flags_fn_t)ndr_pull_drsuapi_DsReplicaObjectIdentifier3Binary);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
return ntstatus_to_werror(status);
}
@@ -984,8 +987,8 @@ static WERROR dsdb_syntax_DN_BINARY_ldb_to_drsuapi(const struct dsdb_schema *sch
W_ERROR_HAVE_NO_MEMORY(blobs);
for (i=0; i < in->num_values; i++) {
- NTSTATUS status;
struct drsuapi_DsReplicaObjectIdentifier3Binary id3b;
+ enum ndr_err_code ndr_err;
out->value_ctr.values[i].blob = &blobs[i];
@@ -994,9 +997,10 @@ static WERROR dsdb_syntax_DN_BINARY_ldb_to_drsuapi(const struct dsdb_schema *sch
id3b.dn = (const char *)in->values[i].data;
id3b.binary = data_blob(NULL, 0);
- status = ndr_push_struct_blob(&blobs[i], blobs, &id3b,
- (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3Binary);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(&blobs[i], blobs, &id3b,
+ (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3Binary);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
return ntstatus_to_werror(status);
}
}