diff options
50 files changed, 150 insertions, 103 deletions
diff --git a/source4/auth/auth_winbind.c b/source4/auth/auth_winbind.c index c002428581..bfbcbbfd5d 100644 --- a/source4/auth/auth_winbind.c +++ b/source4/auth/auth_winbind.c @@ -27,6 +27,7 @@ #include "librpc/gen_ndr/ndr_netlogon.h" #include "librpc/gen_ndr/ndr_winbind.h" #include "lib/messaging/irpc.h" +#include "param/param.h" static NTSTATUS get_info3_from_ndr(TALLOC_CTX *mem_ctx, struct winbindd_response *response, struct netr_SamInfo3 *info3) { @@ -37,8 +38,9 @@ static NTSTATUS get_info3_from_ndr(TALLOC_CTX *mem_ctx, struct winbindd_response blob.length = len - 4; blob.data = (uint8_t *)(((char *)response->extra_data.data) + 4); - ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, info3, - (ndr_pull_flags_fn_t)ndr_pull_netr_SamInfo3); + ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, + lp_iconv_convenience(global_loadparm), info3, + (ndr_pull_flags_fn_t)ndr_pull_netr_SamInfo3); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return ndr_map_error2ntstatus(ndr_err); } diff --git a/source4/auth/gensec/schannel.c b/source4/auth/gensec/schannel.c index f37a29032a..42db959380 100644 --- a/source4/auth/gensec/schannel.c +++ b/source4/auth/gensec/schannel.c @@ -103,8 +103,10 @@ static NTSTATUS schannel_update(struct gensec_security *gensec_security, TALLOC_ } /* parse the schannel startup blob */ - ndr_err = ndr_pull_struct_blob(&in, out_mem_ctx, &bind_schannel, - (ndr_pull_flags_fn_t)ndr_pull_schannel_bind); + ndr_err = ndr_pull_struct_blob(&in, out_mem_ctx, + lp_iconv_convenience(gensec_security->lp_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", diff --git a/source4/auth/kerberos/kerberos_pac.c b/source4/auth/kerberos/kerberos_pac.c index 705f66a64b..d345ea969a 100644 --- a/source4/auth/kerberos/kerberos_pac.c +++ b/source4/auth/kerberos/kerberos_pac.c @@ -113,8 +113,9 @@ static krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - ndr_err = ndr_pull_struct_blob(&blob, pac_data, pac_data, - (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA); + ndr_err = ndr_pull_struct_blob(&blob, pac_data, + iconv_convenience, 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", @@ -128,7 +129,8 @@ static krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, return NT_STATUS_INVALID_PARAMETER; } - ndr_err = ndr_pull_struct_blob(&blob, pac_data_raw, pac_data_raw, + ndr_err = ndr_pull_struct_blob(&blob, pac_data_raw, + iconv_convenience, 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); @@ -208,7 +210,8 @@ static krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, /* 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 */ - ndr_err = ndr_pull_struct_blob(kdc_sig_blob, kdc_sig_wipe, kdc_sig_wipe, + ndr_err = ndr_pull_struct_blob(kdc_sig_blob, kdc_sig_wipe, + iconv_convenience, 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); @@ -217,7 +220,8 @@ static krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx, return status; } - ndr_err = ndr_pull_struct_blob(srv_sig_blob, srv_sig_wipe, srv_sig_wipe, + ndr_err = ndr_pull_struct_blob(srv_sig_blob, srv_sig_wipe, + iconv_convenience, 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); diff --git a/source4/cluster/ctdb/opendb_ctdb.c b/source4/cluster/ctdb/opendb_ctdb.c index 4972dab0cf..fe5917bc69 100644 --- a/source4/cluster/ctdb/opendb_ctdb.c +++ b/source4/cluster/ctdb/opendb_ctdb.c @@ -205,7 +205,7 @@ static NTSTATUS odb_pull_record(struct odb_lock *lck, struct opendb_file *file) blob.data = dbuf.dptr; blob.length = dbuf.dsize; - ndr_err = ndr_pull_struct_blob(&blob, lck, file, (ndr_pull_flags_fn_t)ndr_pull_opendb_file); + ndr_err = ndr_pull_struct_blob(&blob, lck, lp_iconv_convenience(global_loadparm), file, (ndr_pull_flags_fn_t)ndr_pull_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 ea623a3d4a..345f13fcbc 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -376,7 +376,7 @@ struct dom_sid *samdb_result_dom_sid(TALLOC_CTX *mem_ctx, const struct ldb_messa if (sid == NULL) { return NULL; } - ndr_err = ndr_pull_struct_blob(v, sid, sid, + ndr_err = ndr_pull_struct_blob(v, sid, NULL, sid, (ndr_pull_flags_fn_t)ndr_pull_dom_sid); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(sid); @@ -402,7 +402,7 @@ struct GUID samdb_result_guid(const struct ldb_message *msg, const char *attr) mem_ctx = talloc_named_const(NULL, 0, "samdb_result_guid"); if (!mem_ctx) return guid; - ndr_err = ndr_pull_struct_blob(v, mem_ctx, &guid, + ndr_err = ndr_pull_struct_blob(v, mem_ctx, NULL, &guid, (ndr_pull_flags_fn_t)ndr_pull_GUID); talloc_free(mem_ctx); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { diff --git a/source4/dsdb/repl/drepl_partitions.c b/source4/dsdb/repl/drepl_partitions.c index 8c0d8e5897..1839520b34 100644 --- a/source4/dsdb/repl/drepl_partitions.c +++ b/source4/dsdb/repl/drepl_partitions.c @@ -31,6 +31,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" static WERROR dreplsrv_refresh_partitions(struct dreplsrv_service *s); @@ -155,7 +156,8 @@ static WERROR dreplsrv_partition_add_source_dsa(struct dreplsrv_service *s, source = talloc_zero(p, struct dreplsrv_partition_source_dsa); W_ERROR_HAVE_NO_MEMORY(source); - ndr_err = ndr_pull_struct_blob(val, source, &source->_repsFromBlob, + ndr_err = ndr_pull_struct_blob(val, source, + lp_iconv_convenience(global_loadparm), &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); @@ -221,7 +223,8 @@ static WERROR dreplsrv_refresh_partition(struct dreplsrv_service *s, ouv_value = ldb_msg_find_ldb_val(r->msgs[0], "replUpToDateVector"); if (ouv_value) { enum ndr_err_code ndr_err; - ndr_err = ndr_pull_struct_blob(ouv_value, mem_ctx, &ouv, + ndr_err = ndr_pull_struct_blob(ouv_value, mem_ctx, + lp_iconv_convenience(global_loadparm), &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); diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c index a69459cfef..61bd391d67 100644 --- a/source4/dsdb/samdb/ldb_modules/password_hash.c +++ b/source4/dsdb/samdb/ldb_modules/password_hash.c @@ -473,7 +473,7 @@ static int setup_primary_kerberos(struct setup_password_fields_io *io, talloc_steal(io->ac, blob.data); /* TODO: use ndr_pull_struct_blob_all(), when the ndr layer handles it correct with relative pointers */ - ndr_err = ndr_pull_struct_blob(&blob, io->ac, &_old_pkb, + ndr_err = ndr_pull_struct_blob(&blob, io->ac, lp_iconv_convenience(global_loadparm), &_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); @@ -880,7 +880,7 @@ static int setup_supplemental_field(struct setup_password_fields_io *io) /* if there's an old supplementaCredentials blob then parse it */ if (io->o.supplemental) { - ndr_err = ndr_pull_struct_blob_all(io->o.supplemental, io->ac, &_old_scb, + ndr_err = ndr_pull_struct_blob_all(io->o.supplemental, io->ac, lp_iconv_convenience(ldb_get_opaque(io->ac->module->ldb, "loadparm")), &_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); diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 87b9302139..55b7b18d89 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -909,7 +909,8 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar) /* find existing meta data */ omd_value = ldb_msg_find_ldb_val(ar->sub.search_msg, "replPropertyMetaData"); if (omd_value) { - ndr_err = ndr_pull_struct_blob(omd_value, ar->sub.mem_ctx, &omd, + ndr_err = ndr_pull_struct_blob(omd_value, ar->sub.mem_ctx, + lp_iconv_convenience(ldb_get_opaque(ar->module->ldb, "loadparm")), &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); @@ -1234,7 +1235,8 @@ static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *a */ ouv_value = ldb_msg_find_ldb_val(ar->sub.search_msg, "replUpToDateVector"); if (ouv_value) { - ndr_err = ndr_pull_struct_blob(ouv_value, ar->sub.mem_ctx, &ouv, + ndr_err = ndr_pull_struct_blob(ouv_value, ar->sub.mem_ctx, + lp_iconv_convenience(ldb_get_opaque(ar->module->ldb, "loadparm")), &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); @@ -1398,7 +1400,7 @@ static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *a trf = talloc(ar->sub.mem_ctx, struct repsFromToBlob); if (!trf) return replmd_replicated_request_werror(ar, WERR_NOMEM); - ndr_err = ndr_pull_struct_blob(&orf_el->values[i], trf, trf, + ndr_err = ndr_pull_struct_blob(&orf_el->values[i], trf, lp_iconv_convenience(ldb_get_opaque(ar->module->ldb, "loadparm")), 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); diff --git a/source4/dsdb/samdb/ldb_modules/samba3sam.c b/source4/dsdb/samdb/ldb_modules/samba3sam.c index c8266a5f46..0bfc9a3dae 100644 --- a/source4/dsdb/samdb/ldb_modules/samba3sam.c +++ b/source4/dsdb/samdb/ldb_modules/samba3sam.c @@ -97,7 +97,7 @@ static void generate_sambaPrimaryGroupSID(struct ldb_module *module, const char return; } - ndr_err = ndr_pull_struct_blob(sidval, sid, sid, (ndr_pull_flags_fn_t)ndr_pull_dom_sid); + ndr_err = ndr_pull_struct_blob(sidval, sid, NULL, sid, (ndr_pull_flags_fn_t)ndr_pull_dom_sid); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(sid); return; @@ -210,7 +210,7 @@ static struct ldb_val decode_sid(struct ldb_module *module, TALLOC_CTX *ctx, con return out; } - ndr_err = ndr_pull_struct_blob(val, sid, sid, + ndr_err = ndr_pull_struct_blob(val, sid, NULL, sid, (ndr_pull_flags_fn_t)ndr_pull_dom_sid); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { goto done; diff --git a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c index 070ce6ae69..91001d43d7 100644 --- a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c +++ b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c @@ -71,7 +71,7 @@ static struct ldb_val guid_always_string(struct ldb_module *module, TALLOC_CTX * if (guid == NULL) { return out; } - ndr_err = ndr_pull_struct_blob(val, guid, guid, + ndr_err = ndr_pull_struct_blob(val, guid, NULL, guid, (ndr_pull_flags_fn_t)ndr_pull_GUID); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(guid); @@ -116,7 +116,7 @@ static struct ldb_val guid_ns_string(struct ldb_module *module, TALLOC_CTX *ctx, if (guid_p == NULL) { return out; } - ndr_err = ndr_pull_struct_blob(val, guid_p, guid_p, + ndr_err = ndr_pull_struct_blob(val, guid_p, NULL, guid_p, (ndr_pull_flags_fn_t)ndr_pull_GUID); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(guid_p); diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c index 80cd8040e4..3dd81fb822 100644 --- a/source4/dsdb/schema/schema_init.c +++ b/source4/dsdb/schema/schema_init.c @@ -85,7 +85,7 @@ WERROR dsdb_load_oid_mappings_ldb(struct dsdb_schema *schema, struct prefixMapBlob pfm; char *schema_info; - ndr_err = ndr_pull_struct_blob(prefixMap, schema, &pfm, + ndr_err = ndr_pull_struct_blob(prefixMap, schema, lp_iconv_convenience(global_loadparm), &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); @@ -658,7 +658,7 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb struct drsuapi_DsReplicaObjectIdentifier3 _id3; \ enum ndr_err_code _ndr_err; \ _ndr_err = ndr_pull_struct_blob_all(_a->value_ctr.values[0].blob, \ - mem_ctx, &_id3,\ + mem_ctx, lp_iconv_convenience(global_loadparm), &_id3,\ (ndr_pull_flags_fn_t)ndr_pull_drsuapi_DsReplicaObjectIdentifier3);\ if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \ NTSTATUS _nt_status = ndr_map_error2ntstatus(_ndr_err); \ @@ -720,7 +720,7 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb && _a->value_ctr.values[0].blob->length == 16) { \ enum ndr_err_code _ndr_err; \ _ndr_err = ndr_pull_struct_blob_all(_a->value_ctr.values[0].blob, \ - mem_ctx, &(p)->elem, \ + mem_ctx, lp_iconv_convenience(global_loadparm), &(p)->elem, \ (ndr_pull_flags_fn_t)ndr_pull_GUID); \ if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \ NTSTATUS _nt_status = ndr_map_error2ntstatus(_ndr_err); \ diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c index 6490e8740f..b956441793 100644 --- a/source4/dsdb/schema/schema_syntax.c +++ b/source4/dsdb/schema/schema_syntax.c @@ -851,7 +851,7 @@ static WERROR dsdb_syntax_DN_drsuapi_to_ldb(const struct dsdb_schema *schema, } ndr_err = ndr_pull_struct_blob_all(in->value_ctr.values[i].blob, - out->values, &id3, + out->values, lp_iconv_convenience(global_loadparm), &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); @@ -939,7 +939,8 @@ static WERROR dsdb_syntax_DN_BINARY_drsuapi_to_ldb(const struct dsdb_schema *sch } ndr_err = ndr_pull_struct_blob_all(in->value_ctr.values[i].blob, - out->values, &id3b, + out->values, + lp_iconv_convenience(global_loadparm), &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); diff --git a/source4/kdc/hdb-ldb.c b/source4/kdc/hdb-ldb.c index 234efd9b48..51726a03c3 100644 --- a/source4/kdc/hdb-ldb.c +++ b/source4/kdc/hdb-ldb.c @@ -213,7 +213,7 @@ static krb5_error_code LDB_message2entry_keys(krb5_context context, /* supplementalCredentials if present */ if (sc_val) { - ndr_err = ndr_pull_struct_blob_all(sc_val, mem_ctx, &scb, + ndr_err = ndr_pull_struct_blob_all(sc_val, mem_ctx, lp_iconv_convenience(global_loadparm), &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); @@ -250,7 +250,7 @@ static krb5_error_code LDB_message2entry_keys(krb5_context context, talloc_steal(mem_ctx, blob.data); /* TODO: use ndr_pull_struct_blob_all(), when the ndr layer handles it correct with relative pointers */ - ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &_pkb, + ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, lp_iconv_convenience(global_loadparm), &_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"); diff --git a/source4/kdc/pac-glue.c b/source4/kdc/pac-glue.c index 9f9b5454b4..5f3a718abd 100644 --- a/source4/kdc/pac-glue.c +++ b/source4/kdc/pac-glue.c @@ -190,7 +190,7 @@ krb5_error_code samba_kdc_reget_pac(void *priv, krb5_context context, return ENOMEM; } - ndr_err = ndr_pull_struct_blob(&pac_in, mem_ctx, &logon_info, + ndr_err = ndr_pull_struct_blob(&pac_in, mem_ctx, lp_iconv_convenience(global_loadparm), &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); diff --git a/source4/lib/ldb-samba/ldif_handlers.c b/source4/lib/ldb-samba/ldif_handlers.c index 30ca88264a..5c29d001c2 100644 --- a/source4/lib/ldb-samba/ldif_handlers.c +++ b/source4/lib/ldb-samba/ldif_handlers.c @@ -62,7 +62,7 @@ static int ldif_write_objectSid(struct ldb_context *ldb, void *mem_ctx, if (sid == NULL) { return -1; } - ndr_err = ndr_pull_struct_blob(in, sid, sid, + ndr_err = ndr_pull_struct_blob(in, sid, NULL, sid, (ndr_pull_flags_fn_t)ndr_pull_dom_sid); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(sid); @@ -163,7 +163,7 @@ static int ldif_write_objectGUID(struct ldb_context *ldb, void *mem_ctx, { struct GUID guid; enum ndr_err_code ndr_err; - ndr_err = ndr_pull_struct_blob(in, mem_ctx, &guid, + ndr_err = ndr_pull_struct_blob(in, mem_ctx, NULL, &guid, (ndr_pull_flags_fn_t)ndr_pull_GUID); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return -1; @@ -274,7 +274,7 @@ static int ldif_write_ntSecurityDescriptor(struct ldb_context *ldb, void *mem_ct if (sd == NULL) { return -1; } - ndr_err = ndr_pull_struct_blob(in, sd, sd, + ndr_err = ndr_pull_struct_blob(in, sd, NULL, sd, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(sd); diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c index 7d2df182fe..9264339a6c 100644 --- a/source4/lib/registry/regf.c +++ b/source4/lib/registry/regf.c @@ -1194,7 +1194,7 @@ static WERROR regf_get_sec_desc(TALLOC_CTX *ctx, const struct hive_key *key, data.data = sk.sec_desc; data.length = sk.rec_size; - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_struct_blob(&data, ctx, *sd, + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_struct_blob(&data, ctx, NULL, *sd, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor))) { DEBUG(0, ("Error parsing security descriptor\n")); return WERR_GENERAL_FAILURE; diff --git a/source4/libcli/cldap/cldap.c b/source4/libcli/cldap/cldap.c index 4c6bd68c13..7c8d40e608 100644 --- a/source4/libcli/cldap/cldap.c +++ b/source4/libcli/cldap/cldap.c @@ -617,7 +617,9 @@ NTSTATUS cldap_netlogon_recv(struct cldap_request *req, } data = search.out.response->attributes[0].values; - ndr_err = ndr_pull_union_blob_all(data, mem_ctx, &io->out.netlogon, + ndr_err = ndr_pull_union_blob_all(data, mem_ctx, + lp_iconv_convenience(global_loadparm), + &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)) { @@ -711,7 +713,9 @@ NTSTATUS cldap_netlogon_reply(struct cldap_socket *cldap, TALLOC_CTX *tmp_ctx = talloc_new(cldap); DATA_BLOB blob; - ndr_err = ndr_push_union_blob(&blob, tmp_ctx, netlogon, version & 0xF, + ndr_err = ndr_push_union_blob(&blob, tmp_ctx, + lp_iconv_convenience(global_loadparm), + netlogon, version & 0xF, (ndr_push_flags_fn_t)ndr_push_nbt_cldap_netlogon); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(tmp_ctx); diff --git a/source4/libcli/cldap/cldap.h b/source4/libcli/cldap/cldap.h index 217ac0ff1b..8aa98f0331 100644 --- a/source4/libcli/cldap/cldap.h +++ b/source4/libcli/cldap/cldap.h @@ -73,7 +73,6 @@ struct cldap_request { struct cldap_socket { struct socket_context *sock; struct event_context *event_ctx; - struct loadparm_context *lp_ctx; /* the fd event */ struct fd_event *fde; diff --git a/source4/libcli/dgram/browse.c b/source4/libcli/dgram/browse.c index d70cda02ee..eb19555d15 100644 --- a/source4/libcli/dgram/browse.c +++ b/source4/libcli/dgram/browse.c @@ -99,7 +99,7 @@ NTSTATUS dgram_mailslot_browse_parse(struct dgram_mailslot_handler *dgmslot, DATA_BLOB data = dgram_mailslot_data(dgram); enum ndr_err_code ndr_err; - ndr_err = ndr_pull_struct_blob(&data, mem_ctx, pkt, + ndr_err = ndr_pull_struct_blob(&data, mem_ctx, lp_iconv_convenience(global_loadparm), pkt, (ndr_pull_flags_fn_t)ndr_pull_nbt_browse_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { NTSTATUS status = ndr_map_error2ntstatus(ndr_err); diff --git a/source4/libcli/dgram/dgramsocket.c b/source4/libcli/dgram/dgramsocket.c index cd3ac6630f..032d9de67b 100644 --- a/source4/libcli/dgram/dgramsocket.c +++ b/source4/libcli/dgram/dgramsocket.c @@ -72,7 +72,7 @@ static void dgm_socket_recv(struct nbt_dgram_socket *dgmsock) } /* parse the request */ - ndr_err = ndr_pull_struct_blob(&blob, packet, packet, + ndr_err = ndr_pull_struct_blob(&blob, packet, lp_iconv_convenience(global_loadparm), packet, (ndr_pull_flags_fn_t)ndr_pull_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 161d48cbbc..670af4ea63 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -114,7 +114,7 @@ NTSTATUS dgram_mailslot_netlogon_parse(struct dgram_mailslot_handler *dgmslot, DATA_BLOB data = dgram_mailslot_data(dgram); enum ndr_err_code ndr_err; - ndr_err = ndr_pull_struct_blob(&data, mem_ctx, netlogon, + ndr_err = ndr_pull_struct_blob(&data, mem_ctx, lp_iconv_convenience(global_loadparm), netlogon, (ndr_pull_flags_fn_t)ndr_pull_nbt_netlogon_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { NTSTATUS status = ndr_map_error2ntstatus(ndr_err); diff --git a/source4/libcli/dgram/ntlogon.c b/source4/libcli/dgram/ntlogon.c index bbcfc1b2dc..98aad1af8c 100644 --- a/source4/libcli/dgram/ntlogon.c +++ b/source4/libcli/dgram/ntlogon.c @@ -113,7 +113,7 @@ NTSTATUS dgram_mailslot_ntlogon_parse(struct dgram_mailslot_handler *dgmslot, DATA_BLOB data = dgram_mailslot_data(dgram); enum ndr_err_code ndr_err; - ndr_err = ndr_pull_struct_blob(&data, mem_ctx, ntlogon, + ndr_err = ndr_pull_struct_blob(&data, mem_ctx, lp_iconv_convenience(global_loadparm), ntlogon, (ndr_pull_flags_fn_t)ndr_pull_nbt_ntlogon_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { NTSTATUS status = ndr_map_error2ntstatus(ndr_err); diff --git a/source4/libcli/ldap/ldap_ndr.c b/source4/libcli/ldap/ldap_ndr.c index fde623bece..3f7cb8f538 100644 --- a/source4/libcli/ldap/ldap_ndr.c +++ b/source4/libcli/ldap/ldap_ndr.c @@ -85,7 +85,7 @@ NTSTATUS ldap_decode_ndr_GUID(TALLOC_CTX *mem_ctx, struct ldb_val val, struct GU blob.data = val.data; blob.length = val.length; - ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, guid, + ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, NULL, guid, (ndr_pull_flags_fn_t)ndr_pull_GUID); talloc_free(val.data); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { diff --git a/source4/libcli/nbt/nbtname.c b/source4/libcli/nbt/nbtname.c index 079d0595de..142dad0296 100644 --- a/source4/libcli/nbt/nbtname.c +++ b/source4/libcli/nbt/nbtname.c @@ -400,7 +400,7 @@ _PUBLIC_ NTSTATUS nbt_name_from_blob(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, { enum ndr_err_code ndr_err; - ndr_err = ndr_pull_struct_blob(blob, mem_ctx, name, + ndr_err = ndr_pull_struct_blob(blob, mem_ctx, NULL, name, (ndr_pull_flags_fn_t)ndr_pull_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 3716d40941..8bfe746294 100644 --- a/source4/libcli/nbt/nbtsocket.c +++ b/source4/libcli/nbt/nbtsocket.c @@ -190,7 +190,7 @@ static void nbt_name_socket_recv(struct nbt_name_socket *nbtsock) } /* parse the request */ - ndr_err = ndr_pull_struct_blob(&blob, packet, packet, + ndr_err = ndr_pull_struct_blob(&blob, packet, lp_iconv_convenience(global_loadparm), 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); diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 9827217a04..ed5475e926 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -253,7 +253,7 @@ NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_ parms->query_secdesc.out.sd = talloc(mem_ctx, struct security_descriptor); NT_STATUS_HAVE_NO_MEMORY(parms->query_secdesc.out.sd); - ndr_err = ndr_pull_struct_blob(blob, mem_ctx, + ndr_err = ndr_pull_struct_blob(blob, mem_ctx, NULL, parms->query_secdesc.out.sd, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { diff --git a/source4/libcli/raw/rawfsinfo.c b/source4/libcli/raw/rawfsinfo.c index 73f1192df0..bfb5db828e 100644 --- a/source4/libcli/raw/rawfsinfo.c +++ b/source4/libcli/raw/rawfsinfo.c @@ -216,7 +216,7 @@ NTSTATUS smb_raw_fsinfo_passthru_parse(DATA_BLOB blob, TALLOC_CTX *mem_ctx, case RAW_QFS_OBJECTID_INFORMATION: QFS_CHECK_SIZE(64); - ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &fsinfo->objectid_information.out.guid, + ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, NULL, &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); diff --git a/source4/libcli/util/clilsa.c b/source4/libcli/util/clilsa.c index 7c32294648..1eb2de83d2 100644 --- a/source4/libcli/util/clilsa.c +++ b/source4/libcli/util/clilsa.c @@ -32,6 +32,7 @@ #include "librpc/gen_ndr/ndr_lsa.h" #include "librpc/gen_ndr/ndr_lsa_c.h" #include "libcli/util/clilsa.h" +#include "param/param.h" struct smblsa_state { struct dcerpc_pipe *pipe; @@ -79,7 +80,8 @@ static NTSTATUS smblsa_connect(struct smbcli_state *cli) } lsa->ipc_tree->tid = tcon.tconx.out.tid; - lsa->pipe = dcerpc_pipe_init(lsa, cli->transport->socket->event.ctx); + lsa->pipe = dcerpc_pipe_init(lsa, cli->transport->socket->event.ctx, + lp_iconv_convenience(global_loadparm)); if (lsa->pipe == NULL) { talloc_free(lsa); return NT_STATUS_NO_MEMORY; diff --git a/source4/libcli/wrepl/winsrepl.c b/source4/libcli/wrepl/winsrepl.c index 381df902b4..d027e88396 100644 --- a/source4/libcli/wrepl/winsrepl.c +++ b/source4/libcli/wrepl/winsrepl.c @@ -102,8 +102,7 @@ static NTSTATUS wrepl_finish_recv(void *private, DATA_BLOB packet_blob_in) blob.length = packet_blob_in.length - 4; /* we have a full request - parse it */ - ndr_err = ndr_pull_struct_blob(&blob, - req->packet, req->packet, + ndr_err = ndr_pull_struct_blob(&blob, req->packet, lp_iconv_convenience(global_loadparm), 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); diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c index df4cb4d657..c707f82744 100644 --- a/source4/libnet/libnet_vampire.c +++ b/source4/libnet/libnet_vampire.c @@ -72,7 +72,7 @@ static NTSTATUS fix_user(TALLOC_CTX *mem_ctx, user->user_private_info.SensitiveData = data.data; user->user_private_info.DataLength = data.length; - ndr_err = ndr_pull_struct_blob(&data, mem_ctx, &keys, (ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS); + ndr_err = ndr_pull_struct_blob(&data, mem_ctx, lp_iconv_convenience(global_loadparm), &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); diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index fc1a5750dd..e6da096403 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -690,11 +690,11 @@ _PUBLIC_ uint32_t ndr_print_get_switch_value(struct ndr_print *ndr, const void * /* pull a struct from a blob using NDR */ -_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, +_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, void *p, ndr_pull_flags_fn_t fn) { struct ndr_pull *ndr; - ndr = ndr_pull_init_blob(blob, mem_ctx, lp_iconv_convenience(global_loadparm)); + ndr = ndr_pull_init_blob(blob, mem_ctx, iconv_convenience); NDR_ERR_HAVE_NO_MEMORY(ndr); NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p)); return NDR_ERR_SUCCESS; @@ -703,11 +703,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CT /* pull a struct from a blob using NDR - failing if all bytes are not consumed */ -_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, - ndr_pull_flags_fn_t fn) +_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, + struct smb_iconv_convenience *iconv_convenience, + void *p, ndr_pull_flags_fn_t fn) { struct ndr_pull *ndr; - ndr = ndr_pull_init_blob(blob, mem_ctx, lp_iconv_convenience(global_loadparm)); + ndr = ndr_pull_init_blob(blob, mem_ctx, iconv_convenience); NDR_ERR_HAVE_NO_MEMORY(ndr); NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p)); if (ndr->offset < ndr->data_size) { @@ -721,11 +722,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLO /* pull a union from a blob using NDR, given the union discriminator */ -_PUBLIC_ enum ndr_err_code ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, +_PUBLIC_ enum ndr_err_code ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, + struct smb_iconv_convenience *iconv_convenience, void *p, uint32_t level, ndr_pull_flags_fn_t fn) { struct ndr_pull *ndr; - ndr = ndr_pull_init_blob(blob, mem_ctx, lp_iconv_convenience(global_loadparm)); + ndr = ndr_pull_init_blob(blob, mem_ctx, iconv_convenience); NDR_ERR_HAVE_NO_MEMORY(ndr); NDR_CHECK(ndr_pull_set_switch_value(ndr, p, level)); NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p)); @@ -736,11 +738,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX pull a union from a blob using NDR, given the union discriminator, failing if all bytes are not consumed */ -_PUBLIC_ enum ndr_err_code ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, +_PUBLIC_ enum ndr_err_code ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, + struct smb_iconv_convenience *iconv_convenience, void *p, uint32_t level, ndr_pull_flags_fn_t fn) { struct ndr_pull *ndr; - ndr = ndr_pull_init_blob(blob, mem_ctx, lp_iconv_convenience(global_loadparm)); + ndr = ndr_pull_init_blob(blob, mem_ctx, iconv_convenience); NDR_ERR_HAVE_NO_MEMORY(ndr); NDR_CHECK(ndr_pull_set_switch_value(ndr, p, level)); NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p)); @@ -773,11 +776,11 @@ _PUBLIC_ enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem /* push a union to a blob using NDR */ -_PUBLIC_ enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, +_PUBLIC_ enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, void *p, uint32_t level, 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(ndr_push_set_switch_value(ndr, p, level)); diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index f5eae1b09a..b19a5d7160 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -56,7 +56,8 @@ static int dcerpc_connection_destructor(struct dcerpc_connection *conn) the event context is optional */ static struct dcerpc_connection *dcerpc_connection_init(TALLOC_CTX *mem_ctx, - struct event_context *ev) + struct event_context *ev, + struct smb_iconv_convenience *ic) { struct dcerpc_connection *c; @@ -73,6 +74,8 @@ static struct dcerpc_connection *dcerpc_connection_init(TALLOC_CTX *mem_ctx, } } + c->iconv_convenience = talloc_reference(c, ic); + c->event_ctx = ev; if (!talloc_reference(c, ev)) { @@ -95,7 +98,8 @@ static struct dcerpc_connection *dcerpc_connection_init(TALLOC_CTX *mem_ctx, } /* initialise a dcerpc pipe. */ -struct dcerpc_pipe *dcerpc_pipe_init(TALLOC_CTX *mem_ctx, struct event_context *ev) +struct dcerpc_pipe *dcerpc_pipe_init(TALLOC_CTX *mem_ctx, struct event_context *ev, + struct smb_iconv_convenience *ic) { struct dcerpc_pipe *p; @@ -104,7 +108,7 @@ struct dcerpc_pipe *dcerpc_pipe_init(TALLOC_CTX *mem_ctx, struct event_context * return NULL; } - p->conn = dcerpc_connection_init(p, ev); + p->conn = dcerpc_connection_init(p, ev, ic); if (p->conn == NULL) { talloc_free(p); return NULL; @@ -170,7 +174,7 @@ void dcerpc_set_auth_length(DATA_BLOB *blob, uint16_t v) static struct ndr_pull *ndr_pull_init_flags(struct dcerpc_connection *c, DATA_BLOB *blob, TALLOC_CTX *mem_ctx) { - struct ndr_pull *ndr = ndr_pull_init_blob(blob, mem_ctx, lp_iconv_convenience(global_loadparm)); + struct ndr_pull *ndr = ndr_pull_init_blob(blob, mem_ctx, c->iconv_convenience); if (ndr == NULL) return ndr; @@ -350,7 +354,7 @@ static NTSTATUS ncacn_push_request_sign(struct dcerpc_connection *c, return ncacn_push_auth(blob, mem_ctx, pkt, c->security_state.auth_info); } - ndr = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm)); + ndr = ndr_push_init_ctx(mem_ctx, c->iconv_convenience); if (!ndr) { return NT_STATUS_NO_MEMORY; } @@ -666,6 +670,7 @@ static void dcerpc_bind_recv_handler(struct rpc_request *req, enum ndr_err_code ndr_err; ndr_err = ndr_pull_struct_blob( &pkt->u.bind_ack.auth_info, conn, + NULL, conn->security_state.auth_info, (ndr_pull_flags_fn_t)ndr_pull_dcerpc_auth); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { @@ -1194,7 +1199,7 @@ static NTSTATUS dcerpc_ndr_validate_in(struct dcerpc_connection *c, return ndr_map_error2ntstatus(ndr_err); } - push = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm)); + push = ndr_push_init_ctx(mem_ctx, c->iconv_convenience); if (!push) { return NT_STATUS_NO_MEMORY; } @@ -1252,7 +1257,7 @@ static NTSTATUS dcerpc_ndr_validate_out(struct dcerpc_connection *c, } memcpy(st, struct_ptr, struct_size); - push = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm)); + push = ndr_push_init_ctx(mem_ctx, c->iconv_convenience); if (!push) { return NT_STATUS_NO_MEMORY; } @@ -1283,7 +1288,7 @@ static NTSTATUS dcerpc_ndr_validate_out(struct dcerpc_connection *c, return ndr_map_error2ntstatus(ndr_err); } - push = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm)); + push = ndr_push_init_ctx(mem_ctx, c->iconv_convenience); if (!push) { return NT_STATUS_NO_MEMORY; } @@ -1334,7 +1339,7 @@ static NTSTATUS dcerpc_ndr_validate_out(struct dcerpc_connection *c, } -/* +/** send a rpc request given a dcerpc_call structure */ struct rpc_request *dcerpc_ndr_request_send(struct dcerpc_pipe *p, @@ -1354,7 +1359,7 @@ struct rpc_request *dcerpc_ndr_request_send(struct dcerpc_pipe *p, call = &table->calls[opnum]; /* setup for a ndr_push_* call */ - push = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm)); + push = ndr_push_init_ctx(mem_ctx, p->conn->iconv_convenience); if (!push) { return NULL; } @@ -1584,6 +1589,7 @@ static void dcerpc_alter_recv_handler(struct rpc_request *req, enum ndr_err_code ndr_err; ndr_err = ndr_pull_struct_blob( &pkt->u.alter_resp.auth_info, recv_pipe, + NULL, recv_pipe->conn->security_state.auth_info, (ndr_pull_flags_fn_t)ndr_pull_dcerpc_auth); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h index 9936ebe001..7c6aa7513b 100644 --- a/source4/librpc/rpc/dcerpc.h +++ b/source4/librpc/rpc/dcerpc.h @@ -55,6 +55,7 @@ struct dcerpc_connection { struct dcerpc_security security_state; const char *binding_string; struct event_context *event_ctx; + struct smb_iconv_convenience *iconv_convenience; bool dead; bool free_skipped; diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c index 8fd783fb83..63fd25dd1a 100644 --- a/source4/librpc/rpc/dcerpc_connect.c +++ b/source4/librpc/rpc/dcerpc_connect.c @@ -731,7 +731,7 @@ struct composite_context* dcerpc_pipe_connect_b_send(TALLOC_CTX *parent_ctx, c->private_data = s; /* initialise dcerpc pipe structure */ - s->pipe = dcerpc_pipe_init(c, ev); + s->pipe = dcerpc_pipe_init(c, ev, lp_iconv_convenience(lp_ctx)); if (composite_nomem(s->pipe, c)) return c; /* store parameters in state structure */ diff --git a/source4/librpc/rpc/dcerpc_secondary.c b/source4/librpc/rpc/dcerpc_secondary.c index 5e8dd955d3..ab98215180 100644 --- a/source4/librpc/rpc/dcerpc_secondary.c +++ b/source4/librpc/rpc/dcerpc_secondary.c @@ -71,7 +71,7 @@ struct composite_context* dcerpc_secondary_connection_send(struct dcerpc_pipe *p s->binding = b; /* initialise second dcerpc pipe based on primary pipe's event context */ - s->pipe2 = dcerpc_pipe_init(c, s->pipe->conn->event_ctx); + s->pipe2 = dcerpc_pipe_init(c, s->pipe->conn->event_ctx, s->pipe->conn->iconv_convenience); if (composite_nomem(s->pipe2, c)) return c; /* open second dcerpc pipe using the same transport as for primary pipe */ diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c index ad0a55da79..94d32488eb 100644 --- a/source4/ntvfs/common/notify.c +++ b/source4/ntvfs/common/notify.c @@ -171,7 +171,8 @@ static NTSTATUS notify_load(struct notify_context *notify) blob.data = dbuf.dptr; blob.length = dbuf.dsize; - ndr_err = ndr_pull_struct_blob(&blob, notify->array, notify->array, + ndr_err = ndr_pull_struct_blob(&blob, notify->array, lp_iconv_convenience(global_loadparm), + notify->array, (ndr_pull_flags_fn_t)ndr_pull_notify_array); free(dbuf.dptr); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { @@ -255,7 +256,7 @@ static void notify_handler(struct messaging_context *msg_ctx, void *private_data return; } - ndr_err = ndr_pull_struct_blob(data, tmp_ctx, &ev, + ndr_err = ndr_pull_struct_blob(data, tmp_ctx, lp_iconv_convenience(global_loadparm), &ev, (ndr_pull_flags_fn_t)ndr_pull_notify_event); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(tmp_ctx); diff --git a/source4/ntvfs/common/opendb_tdb.c b/source4/ntvfs/common/opendb_tdb.c index 7408f3a3df..9bb6784df3 100644 --- a/source4/ntvfs/common/opendb_tdb.c +++ b/source4/ntvfs/common/opendb_tdb.c @@ -205,7 +205,7 @@ static NTSTATUS odb_pull_record(struct odb_lock *lck, struct opendb_file *file) blob.data = dbuf.dptr; blob.length = dbuf.dsize; - ndr_err = ndr_pull_struct_blob(&blob, lck, file, (ndr_pull_flags_fn_t)ndr_pull_opendb_file); + ndr_err = ndr_pull_struct_blob(&blob, lck, lp_iconv_convenience(global_loadparm), 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); diff --git a/source4/ntvfs/posix/pvfs_xattr.c b/source4/ntvfs/posix/pvfs_xattr.c index c0a04b4099..39090bf702 100644 --- a/source4/ntvfs/posix/pvfs_xattr.c +++ b/source4/ntvfs/posix/pvfs_xattr.c @@ -117,7 +117,8 @@ _PUBLIC_ NTSTATUS pvfs_xattr_ndr_load(struct pvfs_state *pvfs, } /* pull the blob */ - ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, p, (ndr_pull_flags_fn_t)pull_fn); + ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, lp_iconv_convenience(pvfs->ntvfs->ctx->lp_ctx), + p, (ndr_pull_flags_fn_t)pull_fn); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return ndr_map_error2ntstatus(ndr_err); } diff --git a/source4/param/secrets.c b/source4/param/secrets.c index 0957fad5a1..bc4327188a 100644 --- a/source4/param/secrets.c +++ b/source4/param/secrets.c @@ -194,7 +194,7 @@ struct dom_sid *secrets_get_domain_sid(TALLOC_CTX *mem_ctx, return NULL; } - ndr_err = ndr_pull_struct_blob(v, result, result, + ndr_err = ndr_pull_struct_blob(v, result, NULL, result, (ndr_pull_flags_fn_t)ndr_pull_dom_sid); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(result); diff --git a/source4/rpc_server/dcesrv_auth.c b/source4/rpc_server/dcesrv_auth.c index aa37de2826..dce775591b 100644 --- a/source4/rpc_server/dcesrv_auth.c +++ b/source4/rpc_server/dcesrv_auth.c @@ -52,7 +52,7 @@ bool dcesrv_auth_bind(struct dcesrv_call_state *call) } ndr_err = ndr_pull_struct_blob(&pkt->u.bind.auth_info, - call, + call, NULL, dce_conn->auth_state.auth_info, (ndr_pull_flags_fn_t)ndr_pull_dcerpc_auth); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { @@ -154,7 +154,7 @@ bool dcesrv_auth_auth3(struct dcesrv_call_state *call) } ndr_err = ndr_pull_struct_blob(&pkt->u.auth3.auth_info, - call, + call, NULL, dce_conn->auth_state.auth_info, (ndr_pull_flags_fn_t)ndr_pull_dcerpc_auth); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { @@ -212,7 +212,7 @@ bool dcesrv_auth_alter(struct dcesrv_call_state *call) } ndr_err = ndr_pull_struct_blob(&pkt->u.alter.auth_info, - call, + call, NULL, dce_conn->auth_state.auth_info, (ndr_pull_flags_fn_t)ndr_pull_dcerpc_auth); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c index 7fdd9b0413..47c963ad29 100644 --- a/source4/rpc_server/winreg/rpc_winreg.c +++ b/source4/rpc_server/winreg/rpc_winreg.c @@ -129,7 +129,7 @@ static WERROR dcesrv_winreg_CreateKey(struct dcesrv_call_state *dce_call, if (sdblob.data == NULL) { return WERR_INVALID_PARAM; } - ndr_err = ndr_pull_struct_blob_all(&sdblob, mem_ctx, &sd, + ndr_err = ndr_pull_struct_blob_all(&sdblob, mem_ctx, NULL, &sd, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return WERR_INVALID_PARAM; diff --git a/source4/smb_server/smb/nttrans.c b/source4/smb_server/smb/nttrans.c index 279da73185..fe65b7a667 100644 --- a/source4/smb_server/smb/nttrans.c +++ b/source4/smb_server/smb/nttrans.c @@ -157,7 +157,7 @@ static NTSTATUS nttrans_create(struct smbsrv_request *req, if (io->ntcreatex.in.sec_desc == NULL) { return NT_STATUS_NO_MEMORY; } - ndr_err = ndr_pull_struct_blob(&blob, io, + ndr_err = ndr_pull_struct_blob(&blob, io, NULL, io->ntcreatex.in.sec_desc, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { @@ -270,7 +270,7 @@ static NTSTATUS nttrans_set_sec_desc(struct smbsrv_request *req, io->set_secdesc.in.sd = talloc(io, struct security_descriptor); NT_STATUS_HAVE_NO_MEMORY(io->set_secdesc.in.sd); - ndr_err = ndr_pull_struct_blob(&trans->in.data, req, + ndr_err = ndr_pull_struct_blob(&trans->in.data, req, NULL, io->set_secdesc.in.sd, (ndr_pull_flags_fn_t)ndr_pull_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 bbd784bf8f..00c455e351 100644 --- a/source4/smb_server/smb2/fileinfo.c +++ b/source4/smb_server/smb2/fileinfo.c @@ -310,7 +310,7 @@ static NTSTATUS smb2srv_setinfo_security(struct smb2srv_setinfo_op *op, uint8_t io->set_secdesc.in.sd = talloc(io, struct security_descriptor); NT_STATUS_HAVE_NO_MEMORY(io->set_secdesc.in.sd); - ndr_err = ndr_pull_struct_blob(&op->info->in.blob, io, + ndr_err = ndr_pull_struct_blob(&op->info->in.blob, io, NULL, io->set_secdesc.in.sd, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { diff --git a/source4/torture/auth/pac.c b/source4/torture/auth/pac.c index b579b9e360..ea9c2237e5 100644 --- a/source4/torture/auth/pac.c +++ b/source4/torture/auth/pac.c @@ -517,7 +517,8 @@ static bool torture_pac_saved_check(struct torture_context *tctx) * pointer, padding etc algorithms as win2k3. */ if (tmp_blob.length != validate_blob.length) { - ndr_err = ndr_pull_struct_blob(&validate_blob, mem_ctx, &pac_data2, + ndr_err = ndr_pull_struct_blob(&validate_blob, mem_ctx, + lp_iconv_convenience(global_loadparm), &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"); @@ -538,7 +539,8 @@ static bool torture_pac_saved_check(struct torture_context *tctx) } if (memcmp(tmp_blob.data, validate_blob.data, tmp_blob.length) != 0) { - ndr_err = ndr_pull_struct_blob(&validate_blob, mem_ctx, &pac_data2, + ndr_err = ndr_pull_struct_blob(&validate_blob, mem_ctx, + lp_iconv_convenience(global_loadparm), &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"); diff --git a/source4/torture/ldap/uptodatevector.c b/source4/torture/ldap/uptodatevector.c index 7bac04caf3..cec330b2f6 100644 --- a/source4/torture/ldap/uptodatevector.c +++ b/source4/torture/ldap/uptodatevector.c @@ -70,7 +70,8 @@ static bool test_check_uptodatevector(struct torture_context *torture, ZERO_STRUCT(utdv1); utdv_val1 = ldb_msg_find_ldb_val(r->msgs[0], "replUpToDateVector"); if (utdv_val1) { - ndr_err = ndr_pull_struct_blob_all(utdv_val1, torture, &utdv1, + ndr_err = ndr_pull_struct_blob_all(utdv_val1, torture, + lp_iconv_convenience(torture->lp_ctx), &utdv1, (ndr_pull_flags_fn_t)ndr_pull_replUpToDateVectorBlob); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return false; @@ -116,7 +117,8 @@ static bool test_check_uptodatevector(struct torture_context *torture, ZERO_STRUCT(utdv); utdv_val = ldb_msg_find_ldb_val(r->msgs[0], "replUpToDateVector"); if (utdv_val) { - ndr_err = ndr_pull_struct_blob_all(utdv_val, torture, &utdv, + ndr_err = ndr_pull_struct_blob_all(utdv_val, torture, + lp_iconv_convenience(torture->lp_ctx), &utdv, (ndr_pull_flags_fn_t)ndr_pull_replUpToDateVectorBlob); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return false; diff --git a/source4/torture/raw/qfileinfo.c b/source4/torture/raw/qfileinfo.c index 7dcd2000e9..65d803882c 100644 --- a/source4/torture/raw/qfileinfo.c +++ b/source4/torture/raw/qfileinfo.c @@ -26,6 +26,7 @@ #include "librpc/rpc/dcerpc.h" #include "torture/rpc/rpc.h" #include "torture/raw/proto.h" +#include "param/param.h" static struct { const char *name; @@ -845,7 +846,8 @@ bool torture_raw_qfileinfo_pipe(struct torture_context *torture, struct smbcli_tree *ipc_tree; NTSTATUS status; - if (!(p = dcerpc_pipe_init(torture, cli->tree->session->transport->socket->event.ctx))) { + if (!(p = dcerpc_pipe_init(torture, cli->tree->session->transport->socket->event.ctx, + lp_iconv_convenience(torture->lp_ctx)))) { return false; } diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index a63772e964..36461ad629 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -89,7 +89,8 @@ bool torture_bind_authcontext(struct torture_context *torture) goto done; } - lsa_pipe = dcerpc_pipe_init(mem_ctx, cli->transport->socket->event.ctx); + lsa_pipe = dcerpc_pipe_init(mem_ctx, cli->transport->socket->event.ctx, + lp_iconv_convenience(torture->lp_ctx)); if (lsa_pipe == NULL) { d_printf("dcerpc_pipe_init failed\n"); goto done; @@ -206,7 +207,8 @@ static bool bindtest(struct smbcli_state *cli, } lsa_pipe = dcerpc_pipe_init(mem_ctx, - cli->transport->socket->event.ctx); + cli->transport->socket->event.ctx, + lp_iconv_convenience(lp_ctx)); if (lsa_pipe == NULL) { d_printf("dcerpc_pipe_init failed\n"); goto done; @@ -346,7 +348,8 @@ static NTSTATUS get_usr_handle(struct smbcli_state *cli, uint32_t user_rid,access_granted; samr_pipe = dcerpc_pipe_init(mem_ctx, - cli->transport->socket->event.ctx); + cli->transport->socket->event.ctx, + lp_iconv_convenience(lp_ctx)); if (samr_pipe == NULL) { d_printf("dcerpc_pipe_init failed\n"); status = NT_STATUS_NO_MEMORY; @@ -816,7 +819,8 @@ static bool auth2(struct smbcli_state *cli, } net_pipe = dcerpc_pipe_init(mem_ctx, - cli->transport->socket->event.ctx); + cli->transport->socket->event.ctx, + lp_iconv_convenience(global_loadparm)); if (net_pipe == NULL) { d_printf("dcerpc_pipe_init failed\n"); goto done; @@ -918,7 +922,8 @@ static bool schan(struct smbcli_state *cli, } net_pipe = dcerpc_pipe_init(mem_ctx, - cli->transport->socket->event.ctx); + cli->transport->socket->event.ctx, + lp_iconv_convenience(lp_ctx)); if (net_pipe == NULL) { d_printf("dcerpc_pipe_init failed\n"); goto done; @@ -1366,7 +1371,8 @@ static NTSTATUS pipe_bind_smb(TALLOC_CTX *mem_ctx, NTSTATUS status; if (!(result = dcerpc_pipe_init( - mem_ctx, tree->session->transport->socket->event.ctx))) { + mem_ctx, tree->session->transport->socket->event.ctx, + lp_iconv_convenience(global_loadparm)))) { return NT_STATUS_NO_MEMORY; } @@ -1901,7 +1907,8 @@ bool torture_samba3_rpc_randomauth2(struct torture_context *torture) } if (!(net_pipe = dcerpc_pipe_init( - mem_ctx, cli->transport->socket->event.ctx))) { + mem_ctx, cli->transport->socket->event.ctx, + lp_iconv_convenience(torture->lp_ctx)))) { d_printf("dcerpc_pipe_init failed\n"); goto done; } @@ -2972,7 +2979,8 @@ static NTSTATUS get_shareinfo(TALLOC_CTX *mem_ctx, NTSTATUS status; if (!(p = dcerpc_pipe_init(cli, - cli->transport->socket->event.ctx))) { + cli->transport->socket->event.ctx, + lp_iconv_convenience(global_loadparm)))) { status = NT_STATUS_NO_MEMORY; goto fail; } @@ -3038,7 +3046,8 @@ static NTSTATUS get_hklm_handle(TALLOC_CTX *mem_ctx, } if (!(p = dcerpc_pipe_init(result, - cli->transport->socket->event.ctx))) { + cli->transport->socket->event.ctx, + lp_iconv_convenience(global_loadparm)))) { status = NT_STATUS_NO_MEMORY; goto fail; } diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c index e94f228589..1f7f9f463e 100644 --- a/source4/torture/rpc/samsync.c +++ b/source4/torture/rpc/samsync.c @@ -548,7 +548,7 @@ static bool samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy data.data = user->user_private_info.SensitiveData; data.length = user->user_private_info.DataLength; creds_arcfour_crypt(samsync_state->creds, data.data, data.length); - ndr_err = ndr_pull_struct_blob(&data, mem_ctx, &keys, (ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS); + ndr_err = ndr_pull_struct_blob(&data, mem_ctx, lp_iconv_convenience(global_loadparm), &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); diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c index 72435f8054..d77295605f 100644 --- a/source4/torture/rpc/winreg.c +++ b/source4/torture/rpc/winreg.c @@ -221,7 +221,7 @@ static bool _test_GetKeySecurity(struct dcerpc_pipe *p, sd = talloc_zero(tctx, struct security_descriptor); torture_assert_ndr_success(tctx, - ndr_pull_struct_blob(&sdblob, tctx, sd, + ndr_pull_struct_blob(&sdblob, tctx, NULL, sd, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor), "pull_security_descriptor failed"); diff --git a/source4/wrepl_server/wrepl_in_connection.c b/source4/wrepl_server/wrepl_in_connection.c index f9a2e30ed7..f2cf7c6113 100644 --- a/source4/wrepl_server/wrepl_in_connection.c +++ b/source4/wrepl_server/wrepl_in_connection.c @@ -65,7 +65,9 @@ static NTSTATUS wreplsrv_recv_request(void *private, DATA_BLOB blob) packet_in_blob.data = blob.data + 4; packet_in_blob.length = blob.length - 4; - ndr_err = ndr_pull_struct_blob(&packet_in_blob, call, &call->req_packet, + ndr_err = ndr_pull_struct_blob(&packet_in_blob, call, + lp_iconv_convenience(global_loadparm), + &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); |