diff options
Diffstat (limited to 'source4')
41 files changed, 149 insertions, 85 deletions
diff --git a/source4/auth/gensec/schannel.c b/source4/auth/gensec/schannel.c index b14e741311..f37a29032a 100644 --- a/source4/auth/gensec/schannel.c +++ b/source4/auth/gensec/schannel.c @@ -82,7 +82,8 @@ static NTSTATUS schannel_update(struct gensec_security *gensec_security, TALLOC_ bind_schannel.u.info3.workstation = cli_credentials_get_workstation(gensec_security->credentials); #endif - ndr_err = ndr_push_struct_blob(out, out_mem_ctx, &bind_schannel, + ndr_err = ndr_push_struct_blob(out, out_mem_ctx, + lp_iconv_convenience(gensec_security->lp_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); @@ -137,7 +138,8 @@ static NTSTATUS schannel_update(struct gensec_security *gensec_security, TALLOC_ bind_schannel_ack.unknown2 = 0; bind_schannel_ack.unknown3 = 0x6c0000; - ndr_err = ndr_push_struct_blob(out, out_mem_ctx, &bind_schannel_ack, + ndr_err = ndr_push_struct_blob(out, out_mem_ctx, + lp_iconv_convenience(gensec_security->lp_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); diff --git a/source4/auth/kerberos/kerberos_pac.c b/source4/auth/kerberos/kerberos_pac.c index 6eea053e2b..705f66a64b 100644 --- a/source4/auth/kerberos/kerberos_pac.c +++ b/source4/auth/kerberos/kerberos_pac.c @@ -29,6 +29,7 @@ #include "librpc/gen_ndr/ndr_krb5pac.h" #include "lib/ldb/include/ldb.h" #include "auth/auth_sam_reply.h" +#include "param/param.h" static krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, DATA_BLOB pac_data, @@ -85,6 +86,7 @@ static krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, struct PAC_LOGON_NAME *logon_name = NULL; struct PAC_DATA *pac_data; struct PAC_DATA_RAW *pac_data_raw; + struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm); DATA_BLOB *srv_sig_blob = NULL; DATA_BLOB *kdc_sig_blob = NULL; @@ -229,7 +231,9 @@ static krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, memset(srv_sig_wipe->signature.data, '\0', srv_sig_wipe->signature.length); /* and reencode, back into the same place it came from */ - ndr_err = ndr_push_struct_blob(kdc_sig_blob, pac_data_raw, kdc_sig_wipe, + ndr_err = ndr_push_struct_blob(kdc_sig_blob, pac_data_raw, + iconv_convenience, + 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); @@ -237,7 +241,9 @@ static krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, nt_errstr(status))); return status; } - ndr_err = ndr_push_struct_blob(srv_sig_blob, pac_data_raw, srv_sig_wipe, + ndr_err = ndr_push_struct_blob(srv_sig_blob, pac_data_raw, + iconv_convenience, + 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); @@ -247,7 +253,9 @@ static krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, } /* push out the whole structure, but now with zero'ed signatures */ - ndr_err = ndr_push_struct_blob(&modified_pac_blob, pac_data_raw, pac_data_raw, + ndr_err = ndr_push_struct_blob(&modified_pac_blob, pac_data_raw, + iconv_convenience, + 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); @@ -472,7 +480,9 @@ static krb5_error_code make_pac_checksum(TALLOC_CTX *mem_ctx, memset(kdc_checksum->signature.data, '\0', kdc_checksum->signature.length); memset(srv_checksum->signature.data, '\0', srv_checksum->signature.length); - ndr_err = ndr_push_struct_blob(&tmp_blob, mem_ctx, pac_data, + ndr_err = ndr_push_struct_blob(&tmp_blob, mem_ctx, + lp_iconv_convenience(global_loadparm), + 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); @@ -495,7 +505,9 @@ static krb5_error_code make_pac_checksum(TALLOC_CTX *mem_ctx, } /* And push it out again, this time to the world. This relies on determanistic pointer values */ - ndr_err = ndr_push_struct_blob(&tmp_blob, mem_ctx, pac_data, + ndr_err = ndr_push_struct_blob(&tmp_blob, mem_ctx, + lp_iconv_convenience(global_loadparm), + 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); diff --git a/source4/cluster/ctdb/opendb_ctdb.c b/source4/cluster/ctdb/opendb_ctdb.c index bb8ae26d3d..4972dab0cf 100644 --- a/source4/cluster/ctdb/opendb_ctdb.c +++ b/source4/cluster/ctdb/opendb_ctdb.c @@ -231,7 +231,9 @@ static NTSTATUS odb_push_record(struct odb_lock *lck, struct opendb_file *file) return NT_STATUS_OK; } - ndr_err = ndr_push_struct_blob(&blob, lck, file, (ndr_push_flags_fn_t)ndr_push_opendb_file); + ndr_err = ndr_push_struct_blob(&blob, lck, + lp_iconv_convenience(global_loadparm), + file, (ndr_push_flags_fn_t)ndr_push_opendb_file); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return ndr_map_error2ntstatus(ndr_err); } diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index efc1b20ae0..ea623a3d4a 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -31,6 +31,7 @@ #include "dsdb/common/flags.h" #include "dsdb/common/proto.h" #include "libcli/ldap/ldap_ndr.h" +#include "param/param.h" #include "libcli/auth/libcli_auth.h" /* @@ -674,7 +675,9 @@ int samdb_msg_add_dom_sid(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, stru struct ldb_val v; enum ndr_err_code ndr_err; - ndr_err = ndr_push_struct_blob(&v, mem_ctx, sid, + ndr_err = ndr_push_struct_blob(&v, mem_ctx, + lp_iconv_convenience(ldb_get_opaque(sam_ldb, "loadparm")), + sid, (ndr_push_flags_fn_t)ndr_push_dom_sid); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return -1; diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c index c47108559d..8aff1340a5 100644 --- a/source4/dsdb/repl/replicated_objects.c +++ b/source4/dsdb/repl/replicated_objects.c @@ -28,6 +28,7 @@ #include "librpc/gen_ndr/ndr_drsblobs.h" #include "lib/crypto/crypto.h" #include "libcli/auth/libcli_auth.h" +#include "param/param.h" static WERROR dsdb_decrypt_attribute_value(TALLOC_CTX *mem_ctx, const DATA_BLOB *gensec_skey, @@ -322,7 +323,9 @@ static WERROR dsdb_convert_object(struct ldb_context *ldb, whenChanged_s = ldb_timestring(msg, whenChanged_t); W_ERROR_HAVE_NO_MEMORY(whenChanged_s); - ndr_err = ndr_push_struct_blob(&guid_value, msg, &in->object.identifier->guid, + ndr_err = ndr_push_struct_blob(&guid_value, msg, + lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")), + &in->object.identifier->guid, (ndr_push_flags_fn_t)ndr_push_GUID); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { nt_status = ndr_map_error2ntstatus(ndr_err); diff --git a/source4/dsdb/samdb/ldb_modules/objectclass.c b/source4/dsdb/samdb/ldb_modules/objectclass.c index da5cae1c65..d3beedc689 100644 --- a/source4/dsdb/samdb/ldb_modules/objectclass.c +++ b/source4/dsdb/samdb/ldb_modules/objectclass.c @@ -43,6 +43,7 @@ #include "librpc/gen_ndr/ndr_security.h" #include "libcli/security/security.h" #include "auth/auth.h" +#include "param/param.h" struct oc_context { @@ -273,7 +274,9 @@ static DATA_BLOB *get_sd(struct ldb_module *module, TALLOC_CTX *mem_ctx, return NULL; } - ndr_err = ndr_push_struct_blob(linear_sd, mem_ctx, sd, + ndr_err = ndr_push_struct_blob(linear_sd, mem_ctx, + lp_iconv_convenience(ldb_get_opaque(module->ldb, "loadparm")), + sd, (ndr_push_flags_fn_t)ndr_push_security_descriptor); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return NULL; diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index e9d699d59c..bf57f5c21b 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -36,6 +36,7 @@ #include "includes.h" #include "ldb/include/ldb_includes.h" #include "librpc/gen_ndr/ndr_misc.h" +#include "param/param.h" static struct ldb_message_element *objectguid_find_attribute(const struct ldb_message *msg, const char *name) { @@ -143,7 +144,9 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) /* a new GUID */ guid = GUID_random(); - ndr_err = ndr_push_struct_blob(&v, msg, &guid, + ndr_err = ndr_push_struct_blob(&v, msg, + lp_iconv_convenience(ldb_get_opaque(module->ldb, "loadparm")), + &guid, (ndr_push_flags_fn_t)ndr_push_GUID); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(down_req); diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c index d139cc23a4..a69459cfef 100644 --- a/source4/dsdb/samdb/ldb_modules/password_hash.c +++ b/source4/dsdb/samdb/ldb_modules/password_hash.c @@ -913,7 +913,9 @@ static int setup_supplemental_field(struct setup_password_fields_io *io) return ret; } - ndr_err = ndr_push_struct_blob(&pkb_blob, io->ac, &pkb, + ndr_err = ndr_push_struct_blob(&pkb_blob, io->ac, + lp_iconv_convenience(ldb_get_opaque(io->ac->module->ldb, "loadparm")), + &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); @@ -952,7 +954,9 @@ static int setup_supplemental_field(struct setup_password_fields_io *io) return ret; } - ndr_err = ndr_push_struct_blob(&pdb_blob, io->ac, &pdb, + ndr_err = ndr_push_struct_blob(&pdb_blob, io->ac, + lp_iconv_convenience(ldb_get_opaque(io->ac->module->ldb, "loadparm")), + &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); @@ -979,7 +983,9 @@ static int setup_supplemental_field(struct setup_password_fields_io *io) pcb.cleartext = io->n.cleartext; - ndr_err = ndr_push_struct_blob(&pcb_blob, io->ac, &pcb, + ndr_err = ndr_push_struct_blob(&pcb_blob, io->ac, + lp_iconv_convenience(ldb_get_opaque(io->ac->module->ldb, "loadparm")), + &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); @@ -1002,7 +1008,9 @@ static int setup_supplemental_field(struct setup_password_fields_io *io) /* * setup 'Packages' element */ - ndr_err = ndr_push_struct_blob(&pb_blob, io->ac, &pb, + ndr_err = ndr_push_struct_blob(&pb_blob, io->ac, + lp_iconv_convenience(ldb_get_opaque(io->ac->module->ldb, "loadparm")), + &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); @@ -1027,7 +1035,9 @@ static int setup_supplemental_field(struct setup_password_fields_io *io) scb.sub.num_packages = num_packages; scb.sub.packages = packages; - ndr_err = ndr_push_struct_blob(&io->g.supplemental, io->ac, &scb, + ndr_err = ndr_push_struct_blob(&io->g.supplemental, io->ac, + lp_iconv_convenience(ldb_get_opaque(io->ac->module->ldb, "loadparm")), + &scb, (ndr_push_flags_fn_t)ndr_push_supplementalCredentialsBlob); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { NTSTATUS status = ndr_map_error2ntstatus(ndr_err); diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 497ee373de..87b9302139 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -47,6 +47,7 @@ #include "librpc/gen_ndr/ndr_misc.h" #include "librpc/gen_ndr/ndr_drsuapi.h" #include "librpc/gen_ndr/ndr_drsblobs.h" +#include "param/param.h" struct replmd_replicated_request { struct ldb_module *module; @@ -518,13 +519,17 @@ static int replmd_add_originating(struct ldb_module *module, replmd_replPropertyMetaDataCtr1_sort(&nmd.ctr.ctr1, &rdn_attr->attributeID_id); /* generated NDR encoded values */ - ndr_err = ndr_push_struct_blob(&guid_value, msg, &guid, + ndr_err = ndr_push_struct_blob(&guid_value, msg, + NULL, + &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; } - ndr_err = ndr_push_struct_blob(&nmd_value, msg, &nmd, + ndr_err = ndr_push_struct_blob(&nmd_value, msg, + lp_iconv_convenience(ldb_get_opaque(module->ldb, "loadparm")), + &nmd, (ndr_push_flags_fn_t)ndr_push_replPropertyMetaDataBlob); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(down_req); @@ -773,7 +778,9 @@ static int replmd_replicated_apply_add(struct replmd_replicated_request *ar) for (i=0; i < md->ctr.ctr1.count; i++) { md->ctr.ctr1.array[i].local_usn = seq_num; } - ndr_err = ndr_push_struct_blob(&md_value, msg, md, + ndr_err = ndr_push_struct_blob(&md_value, msg, + lp_iconv_convenience(global_loadparm), + 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); @@ -985,7 +992,9 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar) } /* create the meta data value */ - ndr_err = ndr_push_struct_blob(&nmd_value, msg, &nmd, + ndr_err = ndr_push_struct_blob(&nmd_value, msg, + lp_iconv_convenience(global_loadparm), + &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); @@ -1350,7 +1359,9 @@ static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *a if (!msg) return replmd_replicated_request_werror(ar, WERR_NOMEM); msg->dn = ar->sub.search_msg->dn; - ndr_err = ndr_push_struct_blob(&nuv_value, msg, &nuv, + ndr_err = ndr_push_struct_blob(&nuv_value, msg, + lp_iconv_convenience(global_loadparm), + &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); @@ -1437,7 +1448,9 @@ static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *a } /* we now fill the value which is already attached to ldb_message */ - ndr_err = ndr_push_struct_blob(nrf_value, msg, &nrf, + ndr_err = ndr_push_struct_blob(nrf_value, msg, + lp_iconv_convenience(global_loadparm), + &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); diff --git a/source4/dsdb/samdb/ldb_modules/samba3sam.c b/source4/dsdb/samdb/ldb_modules/samba3sam.c index 0d4fead2b5..c8266a5f46 100644 --- a/source4/dsdb/samdb/ldb_modules/samba3sam.c +++ b/source4/dsdb/samdb/ldb_modules/samba3sam.c @@ -187,8 +187,9 @@ static struct ldb_val encode_sid(struct ldb_module *module, TALLOC_CTX *ctx, con return out; } - ndr_err = ndr_push_struct_blob(&out, ctx, sid, - (ndr_push_flags_fn_t)ndr_push_dom_sid); + ndr_err = ndr_push_struct_blob(&out, ctx, + NULL, + sid, (ndr_push_flags_fn_t)ndr_push_dom_sid); talloc_free(sid); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return out; diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index 3638b91799..8a80260a69 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -50,7 +50,7 @@ static bool samldb_msg_add_sid(struct ldb_module *module, struct ldb_message *ms struct ldb_val v; enum ndr_err_code ndr_err; - ndr_err = ndr_push_struct_blob(&v, msg, sid, + ndr_err = ndr_push_struct_blob(&v, msg, NULL, sid, (ndr_push_flags_fn_t)ndr_push_dom_sid); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return false; diff --git a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c index 7efcccc9ff..070ce6ae69 100644 --- a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c +++ b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c @@ -49,7 +49,7 @@ static struct ldb_val encode_guid(struct ldb_module *module, TALLOC_CTX *ctx, co if (!NT_STATUS_IS_OK(status)) { return out; } - ndr_err = ndr_push_struct_blob(&out, ctx, &guid, + ndr_err = ndr_push_struct_blob(&out, ctx, NULL, &guid, (ndr_push_flags_fn_t)ndr_push_GUID); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return out; @@ -93,7 +93,7 @@ static struct ldb_val encode_ns_guid(struct ldb_module *module, TALLOC_CTX *ctx, if (!NT_STATUS_IS_OK(status)) { return out; } - ndr_err = ndr_push_struct_blob(&out, ctx, &guid, + ndr_err = ndr_push_struct_blob(&out, ctx, NULL, &guid, (ndr_push_flags_fn_t)ndr_push_GUID); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return out; diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c index f15b03c9b4..80cd8040e4 100644 --- a/source4/dsdb/schema/schema_init.c +++ b/source4/dsdb/schema/schema_init.c @@ -174,7 +174,7 @@ WERROR dsdb_get_oid_mappings_ldb(const struct dsdb_schema *schema, pfm.reserved = 0; pfm.ctr.dsdb = *ctr; - ndr_err = ndr_push_struct_blob(prefixMap, mem_ctx, &pfm, + ndr_err = ndr_push_struct_blob(prefixMap, mem_ctx, lp_iconv_convenience(global_loadparm), &pfm, (ndr_push_flags_fn_t)ndr_push_prefixMapBlob); talloc_free(ctr); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c index a8fe4a3b9d..6490e8740f 100644 --- a/source4/dsdb/schema/schema_syntax.c +++ b/source4/dsdb/schema/schema_syntax.c @@ -898,8 +898,7 @@ static WERROR dsdb_syntax_DN_ldb_to_drsuapi(const struct dsdb_schema *schema, ZERO_STRUCT(id3); id3.dn = (const char *)in->values[i].data; - ndr_err = ndr_push_struct_blob(&blobs[i], blobs, &id3, - (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3); + ndr_err = ndr_push_struct_blob(&blobs[i], blobs, lp_iconv_convenience(global_loadparm), &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); @@ -998,7 +997,7 @@ static WERROR dsdb_syntax_DN_BINARY_ldb_to_drsuapi(const struct dsdb_schema *sch id3b.dn = (const char *)in->values[i].data; id3b.binary = data_blob(NULL, 0); - ndr_err = ndr_push_struct_blob(&blobs[i], blobs, &id3b, + ndr_err = ndr_push_struct_blob(&blobs[i], blobs, lp_iconv_convenience(global_loadparm), &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); diff --git a/source4/kdc/pac-glue.c b/source4/kdc/pac-glue.c index 32f96ee7ab..9f9b5454b4 100644 --- a/source4/kdc/pac-glue.c +++ b/source4/kdc/pac-glue.c @@ -73,7 +73,7 @@ static krb5_error_code make_pac(krb5_context context, logon_info.info->info3 = *info3; - ndr_err = ndr_push_struct_blob(&pac_out, mem_ctx, &logon_info, + ndr_err = ndr_push_struct_blob(&pac_out, mem_ctx, lp_iconv_convenience(global_loadparm), &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); diff --git a/source4/lib/ldb-samba/ldif_handlers.c b/source4/lib/ldb-samba/ldif_handlers.c index f8e3505655..30ca88264a 100644 --- a/source4/lib/ldb-samba/ldif_handlers.c +++ b/source4/lib/ldb-samba/ldif_handlers.c @@ -40,7 +40,7 @@ static int ldif_read_objectSid(struct ldb_context *ldb, void *mem_ctx, if (sid == NULL) { return -1; } - ndr_err = ndr_push_struct_blob(out, mem_ctx, sid, + ndr_err = ndr_push_struct_blob(out, mem_ctx, NULL, sid, (ndr_push_flags_fn_t)ndr_push_dom_sid); talloc_free(sid); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { @@ -147,7 +147,7 @@ static int ldif_read_objectGUID(struct ldb_context *ldb, void *mem_ctx, return -1; } - ndr_err = ndr_push_struct_blob(out, mem_ctx, &guid, + ndr_err = ndr_push_struct_blob(out, mem_ctx, NULL, &guid, (ndr_push_flags_fn_t)ndr_push_GUID); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return -1; @@ -252,7 +252,7 @@ static int ldif_read_ntSecurityDescriptor(struct ldb_context *ldb, void *mem_ctx if (sd == NULL) { return -1; } - ndr_err = ndr_push_struct_blob(out, mem_ctx, sd, + ndr_err = ndr_push_struct_blob(out, mem_ctx, NULL, sd, (ndr_push_flags_fn_t)ndr_push_security_descriptor); talloc_free(sd); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c index 28bd0ad461..7d2df182fe 100644 --- a/source4/lib/registry/regf.c +++ b/source4/lib/registry/regf.c @@ -1041,8 +1041,8 @@ static WERROR regf_set_sec_desc(struct hive_key *key, (tdr_pull_fn_t) tdr_pull_nk_block, &root); /* Push the security descriptor to a blob */ - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_struct_blob(&data, regf, sec_desc, - (ndr_push_flags_fn_t)ndr_push_security_descriptor))) { + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_struct_blob(&data, regf, NULL, + sec_desc, (ndr_push_flags_fn_t)ndr_push_security_descriptor))) { DEBUG(0, ("Unable to push security descriptor\n")); return WERR_GENERAL_FAILURE; } diff --git a/source4/libcli/dgram/browse.c b/source4/libcli/dgram/browse.c index ab831df8cc..d70cda02ee 100644 --- a/source4/libcli/dgram/browse.c +++ b/source4/libcli/dgram/browse.c @@ -38,7 +38,7 @@ NTSTATUS dgram_mailslot_browse_send(struct nbt_dgram_socket *dgmsock, DATA_BLOB blob; TALLOC_CTX *tmp_ctx = talloc_new(dgmsock); - ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, request, + ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, lp_iconv_convenience(global_loadparm), request, (ndr_push_flags_fn_t)ndr_push_nbt_browse_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(tmp_ctx); @@ -66,7 +66,7 @@ NTSTATUS dgram_mailslot_browse_reply(struct nbt_dgram_socket *dgmsock, struct nbt_name myname; struct socket_address *dest; - ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, reply, + ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, lp_iconv_convenience(global_loadparm), reply, (ndr_push_flags_fn_t)ndr_push_nbt_browse_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(tmp_ctx); diff --git a/source4/libcli/dgram/dgramsocket.c b/source4/libcli/dgram/dgramsocket.c index 1af252c0bf..cd3ac6630f 100644 --- a/source4/libcli/dgram/dgramsocket.c +++ b/source4/libcli/dgram/dgramsocket.c @@ -24,6 +24,7 @@ #include "lib/util/dlinklist.h" #include "libcli/dgram/libdgram.h" #include "lib/socket/socket.h" +#include "param/param.h" #include "librpc/gen_ndr/ndr_nbt.h" @@ -228,7 +229,7 @@ NTSTATUS nbt_dgram_send(struct nbt_dgram_socket *dgmsock, req->dest = dest; if (talloc_reference(req, dest) == NULL) goto failed; - ndr_err = ndr_push_struct_blob(&req->encoded, req, packet, + ndr_err = ndr_push_struct_blob(&req->encoded, req, lp_iconv_convenience(global_loadparm), packet, (ndr_push_flags_fn_t)ndr_push_nbt_dgram_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { status = ndr_map_error2ntstatus(ndr_err); diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 92a66cddff..161d48cbbc 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -40,7 +40,9 @@ NTSTATUS dgram_mailslot_netlogon_send(struct nbt_dgram_socket *dgmsock, DATA_BLOB blob; TALLOC_CTX *tmp_ctx = talloc_new(dgmsock); - ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, request, + ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, + lp_iconv_convenience(global_loadparm), + request, (ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(tmp_ctx); @@ -73,7 +75,9 @@ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, struct nbt_name myname; struct socket_address *dest; - ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, reply, + ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, + lp_iconv_convenience(global_loadparm), + reply, (ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(tmp_ctx); diff --git a/source4/libcli/dgram/ntlogon.c b/source4/libcli/dgram/ntlogon.c index 8cd69176a5..bbcfc1b2dc 100644 --- a/source4/libcli/dgram/ntlogon.c +++ b/source4/libcli/dgram/ntlogon.c @@ -41,7 +41,8 @@ NTSTATUS dgram_mailslot_ntlogon_send(struct nbt_dgram_socket *dgmsock, DATA_BLOB blob; TALLOC_CTX *tmp_ctx = talloc_new(dgmsock); - ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, request, + ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, lp_iconv_convenience(global_loadparm), + request, (ndr_push_flags_fn_t)ndr_push_nbt_ntlogon_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(tmp_ctx); @@ -74,7 +75,7 @@ NTSTATUS dgram_mailslot_ntlogon_reply(struct nbt_dgram_socket *dgmsock, struct nbt_name myname; struct socket_address *dest; - ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, reply, + ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, lp_iconv_convenience(global_loadparm), reply, (ndr_push_flags_fn_t)ndr_push_nbt_ntlogon_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(tmp_ctx); diff --git a/source4/libcli/ldap/ldap_ndr.c b/source4/libcli/ldap/ldap_ndr.c index 468c366c85..fde623bece 100644 --- a/source4/libcli/ldap/ldap_ndr.c +++ b/source4/libcli/ldap/ldap_ndr.c @@ -46,7 +46,7 @@ char *ldap_encode_ndr_dom_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid) DATA_BLOB blob; enum ndr_err_code ndr_err; char *ret; - ndr_err = ndr_push_struct_blob(&blob, mem_ctx, sid, + ndr_err = ndr_push_struct_blob(&blob, mem_ctx, NULL, sid, (ndr_push_flags_fn_t)ndr_push_dom_sid); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return NULL; @@ -65,7 +65,7 @@ char *ldap_encode_ndr_GUID(TALLOC_CTX *mem_ctx, struct GUID *guid) DATA_BLOB blob; enum ndr_err_code ndr_err; char *ret; - ndr_err = ndr_push_struct_blob(&blob, mem_ctx, guid, + ndr_err = ndr_push_struct_blob(&blob, mem_ctx, NULL, guid, (ndr_push_flags_fn_t)ndr_push_GUID); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return NULL; diff --git a/source4/libcli/nbt/nbtname.c b/source4/libcli/nbt/nbtname.c index bdcd012556..079d0595de 100644 --- a/source4/libcli/nbt/nbtname.c +++ b/source4/libcli/nbt/nbtname.c @@ -27,6 +27,7 @@ #include "librpc/gen_ndr/ndr_nbt.h" #include "librpc/gen_ndr/ndr_misc.h" #include "system/locale.h" +#include "param/param.h" /* don't allow an unlimited number of name components */ #define MAX_COMPONENTS 10 @@ -384,8 +385,7 @@ _PUBLIC_ NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct { 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); + ndr_err = ndr_push_struct_blob(blob, mem_ctx, lp_iconv_convenience(global_loadparm), name, (ndr_push_flags_fn_t)ndr_push_nbt_name); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return ndr_map_error2ntstatus(ndr_err); } diff --git a/source4/libcli/nbt/nbtsocket.c b/source4/libcli/nbt/nbtsocket.c index 743f2b0f19..3716d40941 100644 --- a/source4/libcli/nbt/nbtsocket.c +++ b/source4/libcli/nbt/nbtsocket.c @@ -394,7 +394,9 @@ struct nbt_name_request *nbt_name_request_send(struct nbt_name_socket *nbtsock, talloc_set_destructor(req, nbt_name_request_destructor); - ndr_err = ndr_push_struct_blob(&req->encoded, req, request, + ndr_err = ndr_push_struct_blob(&req->encoded, req, + lp_iconv_convenience(global_loadparm), + request, (ndr_push_flags_fn_t)ndr_push_nbt_name_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) goto failed; @@ -441,7 +443,9 @@ NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock, NDR_PRINT_DEBUG(nbt_name_packet, request); } - ndr_err = ndr_push_struct_blob(&req->encoded, req, request, + ndr_err = ndr_push_struct_blob(&req->encoded, req, + lp_iconv_convenience(global_loadparm), + request, (ndr_push_flags_fn_t)ndr_push_nbt_name_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(req); diff --git a/source4/libcli/raw/rawfile.c b/source4/libcli/raw/rawfile.c index c34cb9c52f..3b6ca68526 100644 --- a/source4/libcli/raw/rawfile.c +++ b/source4/libcli/raw/rawfile.c @@ -276,7 +276,7 @@ static struct smbcli_request *smb_raw_nttrans_create_send(struct smbcli_tree *tr if (parms->ntcreatex.in.sec_desc) { enum ndr_err_code ndr_err; - ndr_err = ndr_push_struct_blob(&sd_blob, mem_ctx, + ndr_err = ndr_push_struct_blob(&sd_blob, mem_ctx, NULL, parms->ntcreatex.in.sec_desc, (ndr_push_flags_fn_t)ndr_push_security_descriptor); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { diff --git a/source4/libcli/raw/rawsetfileinfo.c b/source4/libcli/raw/rawsetfileinfo.c index 67dadf3287..a9a1a3547e 100644 --- a/source4/libcli/raw/rawsetfileinfo.c +++ b/source4/libcli/raw/rawsetfileinfo.c @@ -88,7 +88,7 @@ bool smb_raw_setfileinfo_passthru(TALLOC_CTX *mem_ctx, case RAW_FILEINFO_SEC_DESC: { enum ndr_err_code ndr_err; - ndr_err = ndr_push_struct_blob(blob, mem_ctx, + ndr_err = ndr_push_struct_blob(blob, mem_ctx, NULL, parms->set_secdesc.in.sd, (ndr_push_flags_fn_t)ndr_push_security_descriptor); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { diff --git a/source4/libcli/wrepl/winsrepl.c b/source4/libcli/wrepl/winsrepl.c index 63b0a60f6c..381df902b4 100644 --- a/source4/libcli/wrepl/winsrepl.c +++ b/source4/libcli/wrepl/winsrepl.c @@ -494,7 +494,7 @@ struct wrepl_request *wrepl_request_send(struct wrepl_socket *wrepl_socket, } wrap.packet = *packet; - ndr_err = ndr_push_struct_blob(&blob, req, &wrap, + ndr_err = ndr_push_struct_blob(&blob, req, lp_iconv_convenience(global_loadparm), &wrap, (ndr_push_flags_fn_t)ndr_push_wrepl_wrap); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { status = ndr_map_error2ntstatus(ndr_err); diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c index 4d09422bec..e51a2feadf 100644 --- a/source4/libnet/libnet_become_dc.c +++ b/source4/libnet/libnet_become_dc.c @@ -1785,7 +1785,7 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s) NULL); if (composite_nomem(v, c)) return; - ndr_err = ndr_push_struct_blob(&vd[0], vd, v,(ndr_push_flags_fn_t)ndr_push_security_descriptor); + ndr_err = ndr_push_struct_blob(&vd[0], vd, NULL, 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; @@ -1844,7 +1844,7 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s) s->forest.schema_dn_str); if (composite_nomem(v[0].dn, c)) return; - ndr_err = ndr_push_struct_blob(&vd[0], vd, &v[0], + ndr_err = ndr_push_struct_blob(&vd[0], vd, NULL, &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); @@ -1874,7 +1874,7 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s) v = &s->dest_dsa.invocation_id; - ndr_err = ndr_push_struct_blob(&vd[0], vd, v, (ndr_push_flags_fn_t)ndr_push_GUID); + ndr_err = ndr_push_struct_blob(&vd[0], vd, NULL, 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; @@ -1913,21 +1913,21 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s) v[2].sid = s->zero_sid; v[2].dn = s->forest.schema_dn_str; - ndr_err = ndr_push_struct_blob(&vd[0], vd, &v[0], + ndr_err = ndr_push_struct_blob(&vd[0], vd, NULL, &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; } - ndr_err = ndr_push_struct_blob(&vd[1], vd, &v[1], + ndr_err = ndr_push_struct_blob(&vd[1], vd, NULL, &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; } - ndr_err = ndr_push_struct_blob(&vd[2], vd, &v[2], + ndr_err = ndr_push_struct_blob(&vd[2], vd, NULL, &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); @@ -1969,21 +1969,21 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s) v[2].sid = s->zero_sid; v[2].dn = s->forest.schema_dn_str; - ndr_err = ndr_push_struct_blob(&vd[0], vd, &v[0], + ndr_err = ndr_push_struct_blob(&vd[0], vd, NULL, &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; } - ndr_err = ndr_push_struct_blob(&vd[1], vd, &v[1], + ndr_err = ndr_push_struct_blob(&vd[1], vd, NULL, &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; } - ndr_err = ndr_push_struct_blob(&vd[2], vd, &v[2], + ndr_err = ndr_push_struct_blob(&vd[2], vd, NULL, &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); @@ -2017,7 +2017,7 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s) v[0].sid = s->zero_sid; v[0].dn = s->forest.schema_dn_str; - ndr_err = ndr_push_struct_blob(&vd[0], vd, &v[0], + ndr_err = ndr_push_struct_blob(&vd[0], vd, lp_iconv_convenience(global_loadparm), &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); @@ -2049,7 +2049,7 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s) v[0].sid = s->zero_sid; v[0].dn = s->domain.dn_str; - ndr_err = ndr_push_struct_blob(&vd[0], vd, &v[0], + ndr_err = ndr_push_struct_blob(&vd[0], vd, lp_iconv_convenience(global_loadparm), &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); @@ -2131,7 +2131,7 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s) v[0].sid = s->zero_sid; v[0].dn = s->dest_dsa.computer_dn_str; - ndr_err = ndr_push_struct_blob(&vd[0], vd, &v[0], + ndr_err = ndr_push_struct_blob(&vd[0], vd, lp_iconv_convenience(global_loadparm), &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); diff --git a/source4/libnet/libnet_samsync_ldb.c b/source4/libnet/libnet_samsync_ldb.c index 23cfe630d5..a60b05189b 100644 --- a/source4/libnet/libnet_samsync_ldb.c +++ b/source4/libnet/libnet_samsync_ldb.c @@ -168,7 +168,8 @@ static NTSTATUS samsync_ldb_handle_domain(TALLOC_CTX *mem_ctx, if (state->samsync_state->domain_guid) { enum ndr_err_code ndr_err; struct ldb_val v; - ndr_err = ndr_push_struct_blob(&v, msg, state->samsync_state->domain_guid, + ndr_err = ndr_push_struct_blob(&v, msg, NULL, + state->samsync_state->domain_guid, (ndr_push_flags_fn_t)ndr_push_GUID); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { *error_string = talloc_asprintf(mem_ctx, "ndr_push of domain GUID failed!"); diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index 0dafda7086..fc1a5750dd 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -755,11 +755,10 @@ _PUBLIC_ enum ndr_err_code ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC /* push a struct to a blob using NDR */ -_PUBLIC_ enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p, - ndr_push_flags_fn_t fn) +_PUBLIC_ enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, const void *p, ndr_push_flags_fn_t fn) { struct ndr_push *ndr; - ndr = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm)); + ndr = ndr_push_init_ctx(mem_ctx, iconv_convenience); NDR_ERR_HAVE_NO_MEMORY(ndr); NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p)); diff --git a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c index 4e6586db65..f311966422 100644 --- a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c +++ b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c @@ -175,7 +175,7 @@ static WERROR sptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC os.build = dcesrv_common_get_version_build(mem_ctx, server->ntptr->lp_ctx); os.extra_string = ""; - ndr_err = ndr_push_struct_blob(&blob, mem_ctx, &os, (ndr_push_flags_fn_t)ndr_push_spoolss_OSVersion); + ndr_err = ndr_push_struct_blob(&blob, mem_ctx, lp_iconv_convenience(global_loadparm), &os, (ndr_push_flags_fn_t)ndr_push_spoolss_OSVersion); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return WERR_GENERAL_FAILURE; } @@ -195,7 +195,7 @@ static WERROR sptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC os_ex.unknown2 = 0; os_ex.unknown3 = 0; - ndr_err = ndr_push_struct_blob(&blob, mem_ctx, &os_ex, (ndr_push_flags_fn_t)ndr_push_spoolss_OSVersionEx); + ndr_err = ndr_push_struct_blob(&blob, mem_ctx, lp_iconv_convenience(global_loadparm), &os_ex, (ndr_push_flags_fn_t)ndr_push_spoolss_OSVersionEx); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return WERR_GENERAL_FAILURE; } diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c index 8bbf2d04b3..ad0a55da79 100644 --- a/source4/ntvfs/common/notify.c +++ b/source4/ntvfs/common/notify.c @@ -219,7 +219,7 @@ static NTSTATUS notify_save(struct notify_context *notify) tmp_ctx = talloc_new(notify); NT_STATUS_HAVE_NO_MEMORY(tmp_ctx); - ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, notify->array, + ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, lp_iconv_convenience(global_loadparm), notify->array, (ndr_push_flags_fn_t)ndr_push_notify_array); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(tmp_ctx); @@ -554,8 +554,7 @@ static void notify_send(struct notify_context *notify, struct notify_entry *e, tmp_ctx = talloc_new(notify); - ndr_err = ndr_push_struct_blob(&data, tmp_ctx, &ev, - (ndr_push_flags_fn_t)ndr_push_notify_event); + ndr_err = ndr_push_struct_blob(&data, tmp_ctx, lp_iconv_convenience(global_loadparm), &ev, (ndr_push_flags_fn_t)ndr_push_notify_event); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(tmp_ctx); return; diff --git a/source4/ntvfs/common/opendb_tdb.c b/source4/ntvfs/common/opendb_tdb.c index 41b5ad2ebe..7408f3a3df 100644 --- a/source4/ntvfs/common/opendb_tdb.c +++ b/source4/ntvfs/common/opendb_tdb.c @@ -233,7 +233,7 @@ static NTSTATUS odb_push_record(struct odb_lock *lck, struct opendb_file *file) return NT_STATUS_OK; } - ndr_err = ndr_push_struct_blob(&blob, lck, file, (ndr_push_flags_fn_t)ndr_push_opendb_file); + ndr_err = ndr_push_struct_blob(&blob, lck, lp_iconv_convenience(global_loadparm), file, (ndr_push_flags_fn_t)ndr_push_opendb_file); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return ndr_map_error2ntstatus(ndr_err); } diff --git a/source4/ntvfs/posix/pvfs_xattr.c b/source4/ntvfs/posix/pvfs_xattr.c index f723aad955..c0a04b4099 100644 --- a/source4/ntvfs/posix/pvfs_xattr.c +++ b/source4/ntvfs/posix/pvfs_xattr.c @@ -23,6 +23,7 @@ #include "vfs_posix.h" #include "lib/util/unix_privs.h" #include "librpc/gen_ndr/ndr_xattr.h" +#include "param/param.h" /* pull a xattr as a blob @@ -138,7 +139,7 @@ _PUBLIC_ NTSTATUS pvfs_xattr_ndr_save(struct pvfs_state *pvfs, NTSTATUS status; enum ndr_err_code ndr_err; - ndr_err = ndr_push_struct_blob(&blob, mem_ctx, p, (ndr_push_flags_fn_t)push_fn); + ndr_err = ndr_push_struct_blob(&blob, mem_ctx, lp_iconv_convenience(global_loadparm), p, (ndr_push_flags_fn_t)push_fn); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(mem_ctx); return ndr_map_error2ntstatus(ndr_err); diff --git a/source4/smb_server/blob.c b/source4/smb_server/blob.c index 21cddc4d7d..2b870118ba 100644 --- a/source4/smb_server/blob.c +++ b/source4/smb_server/blob.c @@ -278,7 +278,7 @@ NTSTATUS smbsrv_push_passthru_fsinfo(TALLOC_CTX *mem_ctx, BLOB_CHECK(smbsrv_blob_grow_data(mem_ctx, blob, 64)); - ndr_err = ndr_push_struct_blob(&guid_blob, mem_ctx, + ndr_err = ndr_push_struct_blob(&guid_blob, mem_ctx, NULL, &fsinfo->objectid_information.out.guid, (ndr_push_flags_fn_t)ndr_push_GUID); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { diff --git a/source4/smb_server/smb/nttrans.c b/source4/smb_server/smb/nttrans.c index 34f9df8706..279da73185 100644 --- a/source4/smb_server/smb/nttrans.c +++ b/source4/smb_server/smb/nttrans.c @@ -204,7 +204,7 @@ static NTSTATUS nttrans_query_sec_desc_send(struct nttrans_op *op) NT_STATUS_NOT_OK_RETURN(status); params = op->trans->out.params.data; - ndr_err = ndr_push_struct_blob(&op->trans->out.data, op, + ndr_err = ndr_push_struct_blob(&op->trans->out.data, op, NULL, io->query_secdesc.out.sd, (ndr_push_flags_fn_t)ndr_push_security_descriptor); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { diff --git a/source4/smb_server/smb2/fileinfo.c b/source4/smb_server/smb2/fileinfo.c index 8715279dad..bbd784bf8f 100644 --- a/source4/smb_server/smb2/fileinfo.c +++ b/source4/smb_server/smb2/fileinfo.c @@ -145,7 +145,7 @@ static NTSTATUS smb2srv_getinfo_security_send(struct smb2srv_getinfo_op *op) union smb_fileinfo *io = talloc_get_type(op->io_ptr, union smb_fileinfo); enum ndr_err_code ndr_err; - ndr_err = ndr_push_struct_blob(&op->info->out.blob, op->req, + ndr_err = ndr_push_struct_blob(&op->info->out.blob, op->req, NULL, io->query_secdesc.out.sd, (ndr_push_flags_fn_t)ndr_push_security_descriptor); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { diff --git a/source4/torture/rpc/autoidl.c b/source4/torture/rpc/autoidl.c index 6dde3ed642..71965397f6 100644 --- a/source4/torture/rpc/autoidl.c +++ b/source4/torture/rpc/autoidl.c @@ -82,7 +82,7 @@ static void fill_blob_handle(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, return; } - ndr_push_struct_blob(&b2, mem_ctx, handle, (ndr_push_flags_fn_t)ndr_push_policy_handle); + ndr_push_struct_blob(&b2, mem_ctx, NULL, handle, (ndr_push_flags_fn_t)ndr_push_policy_handle); memcpy(blob->data, b2.data, 20); } diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c index 45954f2c71..72435f8054 100644 --- a/source4/torture/rpc/winreg.c +++ b/source4/torture/rpc/winreg.c @@ -156,7 +156,7 @@ static bool test_CreateKey_sd(struct dcerpc_pipe *p, NULL); torture_assert_ndr_success(tctx, - ndr_push_struct_blob(&sdblob, tctx, sd, + ndr_push_struct_blob(&sdblob, tctx, NULL, sd, (ndr_push_flags_fn_t)ndr_push_security_descriptor), "Failed to push security_descriptor ?!\n"); @@ -265,7 +265,7 @@ static bool _test_SetKeySecurity(struct dcerpc_pipe *p, } torture_assert_ndr_success(tctx, - ndr_push_struct_blob(&sdblob, tctx, sd, + ndr_push_struct_blob(&sdblob, tctx, NULL, sd, (ndr_push_flags_fn_t)ndr_push_security_descriptor), "push_security_descriptor failed"); diff --git a/source4/winbind/wb_pam_auth.c b/source4/winbind/wb_pam_auth.c index c8e81e09f2..a34f3fbdd0 100644 --- a/source4/winbind/wb_pam_auth.c +++ b/source4/winbind/wb_pam_auth.c @@ -143,7 +143,8 @@ static void pam_auth_crap_recv_logon(struct composite_context *ctx) if (!composite_is_ok(state->ctx)) return; ndr_err = ndr_push_struct_blob( - &tmp_blob, state, state->req->out.validation.sam3, + &tmp_blob, state, lp_iconv_convenience(global_loadparm), + state->req->out.validation.sam3, (ndr_push_flags_fn_t)ndr_push_netr_SamInfo3); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { state->ctx->status = ndr_map_error2ntstatus(ndr_err); diff --git a/source4/wrepl_server/wrepl_in_connection.c b/source4/wrepl_server/wrepl_in_connection.c index 4d834a6a5a..f9a2e30ed7 100644 --- a/source4/wrepl_server/wrepl_in_connection.c +++ b/source4/wrepl_server/wrepl_in_connection.c @@ -88,7 +88,9 @@ static NTSTATUS wreplsrv_recv_request(void *private, DATA_BLOB blob) /* and now encode the reply */ packet_out_wrap.packet = call->rep_packet; - ndr_err = ndr_push_struct_blob(&packet_out_blob, call, &packet_out_wrap, + ndr_err = ndr_push_struct_blob(&packet_out_blob, call, + lp_iconv_convenience(global_loadparm), + &packet_out_wrap, (ndr_push_flags_fn_t)ndr_push_wrepl_wrap); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return ndr_map_error2ntstatus(ndr_err); |