diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-11-09 19:24:51 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:45:02 +0100 |
commit | 529763a9aa192a6785ba878aceeb1683c2510913 (patch) | |
tree | 5fc843ffa644969ecd967d8b4133fc19333c33b5 /source4/dsdb/samdb | |
parent | b2ddeeb79d2622b3fd216465716dfa6b8c3e0b86 (diff) | |
download | samba-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/samdb')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/entryUUID.c | 31 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/objectclass.c | 9 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/objectguid.c | 8 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/password_hash.c | 53 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 70 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/samba3sam.c | 23 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/samldb.c | 9 | ||||
-rw-r--r-- | source4/dsdb/samdb/samdb.c | 25 |
8 files changed, 123 insertions, 105 deletions
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); |