{
size_t len = response->length - sizeof(struct winbindd_response);
if (len > 4) {
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
DATA_BLOB blob;
blob.length = len - 4;
blob.data = (uint8_t *)(((char *)response->extra_data.data) + 4);
- status = ndr_pull_struct_blob(&blob, mem_ctx, info3,
+ ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, info3,
(ndr_pull_flags_fn_t)ndr_pull_netr_SamInfo3);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
- return status;
+ return NT_STATUS_OK;
} else {
DEBUG(2, ("get_info3_from_ndr: No info3 struct found!\n"));
return NT_STATUS_UNSUCCESSFUL;
{
struct schannel_state *state = (struct schannel_state *)gensec_security->private_data;
NTSTATUS status;
+ enum ndr_err_code ndr_err;
struct schannel_bind bind_schannel;
struct schannel_bind_ack bind_schannel_ack;
struct creds_CredentialState *creds;
bind_schannel.u.info3.workstation = cli_credentials_get_workstation(gensec_security->credentials);
#endif
- status = ndr_push_struct_blob(out, out_mem_ctx, &bind_schannel,
- (ndr_push_flags_fn_t)ndr_push_schannel_bind);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(out, out_mem_ctx, &bind_schannel,
+ (ndr_push_flags_fn_t)ndr_push_schannel_bind);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
DEBUG(3, ("Could not create schannel bind: %s\n",
nt_errstr(status)));
return status;
}
/* parse the schannel startup blob */
- status = ndr_pull_struct_blob(&in, out_mem_ctx, &bind_schannel,
- (ndr_pull_flags_fn_t)ndr_pull_schannel_bind);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob(&in, out_mem_ctx, &bind_schannel,
+ (ndr_pull_flags_fn_t)ndr_pull_schannel_bind);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
DEBUG(3, ("Could not parse incoming schannel bind: %s\n",
nt_errstr(status)));
return status;
bind_schannel_ack.unknown2 = 0;
bind_schannel_ack.unknown3 = 0x6c0000;
- status = ndr_push_struct_blob(out, out_mem_ctx, &bind_schannel_ack,
- (ndr_push_flags_fn_t)ndr_push_schannel_bind_ack);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(out, out_mem_ctx, &bind_schannel_ack,
+ (ndr_push_flags_fn_t)ndr_push_schannel_bind_ack);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
DEBUG(3, ("Could not return schannel bind ack for client %s: %s\n",
workstation, nt_errstr(status)));
return status;
{
krb5_error_code ret;
NTSTATUS status;
+ enum ndr_err_code ndr_err;
struct PAC_SIGNATURE_DATA *srv_sig_ptr = NULL;
struct PAC_SIGNATURE_DATA *kdc_sig_ptr = NULL;
struct PAC_SIGNATURE_DATA *srv_sig_wipe = NULL;
return NT_STATUS_NO_MEMORY;
}
- status = ndr_pull_struct_blob(&blob, pac_data, pac_data,
- (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("can't parse the PAC\n"));
+ ndr_err = ndr_pull_struct_blob(&blob, pac_data, pac_data,
+ (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
+ DEBUG(0,("can't parse the PAC: %s\n",
+ nt_errstr(status)));
return status;
}
return NT_STATUS_INVALID_PARAMETER;
}
- status = ndr_pull_struct_blob(&blob, pac_data_raw, pac_data_raw,
- (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA_RAW);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("can't parse the PAC\n"));
+ ndr_err = ndr_pull_struct_blob(&blob, pac_data_raw, pac_data_raw,
+ (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA_RAW);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
+ DEBUG(0,("can't parse the PAC: %s\n",
+ nt_errstr(status)));
return status;
}
/* Find and zero out the signatures, as required by the signing algorithm */
/* We find the data blobs above, now we parse them to get at the exact portion we should zero */
- status = ndr_pull_struct_blob(kdc_sig_blob, kdc_sig_wipe, kdc_sig_wipe,
- (ndr_pull_flags_fn_t)ndr_pull_PAC_SIGNATURE_DATA);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("can't parse the KDC signature\n"));
+ ndr_err = ndr_pull_struct_blob(kdc_sig_blob, kdc_sig_wipe, kdc_sig_wipe,
+ (ndr_pull_flags_fn_t)ndr_pull_PAC_SIGNATURE_DATA);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
+ DEBUG(0,("can't parse the KDC signature: %s\n",
+ nt_errstr(status)));
return status;
}
- status = ndr_pull_struct_blob(srv_sig_blob, srv_sig_wipe, srv_sig_wipe,
- (ndr_pull_flags_fn_t)ndr_pull_PAC_SIGNATURE_DATA);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("can't parse the SRV signature\n"));
+ ndr_err = ndr_pull_struct_blob(srv_sig_blob, srv_sig_wipe, srv_sig_wipe,
+ (ndr_pull_flags_fn_t)ndr_pull_PAC_SIGNATURE_DATA);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
+ DEBUG(0,("can't parse the SRV signature: %s\n",
+ nt_errstr(status)));
return status;
}
-
+
/* Now zero the decoded structure */
memset(kdc_sig_wipe->signature.data, '\0', kdc_sig_wipe->signature.length);
memset(srv_sig_wipe->signature.data, '\0', srv_sig_wipe->signature.length);
/* and reencode, back into the same place it came from */
- status = ndr_push_struct_blob(kdc_sig_blob, pac_data_raw, kdc_sig_wipe,
- (ndr_push_flags_fn_t)ndr_push_PAC_SIGNATURE_DATA);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("can't repack the KDC signature\n"));
+ ndr_err = ndr_push_struct_blob(kdc_sig_blob, pac_data_raw, kdc_sig_wipe,
+ (ndr_push_flags_fn_t)ndr_push_PAC_SIGNATURE_DATA);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
+ DEBUG(0,("can't repack the KDC signature: %s\n",
+ nt_errstr(status)));
return status;
- }
- status = ndr_push_struct_blob(srv_sig_blob, pac_data_raw, srv_sig_wipe,
- (ndr_push_flags_fn_t)ndr_push_PAC_SIGNATURE_DATA);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("can't repack the SRV signature\n"));
+ }
+ ndr_err = ndr_push_struct_blob(srv_sig_blob, pac_data_raw, srv_sig_wipe,
+ (ndr_push_flags_fn_t)ndr_push_PAC_SIGNATURE_DATA);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
+ DEBUG(0,("can't repack the SRV signature: %s\n",
+ nt_errstr(status)));
return status;
}
/* push out the whole structure, but now with zero'ed signatures */
- status = ndr_push_struct_blob(&modified_pac_blob, pac_data_raw, pac_data_raw,
- (ndr_push_flags_fn_t)ndr_push_PAC_DATA_RAW);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("can't repack the RAW PAC\n"));
+ ndr_err = ndr_push_struct_blob(&modified_pac_blob, pac_data_raw, pac_data_raw,
+ (ndr_push_flags_fn_t)ndr_push_PAC_DATA_RAW);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
+ DEBUG(0,("can't repack the RAW PAC: %s\n",
+ nt_errstr(status)));
return status;
}
logon_info->info3.base.full_name.string));
*pac_data_out = pac_data;
- return status;
+ return NT_STATUS_OK;
}
_PUBLIC_ NTSTATUS kerberos_pac_logon_info(TALLOC_CTX *mem_ctx,
{
NTSTATUS nt_status;
krb5_error_code ret;
+ enum ndr_err_code ndr_err;
DATA_BLOB zero_blob = data_blob(NULL, 0);
DATA_BLOB tmp_blob = data_blob(NULL, 0);
struct PAC_SIGNATURE_DATA *kdc_checksum = NULL;
memset(kdc_checksum->signature.data, '\0', kdc_checksum->signature.length);
memset(srv_checksum->signature.data, '\0', srv_checksum->signature.length);
- nt_status = ndr_push_struct_blob(&tmp_blob, mem_ctx, pac_data,
- (ndr_push_flags_fn_t)ndr_push_PAC_DATA);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ ndr_err = ndr_push_struct_blob(&tmp_blob, mem_ctx, pac_data,
+ (ndr_push_flags_fn_t)ndr_push_PAC_DATA);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ nt_status = ndr_map_error2ntstatus(ndr_err);
DEBUG(1, ("PAC (presig) push failed: %s\n", nt_errstr(nt_status)));
talloc_free(pac_data);
return EINVAL;
}
/* And push it out again, this time to the world. This relies on determanistic pointer values */
- nt_status = ndr_push_struct_blob(&tmp_blob, mem_ctx, pac_data,
- (ndr_push_flags_fn_t)ndr_push_PAC_DATA);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ ndr_err = ndr_push_struct_blob(&tmp_blob, mem_ctx, pac_data,
+ (ndr_push_flags_fn_t)ndr_push_PAC_DATA);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ nt_status = ndr_map_error2ntstatus(ndr_err);
DEBUG(1, ("PAC (final) push failed: %s\n", nt_errstr(nt_status)));
talloc_free(pac_data);
return EINVAL;
{
TDB_DATA dbuf;
DATA_BLOB blob;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
dbuf = lck->data;
blob.data = dbuf.dptr;
blob.length = dbuf.dsize;
- status = ndr_pull_struct_blob(&blob, lck, file, (ndr_pull_flags_fn_t)ndr_pull_opendb_file);
+ ndr_err = ndr_pull_struct_blob(&blob, lck, file, (ndr_pull_flags_fn_t)ndr_pull_opendb_file);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
- return status;
+ return NT_STATUS_OK;
}
/*
{
TDB_DATA dbuf;
DATA_BLOB blob;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
int ret;
if (!file->num_entries) {
return NT_STATUS_OK;
}
- status = ndr_push_struct_blob(&blob, lck, file, (ndr_push_flags_fn_t)ndr_push_opendb_file);
- NT_STATUS_NOT_OK_RETURN(status);
+ ndr_err = ndr_push_struct_blob(&blob, lck, file, (ndr_push_flags_fn_t)ndr_push_opendb_file);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
dbuf.dptr = blob.data;
dbuf.dsize = blob.length;
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); */
TALLOC_CTX *mem_ctx)
{
WERROR status;
- NTSTATUS nt_status;
const struct ldb_val *ouv_value;
struct replUpToDateVectorBlob ouv;
struct dom_sid *nc_sid;
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); */
struct dsdb_extended_replicated_object *out)
{
NTSTATUS nt_status;
+ enum ndr_err_code ndr_err;
WERROR status;
uint32_t i;
struct ldb_message *msg;
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);
}
{
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;
}
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;
}
{
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;
}
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;
}
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");
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;
}
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);
/* 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;
}
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
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",
DATA_BLOB pcb_blob;
char *pcb_hexstr;
int ret;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
uint8_t zero16[16];
ZERO_STRUCT(zero16);
/* 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",
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",
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",
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",
/*
* 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",
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",
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;
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;
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;
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);
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;
/* 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));
}
}
/* 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));
}
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;
*/
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));
}
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);
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));
}
}
/* 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));
}
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");
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;
}
{
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;
}
{
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;
}
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);
{
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;
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;
}
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;
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;
}
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);
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);
}
struct ldb_val *schemaInfo)
{
WERROR status;
- NTSTATUS nt_status;
+ enum ndr_err_code ndr_err;
struct drsuapi_DsReplicaOIDMapping_Ctr *ctr;
struct prefixMapBlob pfm;
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);
}
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; \
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 { \
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;
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);
}
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];
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);
}
}
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;
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);
}
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];
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);
}
}
hdb_entry_ex *entry_ex)
{
krb5_error_code ret = 0;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
struct samr_Password *hash;
const struct ldb_val *sc_val;
struct supplementalCredentialsBlob scb;
/* supplementalCredentials if present */
if (sc_val) {
- status = ndr_pull_struct_blob_all(sc_val, mem_ctx, &scb,
- (ndr_pull_flags_fn_t)ndr_pull_supplementalCredentialsBlob);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob_all(sc_val, mem_ctx, &scb,
+ (ndr_pull_flags_fn_t)ndr_pull_supplementalCredentialsBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
dump_data(0, sc_val->data, sc_val->length);
ret = EINVAL;
goto out;
talloc_steal(mem_ctx, 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, mem_ctx, &_pkb,
- (ndr_pull_flags_fn_t)ndr_pull_package_PrimaryKerberosBlob);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &_pkb,
+ (ndr_pull_flags_fn_t)ndr_pull_package_PrimaryKerberosBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
krb5_set_error_string(context, "LDB_message2entry_keys: could not parse package_PrimaryKerberosBlob");
krb5_warnx(context, "LDB_message2entry_keys: could not parse package_PrimaryKerberosBlob");
ret = EINVAL;
struct netr_SamInfo3 *info3;
krb5_data pac_data;
NTSTATUS nt_status;
+ enum ndr_err_code ndr_err;
DATA_BLOB pac_out;
krb5_error_code ret;
logon_info.info->info3 = *info3;
- nt_status = ndr_push_struct_blob(&pac_out, mem_ctx, &logon_info,
- (ndr_push_flags_fn_t)ndr_push_PAC_LOGON_INFO_CTR);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ ndr_err = ndr_push_struct_blob(&pac_out, mem_ctx, &logon_info,
+ (ndr_push_flags_fn_t)ndr_push_PAC_LOGON_INFO_CTR);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ nt_status = ndr_map_error2ntstatus(ndr_err);
DEBUG(1, ("PAC (presig) push failed: %s\n", nt_errstr(nt_status)));
return EINVAL;
}
struct hdb_entry_ex *server, krb5_pac *pac)
{
NTSTATUS nt_status;
+ enum ndr_err_code ndr_err;
krb5_error_code ret;
unsigned int userAccountControl;
return ENOMEM;
}
- nt_status = ndr_pull_struct_blob(&pac_in, mem_ctx, &logon_info,
- (ndr_pull_flags_fn_t)ndr_pull_PAC_LOGON_INFO_CTR);
- if (!NT_STATUS_IS_OK(nt_status) || !logon_info.info) {
+ ndr_err = ndr_pull_struct_blob(&pac_in, mem_ctx, &logon_info,
+ (ndr_pull_flags_fn_t)ndr_pull_PAC_LOGON_INFO_CTR);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err) || !logon_info.info) {
+ nt_status = ndr_map_error2ntstatus(ndr_err);
DEBUG(0,("can't parse the PAC LOGON_INFO: %s\n", nt_errstr(nt_status)));
talloc_free(mem_ctx);
return EINVAL;
static int ldif_read_objectSid(struct ldb_context *ldb, void *mem_ctx,
const struct ldb_val *in, struct ldb_val *out)
{
+ enum ndr_err_code ndr_err;
struct dom_sid *sid;
- NTSTATUS status;
sid = dom_sid_parse_talloc(mem_ctx, (const char *)in->data);
if (sid == NULL) {
return -1;
}
- status = ndr_push_struct_blob(out, mem_ctx, sid,
- (ndr_push_flags_fn_t)ndr_push_dom_sid);
+ ndr_err = ndr_push_struct_blob(out, mem_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 -1;
}
return 0;
const struct ldb_val *in, struct ldb_val *out)
{
struct dom_sid *sid;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
+
sid = talloc(mem_ctx, struct dom_sid);
if (sid == NULL) {
return -1;
}
- status = ndr_pull_struct_blob(in, sid, sid,
- (ndr_pull_flags_fn_t)ndr_pull_dom_sid);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob(in, sid, sid,
+ (ndr_pull_flags_fn_t)ndr_pull_dom_sid);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(sid);
return -1;
}
{
struct GUID guid;
NTSTATUS status;
+ enum ndr_err_code ndr_err;
status = GUID_from_string((const char *)in->data, &guid);
if (!NT_STATUS_IS_OK(status)) {
return -1;
}
- status = ndr_push_struct_blob(out, mem_ctx, &guid,
- (ndr_push_flags_fn_t)ndr_push_GUID);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(out, mem_ctx, &guid,
+ (ndr_push_flags_fn_t)ndr_push_GUID);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return -1;
}
return 0;
const struct ldb_val *in, struct ldb_val *out)
{
struct GUID guid;
- NTSTATUS status;
- status = ndr_pull_struct_blob(in, mem_ctx, &guid,
- (ndr_pull_flags_fn_t)ndr_pull_GUID);
- if (!NT_STATUS_IS_OK(status)) {
+ enum ndr_err_code ndr_err;
+ ndr_err = ndr_pull_struct_blob(in, mem_ctx, &guid,
+ (ndr_pull_flags_fn_t)ndr_pull_GUID);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return -1;
}
out->data = (uint8_t *)GUID_string(mem_ctx, &guid);
const struct ldb_val *in, struct ldb_val *out)
{
struct security_descriptor *sd;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
sd = sddl_decode(mem_ctx, (const char *)in->data, NULL);
if (sd == NULL) {
return -1;
}
- status = ndr_push_struct_blob(out, mem_ctx, sd,
- (ndr_push_flags_fn_t)ndr_push_security_descriptor);
+ ndr_err = ndr_push_struct_blob(out, mem_ctx, sd,
+ (ndr_push_flags_fn_t)ndr_push_security_descriptor);
talloc_free(sd);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return -1;
}
return 0;
const struct ldb_val *in, struct ldb_val *out)
{
struct security_descriptor *sd;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
sd = talloc(mem_ctx, struct security_descriptor);
if (sd == NULL) {
return -1;
}
- status = ndr_pull_struct_blob(in, sd, sd,
- (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob(in, sd, sd,
+ (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(sd);
return -1;
}
static void irpc_handler_reply(struct messaging_context *msg_ctx, struct irpc_message *m)
{
struct irpc_request *irpc;
+ enum ndr_err_code ndr_err;
irpc = (struct irpc_request *)idr_find(msg_ctx->idr, m->header.callid);
if (irpc == NULL) return;
/* parse the reply data */
- irpc->status = irpc->table->calls[irpc->callnum].ndr_pull(m->ndr, NDR_OUT, irpc->r);
- if (NT_STATUS_IS_OK(irpc->status)) {
+ ndr_err = irpc->table->calls[irpc->callnum].ndr_pull(m->ndr, NDR_OUT, irpc->r);
+ if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
irpc->status = m->header.status;
talloc_steal(irpc->mem_ctx, m);
} else {
+ irpc->status = ndr_map_error2ntstatus(ndr_err);
talloc_steal(irpc, m);
}
irpc->done = true;
{
struct ndr_push *push;
DATA_BLOB packet;
+ enum ndr_err_code ndr_err;
m->header.status = status;
m->header.flags |= IRPC_FLAG_REPLY;
/* construct the packet */
- status = ndr_push_irpc_header(push, NDR_SCALARS|NDR_BUFFERS, &m->header);
- if (!NT_STATUS_IS_OK(status)) goto failed;
+ ndr_err = ndr_push_irpc_header(push, NDR_SCALARS|NDR_BUFFERS, &m->header);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
+ goto failed;
+ }
- status = m->irpc->table->calls[m->irpc->callnum].ndr_push(push, NDR_OUT, m->data);
- if (!NT_STATUS_IS_OK(status)) goto failed;
+ ndr_err = m->irpc->table->calls[m->irpc->callnum].ndr_push(push, NDR_OUT, m->data);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
+ goto failed;
+ }
/* send the reply message */
packet = ndr_push_blob(push);
{
struct irpc_list *i;
void *r;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
for (i=msg_ctx->irpc; i; i=i->next) {
if (GUID_equal(&i->uuid, &m->header.uuid) &&
if (r == NULL) goto failed;
/* parse the request data */
- status = i->table->calls[i->callnum].ndr_pull(m->ndr, NDR_IN, r);
- if (!NT_STATUS_IS_OK(status)) goto failed;
+ ndr_err = i->table->calls[i->callnum].ndr_pull(m->ndr, NDR_IN, r);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) goto failed;
/* make the call */
m->private = i->private;
uint32_t msg_type, struct server_id src, DATA_BLOB *packet)
{
struct irpc_message *m;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
m = talloc(msg_ctx, struct irpc_message);
if (m == NULL) goto failed;
m->ndr->flags |= LIBNDR_FLAG_REF_ALLOC;
- status = ndr_pull_irpc_header(m->ndr, NDR_BUFFERS|NDR_SCALARS, &m->header);
- if (!NT_STATUS_IS_OK(status)) goto failed;
+ ndr_err = ndr_pull_irpc_header(m->ndr, NDR_BUFFERS|NDR_SCALARS, &m->header);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) goto failed;
if (m->header.flags & IRPC_FLAG_REPLY) {
irpc_handler_reply(msg_ctx, m);
NTSTATUS status;
DATA_BLOB packet;
struct irpc_request *irpc;
+ enum ndr_err_code ndr_err;
irpc = talloc(msg_ctx, struct irpc_request);
if (irpc == NULL) goto failed;
ndr = ndr_push_init_ctx(irpc);
if (ndr == NULL) goto failed;
- status = ndr_push_irpc_header(ndr, NDR_SCALARS|NDR_BUFFERS, &header);
- if (!NT_STATUS_IS_OK(status)) goto failed;
+ ndr_err = ndr_push_irpc_header(ndr, NDR_SCALARS|NDR_BUFFERS, &header);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) goto failed;
- status = table->calls[callnum].ndr_push(ndr, NDR_IN, r);
- if (!NT_STATUS_IS_OK(status)) goto failed;
+ ndr_err = table->calls[callnum].ndr_push(ndr, NDR_IN, r);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) goto failed;
/* and send it */
packet = ndr_push_blob(ndr);
(tdr_pull_fn_t) tdr_pull_nk_block, &root);
/* Push the security descriptor to a blob */
- if (NT_STATUS_IS_ERR(ndr_push_struct_blob(&data, regf, sec_desc,
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_struct_blob(&data, regf, sec_desc,
(ndr_push_flags_fn_t)ndr_push_security_descriptor))) {
DEBUG(0, ("Unable to push security descriptor\n"));
return WERR_GENERAL_FAILURE;
data.data = sk.sec_desc;
data.length = sk.rec_size;
- if (NT_STATUS_IS_ERR(ndr_pull_struct_blob(&data, ctx, *sd,
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_struct_blob(&data, ctx, *sd,
(ndr_pull_flags_fn_t)ndr_pull_security_descriptor))) {
DEBUG(0, ("Error parsing security descriptor\n"));
return WERR_GENERAL_FAILURE;
struct cldap_netlogon *io)
{
NTSTATUS status;
+ enum ndr_err_code ndr_err;
struct cldap_search search;
DATA_BLOB *data;
}
data = search.out.response->attributes[0].values;
- status = ndr_pull_union_blob_all(data, mem_ctx, &io->out.netlogon,
- io->in.version & 0xF,
- (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_union_blob_all(data, mem_ctx, &io->out.netlogon,
+ io->in.version & 0xF,
+ (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
DEBUG(2,("cldap failed to parse netlogon response of type 0x%02x\n",
SVAL(data->data, 0)));
dump_data(10, data->data, data->length);
+ return ndr_map_error2ntstatus(ndr_err);
}
return NT_STATUS_OK;
union nbt_cldap_netlogon *netlogon)
{
NTSTATUS status;
+ enum ndr_err_code ndr_err;
struct cldap_reply reply;
struct ldap_SearchResEntry response;
struct ldap_Result result;
TALLOC_CTX *tmp_ctx = talloc_new(cldap);
DATA_BLOB blob;
- status = ndr_push_union_blob(&blob, tmp_ctx, netlogon, version & 0xF,
+ ndr_err = ndr_push_union_blob(&blob, tmp_ctx, netlogon, version & 0xF,
(ndr_push_flags_fn_t)ndr_push_nbt_cldap_netlogon);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(tmp_ctx);
- return status;
+ return ndr_map_error2ntstatus(ndr_err);
}
reply.messageid = message_id;
struct nbt_browse_packet *request)
{
NTSTATUS status;
+ enum ndr_err_code ndr_err;
DATA_BLOB blob;
TALLOC_CTX *tmp_ctx = talloc_new(dgmsock);
- status = ndr_push_struct_blob(&blob, tmp_ctx, request,
+ ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, request,
(ndr_push_flags_fn_t)ndr_push_nbt_browse_packet);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(tmp_ctx);
- return status;
+ return ndr_map_error2ntstatus(ndr_err);
}
status = dgram_mailslot_send(dgmsock, DGRAM_DIRECT_UNIQUE,
struct nbt_browse_packet *reply)
{
NTSTATUS status;
+ enum ndr_err_code ndr_err;
DATA_BLOB blob;
TALLOC_CTX *tmp_ctx = talloc_new(dgmsock);
struct nbt_name myname;
struct socket_address *dest;
- status = ndr_push_struct_blob(&blob, tmp_ctx, reply,
+ ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, reply,
(ndr_push_flags_fn_t)ndr_push_nbt_browse_packet);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(tmp_ctx);
- return status;
+ return ndr_map_error2ntstatus(ndr_err);
}
make_nbt_name_client(&myname, lp_netbios_name(global_loadparm));
struct nbt_browse_packet *pkt)
{
DATA_BLOB data = dgram_mailslot_data(dgram);
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
- status = ndr_pull_struct_blob(&data, mem_ctx, pkt,
+ ndr_err = ndr_pull_struct_blob(&data, mem_ctx, pkt,
(ndr_pull_flags_fn_t)ndr_pull_nbt_browse_packet);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("Failed to parse browse packet of length %d\n",
- (int)data.length));
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
+ DEBUG(0,("Failed to parse browse packet of length %d: %s\n",
+ (int)data.length, nt_errstr(status)));
if (DEBUGLVL(10)) {
file_save("browse.dat", data.data, data.length);
}
size_t nread, dsize;
struct nbt_dgram_packet *packet;
const char *mailslot_name;
+ enum ndr_err_code ndr_err;
status = socket_pending(dgmsock->sock, &dsize);
if (!NT_STATUS_IS_OK(status)) {
}
/* parse the request */
- status = ndr_pull_struct_blob(&blob, packet, packet,
+ ndr_err = ndr_pull_struct_blob(&blob, packet, packet,
(ndr_pull_flags_fn_t)ndr_pull_nbt_dgram_packet);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
DEBUG(2,("Failed to parse incoming NBT DGRAM packet - %s\n",
nt_errstr(status)));
talloc_free(tmp_ctx);
{
struct nbt_dgram_request *req;
NTSTATUS status = NT_STATUS_NO_MEMORY;
+ enum ndr_err_code ndr_err;
req = talloc(dgmsock, struct nbt_dgram_request);
if (req == NULL) goto failed;
req->dest = dest;
if (talloc_reference(req, dest) == NULL) goto failed;
- status = ndr_push_struct_blob(&req->encoded, req, packet,
+ ndr_err = ndr_push_struct_blob(&req->encoded, req, packet,
(ndr_push_flags_fn_t)ndr_push_nbt_dgram_packet);
- if (!NT_STATUS_IS_OK(status)) goto failed;
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
+ goto failed;
+ }
DLIST_ADD_END(dgmsock->send_queue, req, struct nbt_dgram_request *);
struct nbt_netlogon_packet *request)
{
NTSTATUS status;
+ enum ndr_err_code ndr_err;
DATA_BLOB blob;
TALLOC_CTX *tmp_ctx = talloc_new(dgmsock);
- status = ndr_push_struct_blob(&blob, tmp_ctx, request,
+ ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, request,
(ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(tmp_ctx);
- return status;
+ return ndr_map_error2ntstatus(ndr_err);
}
struct nbt_netlogon_packet *reply)
{
NTSTATUS status;
+ enum ndr_err_code ndr_err;
DATA_BLOB blob;
TALLOC_CTX *tmp_ctx = talloc_new(dgmsock);
struct nbt_name myname;
struct socket_address *dest;
- status = ndr_push_struct_blob(&blob, tmp_ctx, reply,
+ ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, reply,
(ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(tmp_ctx);
- return status;
+ return ndr_map_error2ntstatus(ndr_err);
}
make_nbt_name_client(&myname, lp_netbios_name(global_loadparm));
struct nbt_netlogon_packet *netlogon)
{
DATA_BLOB data = dgram_mailslot_data(dgram);
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
- status = ndr_pull_struct_blob(&data, mem_ctx, netlogon,
+ ndr_err = ndr_pull_struct_blob(&data, mem_ctx, netlogon,
(ndr_pull_flags_fn_t)ndr_pull_nbt_netlogon_packet);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("Failed to parse netlogon packet of length %d\n",
- (int)data.length));
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
+ DEBUG(0,("Failed to parse netlogon packet of length %d: %s\n",
+ (int)data.length, nt_errstr(status)));
if (DEBUGLVL(10)) {
file_save("netlogon.dat", data.data, data.length);
}
struct nbt_ntlogon_packet *request)
{
NTSTATUS status;
+ enum ndr_err_code ndr_err;
DATA_BLOB blob;
TALLOC_CTX *tmp_ctx = talloc_new(dgmsock);
- status = ndr_push_struct_blob(&blob, tmp_ctx, request,
+ ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, request,
(ndr_push_flags_fn_t)ndr_push_nbt_ntlogon_packet);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(tmp_ctx);
- return status;
+ return ndr_map_error2ntstatus(ndr_err);
}
struct nbt_ntlogon_packet *reply)
{
NTSTATUS status;
+ enum ndr_err_code ndr_err;
DATA_BLOB blob;
TALLOC_CTX *tmp_ctx = talloc_new(dgmsock);
struct nbt_name myname;
struct socket_address *dest;
- status = ndr_push_struct_blob(&blob, tmp_ctx, reply,
+ ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, reply,
(ndr_push_flags_fn_t)ndr_push_nbt_ntlogon_packet);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(tmp_ctx);
- return status;
+ return ndr_map_error2ntstatus(ndr_err);
}
make_nbt_name_client(&myname, lp_netbios_name(global_loadparm));
struct nbt_ntlogon_packet *ntlogon)
{
DATA_BLOB data = dgram_mailslot_data(dgram);
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
- status = ndr_pull_struct_blob(&data, mem_ctx, ntlogon,
+ ndr_err = ndr_pull_struct_blob(&data, mem_ctx, ntlogon,
(ndr_pull_flags_fn_t)ndr_pull_nbt_ntlogon_packet);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("Failed to parse ntlogon packet of length %d\n",
- (int)data.length));
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
+ DEBUG(0,("Failed to parse ntlogon packet of length %d: %s\n",
+ (int)data.length, nt_errstr(status)));
if (DEBUGLVL(10)) {
file_save("ntlogon.dat", data.data, data.length);
}
char *ldap_encode_ndr_dom_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid)
{
DATA_BLOB blob;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
char *ret;
- status = ndr_push_struct_blob(&blob, mem_ctx, sid,
- (ndr_push_flags_fn_t)ndr_push_dom_sid);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(&blob, mem_ctx, sid,
+ (ndr_push_flags_fn_t)ndr_push_dom_sid);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return NULL;
}
ret = ldb_binary_encode(mem_ctx, blob);
char *ldap_encode_ndr_GUID(TALLOC_CTX *mem_ctx, struct GUID *guid)
{
DATA_BLOB blob;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
char *ret;
- status = ndr_push_struct_blob(&blob, mem_ctx, guid,
- (ndr_push_flags_fn_t)ndr_push_GUID);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(&blob, mem_ctx, guid,
+ (ndr_push_flags_fn_t)ndr_push_GUID);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return NULL;
}
ret = ldb_binary_encode(mem_ctx, blob);
NTSTATUS ldap_decode_ndr_GUID(TALLOC_CTX *mem_ctx, struct ldb_val val, struct GUID *guid)
{
DATA_BLOB blob;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
blob.data = val.data;
blob.length = val.length;
- status = ndr_pull_struct_blob(&blob, mem_ctx, guid,
- (ndr_pull_flags_fn_t)ndr_pull_GUID);
+ ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, guid,
+ (ndr_pull_flags_fn_t)ndr_pull_GUID);
talloc_free(val.data);
- return status;
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+ return NT_STATUS_OK;
}
/*
pull one component of a nbt_string
*/
-static NTSTATUS ndr_pull_component(struct ndr_pull *ndr, uint8_t **component,
- uint32_t *offset, uint32_t *max_offset)
+static enum ndr_err_code ndr_pull_component(struct ndr_pull *ndr,
+ uint8_t **component,
+ uint32_t *offset,
+ uint32_t *max_offset)
{
uint8_t len;
uint_t loops = 0;
*offset += 1;
*max_offset = MAX(*max_offset, *offset);
*component = NULL;
- return NT_STATUS_OK;
+ return NDR_ERR_SUCCESS;
}
if ((len & 0xC0) == 0xC0) {
/* its a label pointer */
"BAD NBT NAME component");
}
*component = (uint8_t*)talloc_strndup(ndr, (const char *)&ndr->data[1 + *offset], len);
- NT_STATUS_HAVE_NO_MEMORY(*component);
+ NDR_ERR_HAVE_NO_MEMORY(*component);
*offset += len + 1;
*max_offset = MAX(*max_offset, *offset);
- return NT_STATUS_OK;
+ return NDR_ERR_SUCCESS;
}
/* too many pointers */
/**
pull a nbt_string from the wire
*/
-_PUBLIC_ NTSTATUS ndr_pull_nbt_string(struct ndr_pull *ndr, int ndr_flags, const char **s)
+_PUBLIC_ enum ndr_err_code ndr_pull_nbt_string(struct ndr_pull *ndr, int ndr_flags, const char **s)
{
uint32_t offset = ndr->offset;
uint32_t max_offset = offset;
char *name;
if (!(ndr_flags & NDR_SCALARS)) {
- return NT_STATUS_OK;
+ return NDR_ERR_SUCCESS;
}
name = NULL;
if (component == NULL) break;
if (name) {
name = talloc_asprintf_append_buffer(name, ".%s", component);
- NT_STATUS_HAVE_NO_MEMORY(name);
+ NDR_ERR_HAVE_NO_MEMORY(name);
} else {
name = (char *)component;
}
}
if (num_components == 0) {
name = talloc_strdup(ndr, "");
- NT_STATUS_HAVE_NO_MEMORY(name);
+ NDR_ERR_HAVE_NO_MEMORY(name);
}
(*s) = name;
ndr->offset = max_offset;
- return NT_STATUS_OK;
+ return NDR_ERR_SUCCESS;
}
/**
push a nbt string to the wire
*/
-_PUBLIC_ NTSTATUS ndr_push_nbt_string(struct ndr_push *ndr, int ndr_flags, const char *s)
+_PUBLIC_ enum ndr_err_code ndr_push_nbt_string(struct ndr_push *ndr, int ndr_flags, const char *s)
{
if (!(ndr_flags & NDR_SCALARS)) {
- return NT_STATUS_OK;
+ return NDR_ERR_SUCCESS;
}
while (s && *s) {
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
char *compname;
size_t complen;
uint32_t offset;
/* see if we have pushed the remaing string allready,
* if so we use a label pointer to this string
*/
- status = ndr_token_retrieve_cmp_fn(&ndr->nbt_string_list, s, &offset, (comparison_fn_t)strcmp, false);
- if (NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_token_retrieve_cmp_fn(&ndr->nbt_string_list, s, &offset, (comparison_fn_t)strcmp, false);
+ if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
uint8_t b[2];
if (offset > 0x3FFF) {
(unsigned char)complen,
(unsigned char)complen,
(unsigned char)complen, s);
- NT_STATUS_HAVE_NO_MEMORY(compname);
+ NDR_ERR_HAVE_NO_MEMORY(compname);
/* remember the current componemt + the rest of the string
* so it can be reused later
/**
pull a nbt name from the wire
*/
-_PUBLIC_ NTSTATUS ndr_pull_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name *r)
{
uint8_t *scope;
char *cname;
bool ok;
if (!(ndr_flags & NDR_SCALARS)) {
- return NT_STATUS_OK;
+ return NDR_ERR_SUCCESS;
}
NDR_CHECK(ndr_pull_nbt_string(ndr, ndr_flags, &s));
if (scope) {
*scope = 0;
r->scope = talloc_strdup(ndr->current_mem_ctx, (const char *)&scope[1]);
- NT_STATUS_HAVE_NO_MEMORY(r->scope);
+ NDR_ERR_HAVE_NO_MEMORY(r->scope);
} else {
r->scope = NULL;
}
}
r->name = talloc_strdup(ndr->current_mem_ctx, cname);
- NT_STATUS_HAVE_NO_MEMORY(r->name);
+ NDR_ERR_HAVE_NO_MEMORY(r->name);
talloc_free(cname);
- return NT_STATUS_OK;
+ return NDR_ERR_SUCCESS;
}
/**
push a nbt name to the wire
*/
-_PUBLIC_ NTSTATUS ndr_push_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r)
+_PUBLIC_ enum ndr_err_code ndr_push_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r)
{
uint8_t *cname, *fullname;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
if (!(ndr_flags & NDR_SCALARS)) {
- return NT_STATUS_OK;
+ return NDR_ERR_SUCCESS;
}
if (strlen(r->name) > 15) {
}
cname = compress_name(ndr, (const uint8_t *)r->name, r->type);
- NT_STATUS_HAVE_NO_MEMORY(cname);
+ NDR_ERR_HAVE_NO_MEMORY(cname);
if (r->scope) {
fullname = (uint8_t *)talloc_asprintf(ndr, "%s.%s", cname, r->scope);
- NT_STATUS_HAVE_NO_MEMORY(fullname);
+ NDR_ERR_HAVE_NO_MEMORY(fullname);
talloc_free(cname);
} else {
fullname = cname;
}
- status = ndr_push_nbt_string(ndr, ndr_flags, (const char *)fullname);
+ ndr_err = ndr_push_nbt_string(ndr, ndr_flags, (const char *)fullname);
- return status;
+ return ndr_err;
}
*/
_PUBLIC_ NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct nbt_name *name)
{
- return ndr_push_struct_blob(blob, mem_ctx, name,
- (ndr_push_flags_fn_t)ndr_push_nbt_name);
-}
+ enum ndr_err_code ndr_err;
+ ndr_err = ndr_push_struct_blob(blob, mem_ctx, name,
+ (ndr_push_flags_fn_t)ndr_push_nbt_name);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+
+ return NT_STATUS_OK;
+}
/**
pull a nbt name from a blob
*/
_PUBLIC_ NTSTATUS nbt_name_from_blob(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, struct nbt_name *name)
{
- return ndr_pull_struct_blob(blob, mem_ctx, name,
- (ndr_pull_flags_fn_t)ndr_pull_nbt_name);
+ enum ndr_err_code ndr_err;
+
+ ndr_err = ndr_pull_struct_blob(blob, mem_ctx, name,
+ (ndr_pull_flags_fn_t)ndr_pull_nbt_name);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+
+ return NT_STATUS_OK;
}
/**
pull a nbt name, WINS Replication uses another on wire format for nbt name
*/
-_PUBLIC_ NTSTATUS ndr_pull_wrepl_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name **_r)
+_PUBLIC_ enum ndr_err_code ndr_pull_wrepl_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name **_r)
{
struct nbt_name *r;
uint8_t *namebuf;
uint32_t namebuf_len;
if (!(ndr_flags & NDR_SCALARS)) {
- return NT_STATUS_OK;
+ return NDR_ERR_SUCCESS;
}
NDR_CHECK(ndr_pull_align(ndr, 4));
talloc_free(namebuf);
*_r = r;
- return NT_STATUS_OK;
+ return NDR_ERR_SUCCESS;
}
r->type = namebuf[15];
talloc_free(namebuf);
*_r = r;
- return NT_STATUS_OK;
+ return NDR_ERR_SUCCESS;
}
/**
push a nbt name, WINS Replication uses another on wire format for nbt name
*/
-_PUBLIC_ NTSTATUS ndr_push_wrepl_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r)
+_PUBLIC_ enum ndr_err_code ndr_push_wrepl_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r)
{
uint8_t *namebuf;
uint32_t namebuf_len;
}
if (!(ndr_flags & NDR_SCALARS)) {
- return NT_STATUS_OK;
+ return NDR_ERR_SUCCESS;
}
name_len = strlen(r->name);
NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, namebuf, namebuf_len));
talloc_free(namebuf);
- return NT_STATUS_OK;
+ return NDR_ERR_SUCCESS;
}
_PUBLIC_ void ndr_print_wrepl_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name *r)
{
TALLOC_CTX *tmp_ctx = talloc_new(nbtsock);
NTSTATUS status;
+ enum ndr_err_code ndr_err;
struct socket_address *src;
DATA_BLOB blob;
size_t nread, dsize;
}
/* parse the request */
- status = ndr_pull_struct_blob(&blob, packet, packet,
- (ndr_pull_flags_fn_t)ndr_pull_nbt_name_packet);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob(&blob, packet, packet,
+ (ndr_pull_flags_fn_t)ndr_pull_nbt_name_packet);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
DEBUG(2,("Failed to parse incoming NBT name packet - %s\n",
nt_errstr(status)));
talloc_free(tmp_ctx);
{
struct nbt_name_request *req;
int id;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
req = talloc_zero(nbtsock, struct nbt_name_request);
if (req == NULL) goto failed;
talloc_set_destructor(req, nbt_name_request_destructor);
- status = ndr_push_struct_blob(&req->encoded, req, request,
- (ndr_push_flags_fn_t)ndr_push_nbt_name_packet);
- if (!NT_STATUS_IS_OK(status)) goto failed;
+ ndr_err = ndr_push_struct_blob(&req->encoded, req, request,
+ (ndr_push_flags_fn_t)ndr_push_nbt_name_packet);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) goto failed;
DLIST_ADD_END(nbtsock->send_queue, req, struct nbt_name_request *);
struct nbt_name_packet *request)
{
struct nbt_name_request *req;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
req = talloc_zero(nbtsock, struct nbt_name_request);
NT_STATUS_HAVE_NO_MEMORY(req);
NDR_PRINT_DEBUG(nbt_name_packet, request);
}
- status = ndr_push_struct_blob(&req->encoded, req, request,
- (ndr_push_flags_fn_t)ndr_push_nbt_name_packet);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(&req->encoded, req, request,
+ (ndr_push_flags_fn_t)ndr_push_nbt_name_packet);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(req);
- return status;
+ return ndr_map_error2ntstatus(ndr_err);
}
DLIST_ADD_END(nbtsock->send_queue, req, struct nbt_name_request *);
NTSTATUS status;
struct smb_nttrans nt;
struct ndr_pull *ndr;
+ enum ndr_err_code ndr_err;
status = smb_raw_nttrans_recv(req, mem_ctx, &nt);
if (!NT_STATUS_IS_OK(status)) {
if (!io->query_secdesc.out.sd) {
return NT_STATUS_NO_MEMORY;
}
- status = ndr_pull_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS,
- io->query_secdesc.out.sd);
+ ndr_err = ndr_pull_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS,
+ io->query_secdesc.out.sd);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
- return status;
+ return NT_STATUS_OK;
}
uint8_t params[8];
struct ndr_push *ndr;
struct smbcli_request *req;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
nt.in.max_setup = 0;
nt.in.max_param = 0;
ndr = ndr_push_init_ctx(NULL);
if (!ndr) return NULL;
- status = ndr_push_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, io->set_secdesc.in.sd);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, io->set_secdesc.in.sd);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(ndr);
return NULL;
}
uint16_t fname_len;
DATA_BLOB sd_blob, ea_blob;
struct smbcli_request *req;
- NTSTATUS status;
nt.in.max_setup = 0;
nt.in.max_param = 101;
ea_blob = data_blob(NULL, 0);
if (parms->ntcreatex.in.sec_desc) {
- status = ndr_push_struct_blob(&sd_blob, mem_ctx,
- parms->ntcreatex.in.sec_desc,
- (ndr_push_flags_fn_t)ndr_push_security_descriptor);
- if (!NT_STATUS_IS_OK(status)) {
+ enum ndr_err_code ndr_err;
+ ndr_err = ndr_push_struct_blob(&sd_blob, mem_ctx,
+ parms->ntcreatex.in.sec_desc,
+ (ndr_push_flags_fn_t)ndr_push_security_descriptor);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(mem_ctx);
return NULL;
}
return NT_STATUS_OK;
case RAW_FILEINFO_SEC_DESC: {
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
parms->query_secdesc.out.sd = talloc(mem_ctx, struct security_descriptor);
NT_STATUS_HAVE_NO_MEMORY(parms->query_secdesc.out.sd);
- status = ndr_pull_struct_blob(blob, mem_ctx,
- parms->query_secdesc.out.sd,
- (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
- NT_STATUS_NOT_OK_RETURN(status);
+ ndr_err = ndr_pull_struct_blob(blob, mem_ctx,
+ parms->query_secdesc.out.sd,
+ (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
return NT_STATUS_OK;
}
union smb_fsinfo *fsinfo)
{
NTSTATUS status = NT_STATUS_OK;
+ enum ndr_err_code ndr_err;
int i;
/* parse the results */
case RAW_QFS_OBJECTID_INFORMATION:
QFS_CHECK_SIZE(64);
- status = ndr_pull_struct_blob(&blob, mem_ctx, &fsinfo->objectid_information.out.guid,
- (ndr_pull_flags_fn_t)ndr_pull_GUID);
+ ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &fsinfo->objectid_information.out.guid,
+ (ndr_pull_flags_fn_t)ndr_pull_GUID);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
+ }
for (i=0;i<6;i++) {
fsinfo->objectid_information.out.unknown[i] = BVAL(blob.data, 16 + i*8);
}
return true;
case RAW_FILEINFO_SEC_DESC: {
- NTSTATUS status;
-
- status = ndr_push_struct_blob(blob, mem_ctx,
- parms->set_secdesc.in.sd,
- (ndr_push_flags_fn_t)ndr_push_security_descriptor);
- if (!NT_STATUS_IS_OK(status)) return false;
+ enum ndr_err_code ndr_err;
+
+ ndr_err = ndr_push_struct_blob(blob, mem_ctx,
+ parms->set_secdesc.in.sd,
+ (ndr_push_flags_fn_t)ndr_push_security_descriptor);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return false;
+ }
return true;
}
struct wrepl_socket *wrepl_socket = talloc_get_type(private, struct wrepl_socket);
struct wrepl_request *req = wrepl_socket->recv_queue;
DATA_BLOB blob;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
if (!req) {
DEBUG(1,("Received unexpected WINS packet of length %u!\n",
blob.length = packet_blob_in.length - 4;
/* we have a full request - parse it */
- status = ndr_pull_struct_blob(&blob,
- req->packet, req->packet,
- (ndr_pull_flags_fn_t)ndr_pull_wrepl_packet);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob(&blob,
+ req->packet, req->packet,
+ (ndr_pull_flags_fn_t)ndr_pull_wrepl_packet);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
wrepl_request_finished(req, status);
return NT_STATUS_OK;
}
struct wrepl_wrap wrap;
DATA_BLOB blob;
NTSTATUS status;
+ enum ndr_err_code ndr_err;
req = talloc_zero(wrepl_socket, struct wrepl_request);
if (!req) return NULL;
}
wrap.packet = *packet;
- status = ndr_push_struct_blob(&blob, req, &wrap,
- (ndr_push_flags_fn_t)ndr_push_wrepl_wrap);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(&blob, req, &wrap,
+ (ndr_push_flags_fn_t)ndr_push_wrepl_wrap);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
return wrepl_request_finished(req, status);
}
struct drsuapi_DsReplicaObjectIdentifier *identifier;
uint32_t num_attrs, i = 0;
struct drsuapi_DsReplicaAttribute *attrs;
+ enum ndr_err_code ndr_err;
bool w2k3;
/* choose a random invocationId */
NULL);
if (composite_nomem(v, c)) return;
- c->status = ndr_push_struct_blob(&vd[0], vd, v,(ndr_push_flags_fn_t)ndr_push_security_descriptor);
- if (!composite_is_ok(c)) return;
+ ndr_err = ndr_push_struct_blob(&vd[0], vd, v,(ndr_push_flags_fn_t)ndr_push_security_descriptor);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ c->status = ndr_map_error2ntstatus(ndr_err);
+ if (!composite_is_ok(c)) return;
+ }
vs[0].blob = &vd[0];
s->forest.schema_dn_str);
if (composite_nomem(v[0].dn, c)) return;
- c->status = ndr_push_struct_blob(&vd[0], vd, &v[0],
- (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
- if (!composite_is_ok(c)) return;
+ ndr_err = ndr_push_struct_blob(&vd[0], vd, &v[0],
+ (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ c->status = ndr_map_error2ntstatus(ndr_err);
+ if (!composite_is_ok(c)) return;
+ }
vs[0].blob = &vd[0];
v = &s->dest_dsa.invocation_id;
- c->status = ndr_push_struct_blob(&vd[0], vd, v, (ndr_push_flags_fn_t)ndr_push_GUID);
- if (!composite_is_ok(c)) return;
+ ndr_err = ndr_push_struct_blob(&vd[0], vd, v, (ndr_push_flags_fn_t)ndr_push_GUID);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ c->status = ndr_map_error2ntstatus(ndr_err);
+ if (!composite_is_ok(c)) return;
+ }
vs[0].blob = &vd[0];
v[2].sid = s->zero_sid;
v[2].dn = s->forest.schema_dn_str;
- c->status = ndr_push_struct_blob(&vd[0], vd, &v[0],
- (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
- if (!composite_is_ok(c)) return;
+ ndr_err = ndr_push_struct_blob(&vd[0], vd, &v[0],
+ (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ c->status = ndr_map_error2ntstatus(ndr_err);
+ if (!composite_is_ok(c)) return;
+ }
- c->status = ndr_push_struct_blob(&vd[1], vd, &v[1],
- (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
- if (!composite_is_ok(c)) return;
+ ndr_err = ndr_push_struct_blob(&vd[1], vd, &v[1],
+ (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ c->status = ndr_map_error2ntstatus(ndr_err);
+ if (!composite_is_ok(c)) return;
+ }
- c->status = ndr_push_struct_blob(&vd[2], vd, &v[2],
- (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
- if (!composite_is_ok(c)) return;
+ ndr_err = ndr_push_struct_blob(&vd[2], vd, &v[2],
+ (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ c->status = ndr_map_error2ntstatus(ndr_err);
+ if (!composite_is_ok(c)) return;
+ }
vs[0].blob = &vd[0];
vs[1].blob = &vd[1];
v[2].sid = s->zero_sid;
v[2].dn = s->forest.schema_dn_str;
- c->status = ndr_push_struct_blob(&vd[0], vd, &v[0],
- (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
- if (!composite_is_ok(c)) return;
+ ndr_err = ndr_push_struct_blob(&vd[0], vd, &v[0],
+ (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ c->status = ndr_map_error2ntstatus(ndr_err);
+ if (!composite_is_ok(c)) return;
+ }
- c->status = ndr_push_struct_blob(&vd[1], vd, &v[1],
- (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
- if (!composite_is_ok(c)) return;
+ ndr_err = ndr_push_struct_blob(&vd[1], vd, &v[1],
+ (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ c->status = ndr_map_error2ntstatus(ndr_err);
+ if (!composite_is_ok(c)) return;
+ }
- c->status = ndr_push_struct_blob(&vd[2], vd, &v[2],
- (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
- if (!composite_is_ok(c)) return;
+ ndr_err = ndr_push_struct_blob(&vd[2], vd, &v[2],
+ (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ c->status = ndr_map_error2ntstatus(ndr_err);
+ if (!composite_is_ok(c)) return;
+ }
vs[0].blob = &vd[0];
vs[1].blob = &vd[1];
v[0].sid = s->zero_sid;
v[0].dn = s->forest.schema_dn_str;
- c->status = ndr_push_struct_blob(&vd[0], vd, &v[0],
- (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
- if (!composite_is_ok(c)) return;
+ ndr_err = ndr_push_struct_blob(&vd[0], vd, &v[0],
+ (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ c->status = ndr_map_error2ntstatus(ndr_err);
+ if (!composite_is_ok(c)) return;
+ }
vs[0].blob = &vd[0];
v[0].sid = s->zero_sid;
v[0].dn = s->domain.dn_str;
- c->status = ndr_push_struct_blob(&vd[0], vd, &v[0],
- (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
- if (!composite_is_ok(c)) return;
+ ndr_err = ndr_push_struct_blob(&vd[0], vd, &v[0],
+ (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ c->status = ndr_map_error2ntstatus(ndr_err);
+ if (!composite_is_ok(c)) return;
+ }
vs[0].blob = &vd[0];
v[0].sid = s->zero_sid;
v[0].dn = s->dest_dsa.computer_dn_str;
- c->status = ndr_push_struct_blob(&vd[0], vd, &v[0],
- (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
- if (!composite_is_ok(c)) return;
+ ndr_err = ndr_push_struct_blob(&vd[0], vd, &v[0],
+ (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ c->status = ndr_map_error2ntstatus(ndr_err);
+ if (!composite_is_ok(c)) return;
+ }
vs[0].blob = &vd[0];
}
if (state->samsync_state->domain_guid) {
- NTSTATUS nt_status;
+ enum ndr_err_code ndr_err;
struct ldb_val v;
- nt_status = ndr_push_struct_blob(&v, msg, state->samsync_state->domain_guid,
+ ndr_err = ndr_push_struct_blob(&v, msg, state->samsync_state->domain_guid,
(ndr_push_flags_fn_t)ndr_push_GUID);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
*error_string = talloc_asprintf(mem_ctx, "ndr_push of domain GUID failed!");
- return nt_status;
+ return ndr_map_error2ntstatus(ndr_err);
}
ldb_msg_add_value(msg, "objectGUID", &v, NULL);
struct samr_Password lm_hash;
struct samr_Password nt_hash;
const char *username = user->account_name.string;
- NTSTATUS nt_status;
if (rid_crypt) {
if (user->lm_password_present) {
if (user->user_private_info.SensitiveData) {
DATA_BLOB data;
struct netr_USER_KEYS keys;
+ enum ndr_err_code ndr_err;
data.data = user->user_private_info.SensitiveData;
data.length = user->user_private_info.DataLength;
creds_arcfour_crypt(creds, data.data, data.length);
user->user_private_info.SensitiveData = data.data;
user->user_private_info.DataLength = data.length;
- nt_status = ndr_pull_struct_blob(&data, mem_ctx, &keys, (ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS);
- if (!NT_STATUS_IS_OK(nt_status)) {
+ ndr_err = ndr_pull_struct_blob(&data, mem_ctx, &keys, (ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
*error_string = talloc_asprintf(mem_ctx, "Failed to parse Sensitive Data for %s:", username);
dump_data(10, data.data, data.length);
- return nt_status;
+ return ndr_map_error2ntstatus(ndr_err);
}
if (keys.keys.keys2.lmpassword.length == 16) {
struct ncacn_packet *pkt)
{
struct ndr_pull *ndr;
+ enum ndr_err_code ndr_err;
ndr = ndr_pull_init_flags(c, blob, mem_ctx);
if (!ndr) {
ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
}
- return ndr_pull_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt);
+ ndr_err = ndr_pull_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+
+ return NT_STATUS_OK;
}
/*
NTSTATUS status;
struct dcerpc_auth auth;
DATA_BLOB auth_blob;
+ enum ndr_err_code ndr_err;
if (pkt->auth_length == 0 &&
c->security_state.auth_info->auth_level == DCERPC_AUTH_LEVEL_CONNECT) {
ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
}
- status = ndr_pull_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, &auth);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
+ ndr_err = ndr_pull_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, &auth);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
}
-
+ status = NT_STATUS_OK;
+
/* check signature or unseal the packet */
switch (c->security_state.auth_info->auth_level) {
case DCERPC_AUTH_LEVEL_PRIVACY:
struct ndr_push *ndr;
DATA_BLOB creds2;
size_t payload_length;
+ enum ndr_err_code ndr_err;
/* non-signed packets are simpler */
if (!c->security_state.auth_info ||
ndr->flags |= LIBNDR_FLAG_OBJECT_PRESENT;
}
- status = ndr_push_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
+ ndr_err = ndr_push_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
}
+ status = NT_STATUS_OK;
/* pad to 16 byte multiple in the payload portion of the
packet. This matches what w2k3 does */
}
/* add the auth verifier */
- status = ndr_push_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, c->security_state.auth_info);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
+ ndr_err = ndr_push_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, c->security_state.auth_info);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
}
+ status = NT_STATUS_OK;
/* extract the whole packet as a blob */
*blob = ndr_push_blob(ndr);
/* the bind_ack might contain a reply set of credentials */
if (conn->security_state.auth_info &&
pkt->u.bind_ack.auth_info.length) {
- c->status = ndr_pull_struct_blob(
+ enum ndr_err_code ndr_err;
+ ndr_err = ndr_pull_struct_blob(
&pkt->u.bind_ack.auth_info, conn,
conn->security_state.auth_info,
(ndr_pull_flags_fn_t)ndr_pull_dcerpc_auth);
- if (!composite_is_ok(c)) return;
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ c->status = ndr_map_error2ntstatus(ndr_err);
+ if (!composite_is_ok(c)) return;
+ }
}
req->p->assoc_group_id = pkt->u.bind_ack.assoc_group_id;
void *st;
struct ndr_pull *pull;
struct ndr_push *push;
- NTSTATUS status;
DATA_BLOB blob2;
+ enum ndr_err_code ndr_err;
st = talloc_size(mem_ctx, struct_size);
if (!st) {
}
pull->flags |= LIBNDR_FLAG_REF_ALLOC;
- status = ndr_pull(pull, NDR_IN, st);
- if (!NT_STATUS_IS_OK(status)) {
- return ndr_pull_error(pull, NDR_ERR_VALIDATE,
- "failed input validation pull - %s",
- nt_errstr(status));
+ ndr_err = ndr_pull(pull, NDR_IN, st);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
+ ndr_err = ndr_pull_error(pull, NDR_ERR_VALIDATE,
+ "failed input validation pull - %s",
+ nt_errstr(status));
+ return ndr_map_error2ntstatus(ndr_err);
}
push = ndr_push_init_ctx(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
- status = ndr_push(push, NDR_IN, st);
- if (!NT_STATUS_IS_OK(status)) {
- return ndr_push_error(push, NDR_ERR_VALIDATE,
- "failed input validation push - %s",
- nt_errstr(status));
+ ndr_err = ndr_push(push, NDR_IN, st);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
+ ndr_err = ndr_pull_error(pull, NDR_ERR_VALIDATE,
+ "failed input validation push - %s",
+ nt_errstr(status));
+ return ndr_map_error2ntstatus(ndr_err);
}
blob2 = ndr_push_blob(push);
dump_data(3, blob.data, blob.length);
DEBUG(3,("secondary:\n"));
dump_data(3, blob2.data, blob2.length);
- return ndr_push_error(push, NDR_ERR_VALIDATE,
- "failed input validation data - %s",
- nt_errstr(status));
+ ndr_err = ndr_pull_error(pull, NDR_ERR_VALIDATE,
+ "failed input validation blobs doesn't match");
+ return ndr_map_error2ntstatus(ndr_err);
}
return NT_STATUS_OK;
void *st;
struct ndr_pull *pull;
struct ndr_push *push;
- NTSTATUS status;
DATA_BLOB blob, blob2;
TALLOC_CTX *mem_ctx = pull_in;
char *s1, *s2;
+ enum ndr_err_code ndr_err;
st = talloc_size(mem_ctx, struct_size);
if (!st) {
return NT_STATUS_NO_MEMORY;
}
- status = ndr_push(push, NDR_OUT, struct_ptr);
- if (!NT_STATUS_IS_OK(status)) {
- return ndr_push_error(push, NDR_ERR_VALIDATE,
- "failed output validation push - %s",
- nt_errstr(status));
+ ndr_err = ndr_push(push, NDR_OUT, struct_ptr);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
+ ndr_err = ndr_push_error(push, NDR_ERR_VALIDATE,
+ "failed output validation push - %s",
+ nt_errstr(status));
+ return ndr_map_error2ntstatus(ndr_err);
}
blob = ndr_push_blob(push);
}
pull->flags |= LIBNDR_FLAG_REF_ALLOC;
- status = ndr_pull(pull, NDR_OUT, st);
- if (!NT_STATUS_IS_OK(status)) {
- return ndr_pull_error(pull, NDR_ERR_VALIDATE,
- "failed output validation pull - %s",
- nt_errstr(status));
+ ndr_err = ndr_pull(pull, NDR_OUT, st);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
+ ndr_err = ndr_pull_error(pull, NDR_ERR_VALIDATE,
+ "failed output validation pull - %s",
+ nt_errstr(status));
+ return ndr_map_error2ntstatus(ndr_err);
}
push = ndr_push_init_ctx(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
- status = ndr_push(push, NDR_OUT, st);
- if (!NT_STATUS_IS_OK(status)) {
- return ndr_push_error(push, NDR_ERR_VALIDATE,
- "failed output validation push2 - %s",
- nt_errstr(status));
+ ndr_err = ndr_push(push, NDR_OUT, st);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
+ ndr_err = ndr_push_error(push, NDR_ERR_VALIDATE,
+ "failed output validation push2 - %s",
+ nt_errstr(status));
+ return ndr_map_error2ntstatus(ndr_err);
}
blob2 = ndr_push_blob(push);
dump_data(3, blob.data, blob.length);
DEBUG(3,("secondary:\n"));
dump_data(3, blob2.data, blob2.length);
- return ndr_push_error(push, NDR_ERR_VALIDATE,
- "failed output validation data - %s",
- nt_errstr(status));
+ ndr_err = ndr_push_error(push, NDR_ERR_VALIDATE,
+ "failed output validation blobs doesn't match");
+ return ndr_map_error2ntstatus(ndr_err);
}
/* this checks the printed forms of the two structures, which effectively
file_save("gen.dat", s2, strlen(s2));
system("diff -u wire.dat gen.dat");
#endif
- return ndr_push_error(push, NDR_ERR_VALIDATE,
- "failed output validation strings doesn't match");
+ ndr_err = ndr_push_error(push, NDR_ERR_VALIDATE,
+ "failed output validation strings doesn't match");
+ return ndr_map_error2ntstatus(ndr_err);
}
return NT_STATUS_OK;
NTSTATUS status;
DATA_BLOB request;
struct rpc_request *req;
+ enum ndr_err_code ndr_err;
call = &table->calls[opnum];
}
/* push the structure into a blob */
- status = call->ndr_push(push, NDR_IN, r);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = call->ndr_push(push, NDR_IN, r);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
DEBUG(2,("Unable to ndr_push structure in dcerpc_ndr_request_send - %s\n",
nt_errstr(status)));
talloc_free(push);
uint32_t opnum = req->ndr.opnum;
const struct ndr_interface_table *table = req->ndr.table;
const struct ndr_interface_call *call = &table->calls[opnum];
+ enum ndr_err_code ndr_err;
/* make sure the recv code doesn't free the request, as we
need to grab the flags element before it is freed */
dump_data(10, pull->data, pull->data_size);
/* pull the structure from the blob */
- status = call->ndr_pull(pull, NDR_OUT, r);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = call->ndr_pull(pull, NDR_OUT, r);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = ndr_map_error2ntstatus(ndr_err);
dcerpc_log_packet(table, opnum, NDR_OUT,
&response);
return status;
/* the alter_resp might contain a reply set of credentials */
if (recv_pipe->conn->security_state.auth_info &&
pkt->u.alter_resp.auth_info.length) {
- c->status = ndr_pull_struct_blob(
+ enum ndr_err_code ndr_err;
+ ndr_err = ndr_pull_struct_blob(
&pkt->u.alter_resp.auth_info, recv_pipe,
recv_pipe->conn->security_state.auth_info,
(ndr_pull_flags_fn_t)ndr_pull_dcerpc_auth);
- if (!composite_is_ok(c)) return;
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ c->status = ndr_map_error2ntstatus(ndr_err);
+ if (!composite_is_ok(c)) return;
+ }
}
composite_done(c);
struct ncacn_packet *pkt,
struct dcerpc_auth *auth_info)
{
- NTSTATUS status;
struct ndr_push *ndr;
+ enum ndr_err_code ndr_err;
ndr = ndr_push_init_ctx(mem_ctx);
if (!ndr) {
pkt->auth_length = 0;
}
- status = ndr_push_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
+ ndr_err = ndr_push_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
}
if (auth_info) {
- status = ndr_push_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, auth_info);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
+ ndr_err = ndr_push_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, auth_info);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
}
}
{
TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data");
struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx);
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
uint16_t if_version=0;
ndr->flags |= LIBNDR_FLAG_NOALIGN;
- status = ndr_pull_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(mem_ctx);
- return status;
+ return ndr_map_error2ntstatus(ndr_err);
}
- status = ndr_pull_uint16(ndr, NDR_SCALARS, &if_version);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_uint16(ndr, NDR_SCALARS, &if_version);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(mem_ctx);
- return status;
+ return ndr_map_error2ntstatus(ndr_err);
}
+
syntax->if_version = if_version;
talloc_free(mem_ctx);
return WERR_OK;
} else if (strcmp("OSVersion", r->in.value_name) == 0) {
DATA_BLOB blob;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
struct spoolss_OSVersion os;
os.major = dcesrv_common_get_version_major(mem_ctx, NULL);
os.build = dcesrv_common_get_version_build(mem_ctx, NULL);
os.extra_string = "";
- status = ndr_push_struct_blob(&blob, mem_ctx, &os, (ndr_push_flags_fn_t)ndr_push_spoolss_OSVersion);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(&blob, mem_ctx, &os, (ndr_push_flags_fn_t)ndr_push_spoolss_OSVersion);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return WERR_GENERAL_FAILURE;
}
return WERR_OK;
} else if (strcmp("OSVersionEx", r->in.value_name) == 0) {
DATA_BLOB blob;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
struct spoolss_OSVersionEx os_ex;
os_ex.major = dcesrv_common_get_version_major(mem_ctx, NULL);
os_ex.unknown2 = 0;
os_ex.unknown3 = 0;
- status = ndr_push_struct_blob(&blob, mem_ctx, &os_ex, (ndr_push_flags_fn_t)ndr_push_spoolss_OSVersionEx);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(&blob, mem_ctx, &os_ex, (ndr_push_flags_fn_t)ndr_push_spoolss_OSVersionEx);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return WERR_GENERAL_FAILURE;
}
{
TDB_DATA dbuf;
DATA_BLOB blob;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
int seqnum;
seqnum = tdb_get_seqnum(notify->w->tdb);
blob.data = dbuf.dptr;
blob.length = dbuf.dsize;
- status = ndr_pull_struct_blob(&blob, notify->array, notify->array,
- (ndr_pull_flags_fn_t)ndr_pull_notify_array);
+ ndr_err = ndr_pull_struct_blob(&blob, notify->array, notify->array,
+ (ndr_pull_flags_fn_t)ndr_pull_notify_array);
free(dbuf.dptr);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
- return status;
+ return NT_STATUS_OK;
}
/*
{
TDB_DATA dbuf;
DATA_BLOB blob;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
int ret;
TALLOC_CTX *tmp_ctx;
tmp_ctx = talloc_new(notify);
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
- status = ndr_push_struct_blob(&blob, tmp_ctx, notify->array,
- (ndr_push_flags_fn_t)ndr_push_notify_array);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, notify->array,
+ (ndr_push_flags_fn_t)ndr_push_notify_array);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(tmp_ctx);
- return status;
+ return ndr_map_error2ntstatus(ndr_err);
}
dbuf.dptr = blob.data;
uint32_t msg_type, struct server_id server_id, DATA_BLOB *data)
{
struct notify_context *notify = talloc_get_type(private_data, struct notify_context);
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
struct notify_event ev;
TALLOC_CTX *tmp_ctx = talloc_new(notify);
struct notify_list *listel;
return;
}
- status = ndr_pull_struct_blob(data, tmp_ctx, &ev,
+ ndr_err = ndr_pull_struct_blob(data, tmp_ctx, &ev,
(ndr_pull_flags_fn_t)ndr_pull_notify_event);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(tmp_ctx);
return;
}
struct notify_event ev;
DATA_BLOB data;
NTSTATUS status;
+ enum ndr_err_code ndr_err;
TALLOC_CTX *tmp_ctx;
ev.action = action;
tmp_ctx = talloc_new(notify);
- status = ndr_push_struct_blob(&data, tmp_ctx, &ev,
+ ndr_err = ndr_push_struct_blob(&data, tmp_ctx, &ev,
(ndr_push_flags_fn_t)ndr_push_notify_event);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(tmp_ctx);
return;
}
struct odb_context *odb = lck->odb;
TDB_DATA dbuf;
DATA_BLOB blob;
- NTSTATUS status;
-
+ enum ndr_err_code ndr_err;
+
dbuf = tdb_fetch(odb->w->tdb, lck->key);
if (dbuf.dptr == NULL) {
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
blob.data = dbuf.dptr;
blob.length = dbuf.dsize;
- status = ndr_pull_struct_blob(&blob, lck, file, (ndr_pull_flags_fn_t)ndr_pull_opendb_file);
-
+ ndr_err = ndr_pull_struct_blob(&blob, lck, file, (ndr_pull_flags_fn_t)ndr_pull_opendb_file);
free(dbuf.dptr);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
- return status;
+ return NT_STATUS_OK;
}
/*
struct odb_context *odb = lck->odb;
TDB_DATA dbuf;
DATA_BLOB blob;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
int ret;
if (file->num_entries == 0) {
return NT_STATUS_OK;
}
- status = ndr_push_struct_blob(&blob, lck, file, (ndr_push_flags_fn_t)ndr_push_opendb_file);
- NT_STATUS_NOT_OK_RETURN(status);
+ ndr_err = ndr_push_struct_blob(&blob, lck, file, (ndr_push_flags_fn_t)ndr_push_opendb_file);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
dbuf.dptr = blob.data;
dbuf.dsize = blob.length;
#include "ntvfs/ipc/proto.h"
#include "librpc/ndr/libndr.h"
+#define NDR_RETURN(call) do { \
+ enum ndr_err_code _ndr_err; \
+ _ndr_err = call; \
+ if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
+ return ndr_map_error2ntstatus(_ndr_err); \
+ } \
+} while (0)
+
+#define RAP_GOTO(call) do { \
+ result = call; \
+ if (NT_STATUS_EQUAL(result, NT_STATUS_BUFFER_TOO_SMALL)) {\
+ goto buffer_overflow; \
+ } \
+ if (!NT_STATUS_IS_OK(result)) { \
+ goto done; \
+ } \
+} while (0)
+
+#define NDR_GOTO(call) do { \
+ enum ndr_err_code _ndr_err; \
+ _ndr_err = call; \
+ if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
+ RAP_GOTO(ndr_map_error2ntstatus(_ndr_err)); \
+ } \
+} while (0)
+
+
#define NERR_Success 0
#define NERR_badpass 86
#define NERR_notsupported 50
static NTSTATUS rap_srv_pull_word(struct rap_call *call, uint16_t *result)
{
+ enum ndr_err_code ndr_err;
+
if (*call->paramdesc++ != 'W')
return NT_STATUS_INVALID_PARAMETER;
- return ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, result);
+ ndr_err = ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, result);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+
+ return NT_STATUS_OK;
}
static NTSTATUS rap_srv_pull_dword(struct rap_call *call, uint32_t *result)
{
+ enum ndr_err_code ndr_err;
+
if (*call->paramdesc++ != 'D')
return NT_STATUS_INVALID_PARAMETER;
- return ndr_pull_uint32(call->ndr_pull_param, NDR_SCALARS, result);
+ ndr_err = ndr_pull_uint32(call->ndr_pull_param, NDR_SCALARS, result);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+
+ return NT_STATUS_OK;
}
static NTSTATUS rap_srv_pull_string(struct rap_call *call, const char **result)
{
+ enum ndr_err_code ndr_err;
char paramdesc = *call->paramdesc++;
if (paramdesc == 'O') {
if (paramdesc != 'z')
return NT_STATUS_INVALID_PARAMETER;
- return ndr_pull_string(call->ndr_pull_param, NDR_SCALARS, result);
+ ndr_err = ndr_pull_string(call->ndr_pull_param, NDR_SCALARS, result);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
+
+ return NT_STATUS_OK;
}
static NTSTATUS rap_srv_pull_bufsize(struct rap_call *call, uint16_t *bufsize)
{
- NTSTATUS result;
+ enum ndr_err_code ndr_err;
if ( (*call->paramdesc++ != 'r') || (*call->paramdesc++ != 'L') )
return NT_STATUS_INVALID_PARAMETER;
- result = ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, bufsize);
-
- if (!NT_STATUS_IS_OK(result))
- return result;
+ ndr_err = ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, bufsize);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
call->heap->offset = *bufsize;
heap->offset -= space;
- NDR_CHECK(ndr_push_uint16(data_push, NDR_SCALARS, heap->offset));
- NDR_CHECK(ndr_push_uint16(data_push, NDR_SCALARS, 0));
+ NDR_RETURN(ndr_push_uint16(data_push, NDR_SCALARS, heap->offset));
+ NDR_RETURN(ndr_push_uint16(data_push, NDR_SCALARS, 0));
heap->strings = talloc_realloc(heap->mem_ctx,
heap->strings,
return NT_STATUS_OK;
}
-#define NDR_OK(call) do { result = call; \
- if (NT_STATUS_EQUAL(result, NT_STATUS_BUFFER_TOO_SMALL)) \
- goto buffer_overflow; \
- if (!NT_STATUS_IS_OK(result)) \
- goto done; \
- } while (0)
-
static NTSTATUS _rap_netshareenum(struct rap_call *call)
{
struct rap_NetShareEnum r;
NTSTATUS result;
- NDR_OK(rap_srv_pull_word(call, &r.in.level));
- NDR_OK(rap_srv_pull_bufsize(call, &r.in.bufsize));
- NDR_OK(rap_srv_pull_expect_multiple(call));
+ RAP_GOTO(rap_srv_pull_word(call, &r.in.level));
+ RAP_GOTO(rap_srv_pull_bufsize(call, &r.in.bufsize));
+ RAP_GOTO(rap_srv_pull_expect_multiple(call));
switch(r.in.level) {
case 0:
switch(r.in.level) {
case 0:
- NDR_OK(ndr_push_bytes(call->ndr_push_data,
+ NDR_GOTO(ndr_push_bytes(call->ndr_push_data,
(const uint8_t *)r.out.info[i].info0.name,
sizeof(r.out.info[i].info0.name)));
break;
case 1:
- NDR_OK(ndr_push_bytes(call->ndr_push_data,
+ NDR_GOTO(ndr_push_bytes(call->ndr_push_data,
(const uint8_t *)r.out.info[i].info1.name,
sizeof(r.out.info[i].info1.name)));
- NDR_OK(ndr_push_uint8(call->ndr_push_data,
+ NDR_GOTO(ndr_push_uint8(call->ndr_push_data,
NDR_SCALARS, r.out.info[i].info1.pad));
- NDR_OK(ndr_push_uint16(call->ndr_push_data,
+ NDR_GOTO(ndr_push_uint16(call->ndr_push_data,
NDR_SCALARS, r.out.info[i].info1.type));
- NDR_OK(rap_push_string(call->ndr_push_data,
+ RAP_GOTO(rap_push_string(call->ndr_push_data,
call->heap,
r.out.info[i].info1.comment));
call->status = r.out.status;
- NDR_CHECK(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.count));
- NDR_CHECK(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.available));
+ NDR_RETURN(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.count));
+ NDR_RETURN(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.available));
result = NT_STATUS_OK;
struct rap_NetServerEnum2 r;
NTSTATUS result;
- NDR_OK(rap_srv_pull_word(call, &r.in.level));
- NDR_OK(rap_srv_pull_bufsize(call, &r.in.bufsize));
- NDR_OK(rap_srv_pull_expect_multiple(call));
- NDR_OK(rap_srv_pull_dword(call, &r.in.servertype));
- NDR_OK(rap_srv_pull_string(call, &r.in.domain));
+ RAP_GOTO(rap_srv_pull_word(call, &r.in.level));
+ RAP_GOTO(rap_srv_pull_bufsize(call, &r.in.bufsize));
+ RAP_GOTO(rap_srv_pull_expect_multiple(call));
+ RAP_GOTO(rap_srv_pull_dword(call, &r.in.servertype));
+ RAP_GOTO(rap_srv_pull_string(call, &r.in.domain));
switch(r.in.level) {
case 0:
switch(r.in.level) {
case 0:
- NDR_OK(ndr_push_bytes(call->ndr_push_data,
+ NDR_GOTO(ndr_push_bytes(call->ndr_push_data,
(const uint8_t *)r.out.info[i].info0.name,
sizeof(r.out.info[i].info0.name)));
break;
case 1:
- NDR_OK(ndr_push_bytes(call->ndr_push_data,
+ NDR_GOTO(ndr_push_bytes(call->ndr_push_data,
(const uint8_t *)r.out.info[i].info1.name,
sizeof(r.out.info[i].info1.name)));
- NDR_OK(ndr_push_uint8(call->ndr_push_data,
+ NDR_GOTO(ndr_push_uint8(call->ndr_push_data,
NDR_SCALARS, r.out.info[i].info1.version_major));
- NDR_OK(ndr_push_uint8(call->ndr_push_data,
+ NDR_GOTO(ndr_push_uint8(call->ndr_push_data,
NDR_SCALARS, r.out.info[i].info1.version_minor));
- NDR_OK(ndr_push_uint32(call->ndr_push_data,
+ NDR_GOTO(ndr_push_uint32(call->ndr_push_data,
NDR_SCALARS, r.out.info[i].info1.servertype));
- NDR_OK(rap_push_string(call->ndr_push_data,
+ RAP_GOTO(rap_push_string(call->ndr_push_data,
call->heap,
r.out.info[i].info1.comment));
call->status = r.out.status;
- NDR_CHECK(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.count));
- NDR_CHECK(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.available));
+ NDR_RETURN(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.count));
+ NDR_RETURN(ndr_push_uint16(call->ndr_push_param, NDR_SCALARS, r.out.available));
result = NT_STATUS_OK;
if (call == NULL)
return NT_STATUS_NO_MEMORY;
- NDR_CHECK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &call->callno));
- NDR_CHECK(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS,
+ NDR_RETURN(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &call->callno));
+ NDR_RETURN(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS,
&call->paramdesc));
- NDR_CHECK(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS,
+ NDR_RETURN(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS,
&call->datadesc));
call->ndr_push_param = ndr_push_init_ctx(call);
final_param->flags = RAPNDR_FLAGS;
final_data->flags = RAPNDR_FLAGS;
- NDR_CHECK(ndr_push_uint16(final_param, NDR_SCALARS, call->status));
- NDR_CHECK(ndr_push_uint16(final_param,
+ NDR_RETURN(ndr_push_uint16(final_param, NDR_SCALARS, call->status));
+ NDR_RETURN(ndr_push_uint16(final_param,
NDR_SCALARS, call->heap->offset - result_data.length));
- NDR_CHECK(ndr_push_bytes(final_param, result_param.data,
+ NDR_RETURN(ndr_push_bytes(final_param, result_param.data,
result_param.length));
- NDR_CHECK(ndr_push_bytes(final_data, result_data.data,
+ NDR_RETURN(ndr_push_bytes(final_data, result_data.data,
result_data.length));
for (i=call->heap->num_strings-1; i>=0; i--)
- NDR_CHECK(ndr_push_string(final_data, NDR_SCALARS,
+ NDR_RETURN(ndr_push_string(final_data, NDR_SCALARS,
call->heap->strings[i]));
trans->out.setup_count = 0;
{
NTSTATUS status;
DATA_BLOB blob;
+ enum ndr_err_code ndr_err;
status = pull_xattr_blob(pvfs, mem_ctx, attr_name, fname,
fd, XATTR_DOSATTRIB_ESTIMATED_SIZE, &blob);
}
/* pull the blob */
- status = ndr_pull_struct_blob(&blob, mem_ctx, p, (ndr_pull_flags_fn_t)pull_fn);
+ ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, p, (ndr_pull_flags_fn_t)pull_fn);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
data_blob_free(&blob);
- return status;
+ return NT_STATUS_OK;
}
/*
TALLOC_CTX *mem_ctx = talloc_new(NULL);
DATA_BLOB blob;
NTSTATUS status;
+ enum ndr_err_code ndr_err;
- status = ndr_push_struct_blob(&blob, mem_ctx, p, (ndr_push_flags_fn_t)push_fn);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_struct_blob(&blob, mem_ctx, p, (ndr_push_flags_fn_t)push_fn);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(mem_ctx);
- return status;
+ return ndr_map_error2ntstatus(ndr_err);
}
status = push_xattr_blob(pvfs, attr_name, fname, fd, &blob);
NTSTATUS dcesrv_input_process(struct dcesrv_connection *dce_conn)
{
struct ndr_pull *ndr;
+ enum ndr_err_code ndr_err;
NTSTATUS status;
struct dcesrv_call_state *call;
DATA_BLOB blob;
ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
}
- status = ndr_pull_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, &call->pkt);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, &call->pkt);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(dce_conn->partial_input.data);
talloc_free(call);
- return status;
+ return ndr_map_error2ntstatus(ndr_err);
}
/* we have to check the signing here, before combining the
struct dcesrv_connection *dce_conn = call->conn;
struct dcesrv_auth *auth = &dce_conn->auth_state;
NTSTATUS status;
+ enum ndr_err_code ndr_err;
if (pkt->u.bind.auth_info.length == 0) {
dce_conn->auth_state.auth_info = NULL;
return false;
}
- status = ndr_pull_struct_blob(&pkt->u.bind.auth_info,
- call,
- dce_conn->auth_state.auth_info,
- (ndr_pull_flags_fn_t)ndr_pull_dcerpc_auth);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob(&pkt->u.bind.auth_info,
+ call,
+ dce_conn->auth_state.auth_info,
+ (ndr_pull_flags_fn_t)ndr_pull_dcerpc_auth);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return false;
}
struct ncacn_packet *pkt = &call->pkt;
struct dcesrv_connection *dce_conn = call->conn;
NTSTATUS status;
+ enum ndr_err_code ndr_err;
/* We can't work without an existing gensec state, and an new blob to feed it */
if (!dce_conn->auth_state.auth_info ||
return false;
}
- status = ndr_pull_struct_blob(&pkt->u.auth3.auth_info,
- call,
- dce_conn->auth_state.auth_info,
- (ndr_pull_flags_fn_t)ndr_pull_dcerpc_auth);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob(&pkt->u.auth3.auth_info,
+ call,
+ dce_conn->auth_state.auth_info,
+ (ndr_pull_flags_fn_t)ndr_pull_dcerpc_auth);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return false;
}
{
struct ncacn_packet *pkt = &call->pkt;
struct dcesrv_connection *dce_conn = call->conn;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
/* on a pure interface change there is no auth blob */
if (pkt->u.alter.auth_info.length == 0) {
return false;
}
- status = ndr_pull_struct_blob(&pkt->u.alter.auth_info,
- call,
- dce_conn->auth_state.auth_info,
- (ndr_pull_flags_fn_t)ndr_pull_dcerpc_auth);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob(&pkt->u.alter.auth_info,
+ call,
+ dce_conn->auth_state.auth_info,
+ (ndr_pull_flags_fn_t)ndr_pull_dcerpc_auth);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return false;
}
struct dcerpc_auth auth;
struct ndr_pull *ndr;
NTSTATUS status;
+ enum ndr_err_code ndr_err;
if (!dce_conn->auth_state.auth_info ||
!dce_conn->auth_state.gensec_security) {
ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
}
- status = ndr_pull_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, &auth);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, &auth);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(ndr);
return false;
}
{
struct dcesrv_connection *dce_conn = call->conn;
NTSTATUS status;
+ enum ndr_err_code ndr_err;
struct ndr_push *ndr;
uint32_t payload_length;
DATA_BLOB creds2;
ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
}
- status = ndr_push_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_push_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return false;
}
}
/* add the auth verifier */
- status = ndr_push_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS,
+ ndr_err = ndr_push_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS,
dce_conn->auth_state.auth_info);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return false;
}
static NTSTATUS remote_op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)
{
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
const struct ndr_interface_table *table = (const struct ndr_interface_table *)dce_call->context->iface->private;
uint16_t opnum = dce_call->pkt.u.request.opnum;
}
/* unravel the NDR for the packet */
- status = table->calls[opnum].ndr_pull(pull, NDR_IN, *r);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = table->calls[opnum].ndr_pull(pull, NDR_IN, *r);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
dcerpc_log_packet(table, opnum, NDR_IN,
&dce_call->pkt.u.request.stub_and_verifier);
dce_call->fault_code = DCERPC_FAULT_NDR;
static NTSTATUS remote_op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
{
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
const struct ndr_interface_table *table = dce_call->context->iface->private;
uint16_t opnum = dce_call->pkt.u.request.opnum;
/* unravel the NDR for the packet */
- status = table->calls[opnum].ndr_push(push, NDR_OUT, r);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = table->calls[opnum].ndr_push(push, NDR_OUT, r);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
dce_call->fault_code = DCERPC_FAULT_NDR;
return NT_STATUS_NET_WRITE_FAULT;
}
/* the security descriptor is optional */
if (r->in.secdesc != NULL) {
DATA_BLOB sdblob;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
sdblob.data = r->in.secdesc->sd.data;
sdblob.length = r->in.secdesc->sd.len;
if (sdblob.data == NULL) {
return WERR_INVALID_PARAM;
}
- status = ndr_pull_struct_blob_all(&sdblob, mem_ctx, &sd,
- (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob_all(&sdblob, mem_ctx, &sd,
+ (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return WERR_INVALID_PARAM;
}
}
return NT_STATUS_OK;
- case RAW_QFS_OBJECTID_INFORMATION:
+ case RAW_QFS_OBJECTID_INFORMATION: {
+ enum ndr_err_code ndr_err;
+
BLOB_CHECK(smbsrv_blob_grow_data(mem_ctx, blob, 64));
- BLOB_CHECK(ndr_push_struct_blob(&guid_blob, mem_ctx,
- &fsinfo->objectid_information.out.guid,
- (ndr_push_flags_fn_t)ndr_push_GUID));
+ ndr_err = ndr_push_struct_blob(&guid_blob, mem_ctx,
+ &fsinfo->objectid_information.out.guid,
+ (ndr_push_flags_fn_t)ndr_push_GUID);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ BLOB_CHECK(ndr_map_error2ntstatus(ndr_err));
+ }
+
memcpy(blob->data, guid_blob.data, guid_blob.length);
for (i=0;i<6;i++) {
}
return NT_STATUS_OK;
-
+ }
default:
return NT_STATUS_INVALID_LEVEL;
}
uint32_t sd_length, ea_length;
NTSTATUS status;
uint8_t *params;
+ enum ndr_err_code ndr_err;
if (trans->in.params.length < 54) {
return NT_STATUS_INVALID_PARAMETER;
if (io->ntcreatex.in.sec_desc == NULL) {
return NT_STATUS_NO_MEMORY;
}
- status = ndr_pull_struct_blob(&blob, io,
- io->ntcreatex.in.sec_desc,
- (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
+ ndr_err = ndr_pull_struct_blob(&blob, io,
+ io->ntcreatex.in.sec_desc,
+ (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
}
}
union smb_fileinfo *io = talloc_get_type(op->op_info, union smb_fileinfo);
uint8_t *params;
NTSTATUS status;
+ enum ndr_err_code ndr_err;
status = nttrans_setup_reply(op, op->trans, 4, 0, 0);
NT_STATUS_NOT_OK_RETURN(status);
params = op->trans->out.params.data;
- status = ndr_push_struct_blob(&op->trans->out.data, op,
- io->query_secdesc.out.sd,
- (ndr_push_flags_fn_t)ndr_push_security_descriptor);
- NT_STATUS_NOT_OK_RETURN(status);
+ ndr_err = ndr_push_struct_blob(&op->trans->out.data, op,
+ io->query_secdesc.out.sd,
+ (ndr_push_flags_fn_t)ndr_push_security_descriptor);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
SIVAL(params, 0, op->trans->out.data.length);
{
struct smb_nttrans *trans = op->trans;
union smb_setfileinfo *io;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
if (trans->in.params.length < 8) {
return NT_STATUS_INVALID_PARAMETER;
io->set_secdesc.in.sd = talloc(io, struct security_descriptor);
NT_STATUS_HAVE_NO_MEMORY(io->set_secdesc.in.sd);
- status = ndr_pull_struct_blob(&trans->in.data, req,
- io->set_secdesc.in.sd,
- (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
- NT_STATUS_NOT_OK_RETURN(status);
+ ndr_err = ndr_pull_struct_blob(&trans->in.data, req,
+ io->set_secdesc.in.sd,
+ (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
SMBSRV_CHECK_FILE_HANDLE_NTSTATUS(io->set_secdesc.in.file.ntvfs);
return ntvfs_setfileinfo(req->ntvfs, io);
static NTSTATUS smb2srv_getinfo_security_send(struct smb2srv_getinfo_op *op)
{
union smb_fileinfo *io = talloc_get_type(op->io_ptr, union smb_fileinfo);
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
- status = ndr_push_struct_blob(&op->info->out.blob, op->req,
- io->query_secdesc.out.sd,
- (ndr_push_flags_fn_t)ndr_push_security_descriptor);
- NT_STATUS_NOT_OK_RETURN(status);
+ ndr_err = ndr_push_struct_blob(&op->info->out.blob, op->req,
+ io->query_secdesc.out.sd,
+ (ndr_push_flags_fn_t)ndr_push_security_descriptor);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
return NT_STATUS_OK;
}
static NTSTATUS smb2srv_setinfo_security(struct smb2srv_setinfo_op *op, uint8_t smb2_level)
{
union smb_setfileinfo *io;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
switch (smb2_level) {
case 0x00:
io->set_secdesc.in.sd = talloc(io, struct security_descriptor);
NT_STATUS_HAVE_NO_MEMORY(io->set_secdesc.in.sd);
- status = ndr_pull_struct_blob(&op->info->in.blob, io,
- io->set_secdesc.in.sd,
- (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
- NT_STATUS_NOT_OK_RETURN(status);
+ ndr_err = ndr_pull_struct_blob(&op->info->in.blob, io,
+ io->set_secdesc.in.sd,
+ (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
return ntvfs_setfileinfo(op->req->ntvfs, io);
}
static bool torture_pac_saved_check(struct torture_context *tctx)
{
NTSTATUS nt_status;
+ enum ndr_err_code ndr_err;
DATA_BLOB tmp_blob, validate_blob;
struct PAC_DATA *pac_data, pac_data2;
struct PAC_LOGON_INFO *logon_info;
* pointer, padding etc algorithms as win2k3.
*/
if (tmp_blob.length != validate_blob.length) {
- nt_status = ndr_pull_struct_blob(&validate_blob, mem_ctx, &pac_data2,
- (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
+ ndr_err = ndr_pull_struct_blob(&validate_blob, mem_ctx, &pac_data2,
+ (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
+ nt_status = ndr_map_error2ntstatus(ndr_err);
torture_assert_ntstatus_ok(tctx, nt_status, "can't parse the PAC");
NDR_PRINT_DEBUG(PAC_DATA, pac_data);
}
if (memcmp(tmp_blob.data, validate_blob.data, tmp_blob.length) != 0) {
- nt_status = ndr_pull_struct_blob(&validate_blob, mem_ctx, &pac_data2,
- (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
+ ndr_err = ndr_pull_struct_blob(&validate_blob, mem_ctx, &pac_data2,
+ (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
+ nt_status = ndr_map_error2ntstatus(ndr_err);
torture_assert_ntstatus_ok(tctx, nt_status, "can't parse the PAC");
NDR_PRINT_DEBUG(PAC_DATA, pac_data);
bool ok = true;
uint32_t i;
int ret;
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
struct ldb_result *r;
const struct ldb_val *utdv_val1;
struct replUpToDateVectorBlob utdv1;
ZERO_STRUCT(utdv1);
utdv_val1 = ldb_msg_find_ldb_val(r->msgs[0], "replUpToDateVector");
if (utdv_val1) {
- status = ndr_pull_struct_blob_all(utdv_val1, torture, &utdv1,
- (ndr_pull_flags_fn_t)ndr_pull_replUpToDateVectorBlob);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob_all(utdv_val1, torture, &utdv1,
+ (ndr_pull_flags_fn_t)ndr_pull_replUpToDateVectorBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return false;
}
}
ZERO_STRUCT(utdv);
utdv_val = ldb_msg_find_ldb_val(r->msgs[0], "replUpToDateVector");
if (utdv_val) {
- status = ndr_pull_struct_blob_all(utdv_val, torture, &utdv,
- (ndr_pull_flags_fn_t)ndr_pull_replUpToDateVectorBlob);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_pull_struct_blob_all(utdv_val, torture, &utdv,
+ (ndr_pull_flags_fn_t)ndr_pull_replUpToDateVectorBlob);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return false;
}
}
ndr->flags |= LIBNDR_FLAG_REF_ALLOC;
- torture_assert_ntstatus_ok(tctx, data->pull_fn(ndr, data->ndr_flags, ds),
- "pulling");
+ torture_assert_ndr_success(tctx, data->pull_fn(ndr, data->ndr_flags, ds),
+ "pulling");
torture_assert(tctx, ndr->offset == ndr->data_size,
talloc_asprintf(tctx,
ndr = ndr_pull_init_blob(&blob, mem_ctx);
- torture_assert_ntstatus_ok(tctx, ndr_check_string_terminator(ndr, 1, 2),
- "simple check_string_terminator test failed");
+ torture_assert_ndr_success(tctx, ndr_check_string_terminator(ndr, 1, 2),
+ "simple check_string_terminator test failed");
torture_assert(tctx, ndr->offset == 0,
"check_string_terminator did not reset offset");
- if (NT_STATUS_IS_OK(ndr_check_string_terminator(ndr, 1, 3))) {
+ if (NDR_ERR_CODE_IS_SUCCESS(ndr_check_string_terminator(ndr, 1, 3))) {
torture_fail(tctx, "check_string_terminator checked beyond string boundaries");
}
blob = strhex_to_data_blob("11220000");
ndr = ndr_pull_init_blob(&blob, mem_ctx);
- torture_assert_ntstatus_ok(tctx,
+ torture_assert_ndr_success(tctx,
ndr_check_string_terminator(ndr, 4, 1),
"check_string_terminator failed to recognize terminator");
- torture_assert_ntstatus_ok(tctx,
+ torture_assert_ndr_success(tctx,
ndr_check_string_terminator(ndr, 3, 1),
"check_string_terminator failed to recognize terminator");
- if (NT_STATUS_IS_OK(ndr_check_string_terminator(ndr, 2, 1))) {
- torture_fail(tctx,
- "check_string_terminator erroneously reported terminator");
+ if (NDR_ERR_CODE_IS_SUCCESS(ndr_check_string_terminator(ndr, 2, 1))) {
+ torture_fail(tctx, "check_string_terminator erroneously reported terminator");
}
torture_assert(tctx, ndr->offset == 0,
#include "libcli/libcli.h"
#include "librpc/ndr/libndr.h"
+#define RAP_GOTO(call) do { \
+ NTSTATUS _status; \
+ _status = call; \
+ if (!NT_STATUS_IS_OK(_status)) { \
+ result = _status; \
+ goto done; \
+ } \
+} while (0)
+
+#define NDR_GOTO(call) do { \
+ enum ndr_err_code _ndr_err; \
+ _ndr_err = call; \
+ if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
+ result = ndr_map_error2ntstatus(_ndr_err); \
+ goto done; \
+ } \
+} while (0)
+
+#define NDR_RETURN(call) do { \
+ enum ndr_err_code _ndr_err; \
+ _ndr_err = call; \
+ if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
+ return ndr_map_error2ntstatus(_ndr_err); \
+ } \
+} while (0)
+
struct rap_call {
uint16_t callno;
char *paramdesc;
const char *p;
size_t len;
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &string_offset));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &ignore));
+ NDR_RETURN(ndr_pull_uint16(ndr, NDR_SCALARS, &string_offset));
+ NDR_RETURN(ndr_pull_uint16(ndr, NDR_SCALARS, &ignore));
string_offset -= convert;
trans.in.setup = NULL;
trans.in.trans_name = "\\PIPE\\LANMAN";
- NDR_CHECK(ndr_push_uint16(params, NDR_SCALARS, call->callno));
+ NDR_RETURN(ndr_push_uint16(params, NDR_SCALARS, call->callno));
if (call->paramdesc)
- NDR_CHECK(ndr_push_string(params, NDR_SCALARS, call->paramdesc));
+ NDR_RETURN(ndr_push_string(params, NDR_SCALARS, call->paramdesc));
if (call->datadesc)
- NDR_CHECK(ndr_push_string(params, NDR_SCALARS, call->datadesc));
+ NDR_RETURN(ndr_push_string(params, NDR_SCALARS, call->datadesc));
param_blob = ndr_push_blob(call->ndr_push_param);
- NDR_CHECK(ndr_push_bytes(params, param_blob.data,
+ NDR_RETURN(ndr_push_bytes(params, param_blob.data,
param_blob.length));
trans.in.params = ndr_push_blob(params);
return result;
}
-#define NDR_OK(call) do { NTSTATUS _status; \
- _status = call; \
- if (!NT_STATUS_IS_OK(_status)) \
- goto done; \
- } while (0)
static NTSTATUS smbcli_rap_netshareenum(struct smbcli_tree *tree,
TALLOC_CTX *mem_ctx,
if (!NT_STATUS_IS_OK(result))
goto done;
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.status));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.convert));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.count));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.available));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.status));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.convert));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.count));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.available));
r->out.info = talloc_array(mem_ctx, union rap_shareenum_info, r->out.count);
for (i=0; i<r->out.count; i++) {
switch(r->in.level) {
case 0:
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
(uint8_t *)r->out.info[i].info0.name, 13));
break;
case 1:
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
(uint8_t *)r->out.info[i].info1.name, 13));
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
(uint8_t *)&r->out.info[i].info1.pad, 1));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_data,
NDR_SCALARS, &r->out.info[i].info1.type));
- NDR_OK(rap_pull_string(mem_ctx, call->ndr_pull_data,
+ RAP_GOTO(rap_pull_string(mem_ctx, call->ndr_pull_data,
r->out.convert,
&r->out.info[i].info1.comment));
break;
result = NT_STATUS_INVALID_PARAMETER;
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.status));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.convert));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.count));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.available));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.status));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.convert));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.count));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.available));
r->out.info = talloc_array(mem_ctx, union rap_server_info, r->out.count);
for (i=0; i<r->out.count; i++) {
switch(r->in.level) {
case 0:
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
(uint8_t *)r->out.info[i].info0.name, 16));
break;
case 1:
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
(uint8_t *)r->out.info[i].info1.name, 16));
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
&r->out.info[i].info1.version_major, 1));
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
&r->out.info[i].info1.version_minor, 1));
- NDR_OK(ndr_pull_uint32(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_uint32(call->ndr_pull_data,
NDR_SCALARS, &r->out.info[i].info1.servertype));
- NDR_OK(rap_pull_string(mem_ctx, call->ndr_pull_data,
+ RAP_GOTO(rap_pull_string(mem_ctx, call->ndr_pull_data,
r->out.convert,
&r->out.info[i].info1.comment));
}
if (!NT_STATUS_IS_OK(result))
goto done;
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.status));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.convert));
- NDR_OK(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.available));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.status));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.convert));
+ NDR_GOTO(ndr_pull_uint16(call->ndr_pull_param, NDR_SCALARS, &r->out.available));
switch(r->in.level) {
case 0:
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
(uint8_t *)r->out.info.info0.name, 16));
break;
case 1:
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
(uint8_t *)r->out.info.info1.name, 16));
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
&r->out.info.info1.version_major, 1));
- NDR_OK(ndr_pull_bytes(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_bytes(call->ndr_pull_data,
&r->out.info.info1.version_minor, 1));
- NDR_OK(ndr_pull_uint32(call->ndr_pull_data,
+ NDR_GOTO(ndr_pull_uint32(call->ndr_pull_data,
NDR_SCALARS, &r->out.info.info1.servertype));
- NDR_OK(rap_pull_string(mem_ctx, call->ndr_pull_data,
+ RAP_GOTO(rap_pull_string(mem_ctx, call->ndr_pull_data,
r->out.convert,
&r->out.info.info1.comment));
}
DATA_BLOB blob;
struct eventlog_Record rec;
struct ndr_pull *ndr;
+ enum ndr_err_code ndr_err;
/* Read first for number of bytes in record */
ndr = ndr_pull_init_blob(&blob, tctx);
- status = ndr_pull_eventlog_Record(
+ ndr_err = ndr_pull_eventlog_Record(
ndr, NDR_SCALARS|NDR_BUFFERS, &rec);
+ status = ndr_map_error2ntstatus(ndr_err);
NDR_PRINT_DEBUG(eventlog_Record, &rec);
if (user->user_private_info.SensitiveData) {
DATA_BLOB data;
struct netr_USER_KEYS keys;
+ enum ndr_err_code ndr_err;
data.data = user->user_private_info.SensitiveData;
data.length = user->user_private_info.DataLength;
creds_arcfour_crypt(samsync_state->creds, data.data, data.length);
- nt_status = ndr_pull_struct_blob(&data, mem_ctx, &keys, (ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS);
- if (NT_STATUS_IS_OK(nt_status)) {
+ ndr_err = ndr_pull_struct_blob(&data, mem_ctx, &keys, (ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS);
+ if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
if (keys.keys.keys2.lmpassword.length == 16) {
sam_rid_crypt(rid, keys.keys.keys2.lmpassword.pwd.hash, lm_hash.hash, 0);
lm_hash_p = &lm_hash;
static NTSTATUS spoolss__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)
{
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
uint16_t opnum = dce_call->pkt.u.request.opnum;
dce_call->fault_code = 0;
NT_STATUS_HAVE_NO_MEMORY(*r);
/* unravel the NDR for the packet */
- status = ndr_table_spoolss.calls[opnum].ndr_pull(pull, NDR_IN, *r);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_table_spoolss.calls[opnum].ndr_pull(pull, NDR_IN, *r);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
dcerpc_log_packet(&ndr_table_spoolss, opnum, NDR_IN,
&dce_call->pkt.u.request.stub_and_verifier);
dce_call->fault_code = DCERPC_FAULT_NDR;
static NTSTATUS spoolss__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
{
- NTSTATUS status;
+ enum ndr_err_code ndr_err;
uint16_t opnum = dce_call->pkt.u.request.opnum;
- status = ndr_table_spoolss.calls[opnum].ndr_push(push, NDR_OUT, r);
- if (!NT_STATUS_IS_OK(status)) {
+ ndr_err = ndr_table_spoolss.calls[opnum].ndr_push(push, NDR_OUT, r);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
dce_call->fault_code = DCERPC_FAULT_NDR;
return NT_STATUS_NET_WRITE_FAULT;
}
SEC_ACE_FLAG_CONTAINER_INHERIT,
NULL);
- torture_assert_ntstatus_ok(tctx,
+ torture_assert_ndr_success(tctx,
ndr_push_struct_blob(&sdblob, tctx, sd,
(ndr_push_flags_fn_t)ndr_push_security_descriptor),
"Failed to push security_descriptor ?!\n");
sd = talloc_zero(tctx, struct security_descriptor);
- torture_assert_ntstatus_ok(tctx,
+ torture_assert_ndr_success(tctx,
ndr_pull_struct_blob(&sdblob, tctx, sd,
(ndr_pull_flags_fn_t)ndr_pull_security_descriptor),
"pull_security_descriptor failed");
NDR_PRINT_DEBUG(security_descriptor, sd);
}
- torture_assert_ntstatus_ok(tctx,
+ torture_assert_ndr_success(tctx,
ndr_push_struct_blob(&sdblob, tctx, sd,
(ndr_push_flags_fn_t)ndr_push_security_descriptor),
"push_security_descriptor failed");
}\
} while(0)
+#define torture_assert_ndr_err_equal(torture_ctx,got,expected,cmt) \
+ do { enum ndr_err_code __got = got, __expected = expected; \
+ if (__got != __expected) { \
+ torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got" was %d, expected %d (%s): %s", __got, __expected, __STRING(expected), cmt); \
+ return false; \
+ }\
+ } while(0)
#define torture_assert_casestr_equal(torture_ctx,got,expected,cmt) \
do { const char *__got = (got), *__expected = (expected); \
#define torture_assert_werr_ok(torture_ctx,expr,cmt) \
torture_assert_werr_equal(torture_ctx,expr,WERR_OK,cmt)
+#define torture_assert_ndr_success(torture_ctx,expr,cmt) \
+ torture_assert_ndr_err_equal(torture_ctx,expr,NDR_ERR_SUCCESS,cmt)
+
/* Getting settings */
const char *torture_setting_string(struct torture_context *test, \
const char *name,
{
DATA_BLOB blob;
ssize_t size;
- NTSTATUS result;
+ enum ndr_err_code ndr_err;
struct ndr_pull *ndr;
*ntacl = talloc(mem_ctx, struct xattr_NTACL);
ndr = ndr_pull_init_blob(&blob, NULL);
- result = ndr_pull_xattr_NTACL(ndr, NDR_SCALARS|NDR_BUFFERS, *ntacl);
-
- if (!NT_STATUS_IS_OK(result)) {
- return result;
+ ndr_err = ndr_pull_xattr_NTACL(ndr, NDR_SCALARS|NDR_BUFFERS, *ntacl);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
}
return NT_STATUS_OK;
static void pam_auth_crap_recv_logon(struct composite_context *ctx)
{
DATA_BLOB tmp_blob;
+ enum ndr_err_code ndr_err;
struct netr_SamBaseInfo *base;
struct pam_auth_crap_state *state =
talloc_get_type(ctx->async.private_data,
state->ctx->status = wb_sam_logon_recv(ctx, state, state->req);
if (!composite_is_ok(state->ctx)) return;
- state->ctx->status = ndr_push_struct_blob(
+ ndr_err = ndr_push_struct_blob(
&tmp_blob, state, state->req->out.validation.sam3,
(ndr_push_flags_fn_t)ndr_push_netr_SamInfo3);
- if (!composite_is_ok(state->ctx)) return;
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ state->ctx->status = ndr_map_error2ntstatus(ndr_err);
+ if (!composite_is_ok(state->ctx)) return;
+ }
/* The Samba3 protocol is a bit broken (due to non-IDL
* heritage, so for compatability we must add a non-zero 4
DATA_BLOB packet_out_blob;
struct wrepl_wrap packet_out_wrap;
NTSTATUS status;
+ enum ndr_err_code ndr_err;
call = talloc_zero(wreplconn, struct wreplsrv_in_call);
NT_STATUS_HAVE_NO_MEMORY(call);
packet_in_blob.data = blob.data + 4;
packet_in_blob.length = blob.length - 4;
- status = ndr_pull_struct_blob(&packet_in_blob, call, &call->req_packet,
- (ndr_pull_flags_fn_t)ndr_pull_wrepl_packet);
- NT_STATUS_NOT_OK_RETURN(status);
+ ndr_err = ndr_pull_struct_blob(&packet_in_blob, call, &call->req_packet,
+ (ndr_pull_flags_fn_t)ndr_pull_wrepl_packet);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
if (DEBUGLVL(10)) {
DEBUG(10,("Received WINS-Replication packet of length %u\n",
/* and now encode the reply */
packet_out_wrap.packet = call->rep_packet;
- status = ndr_push_struct_blob(&packet_out_blob, call, &packet_out_wrap,
+ ndr_err = ndr_push_struct_blob(&packet_out_blob, call, &packet_out_wrap,
(ndr_push_flags_fn_t)ndr_push_wrepl_wrap);
- NT_STATUS_NOT_OK_RETURN(status);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return ndr_map_error2ntstatus(ndr_err);
+ }
if (DEBUGLVL(10)) {
DEBUG(10,("Sending WINS-Replication packet of length %d\n", (int)packet_out_blob.length));