mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
r26432: Require ndr_pull users to specify iconv_convenience.
(This used to be commit 28b1d36551b75241c1cf9fca5d74f45a6dc884ab)
This commit is contained in:
parent
61873ce94c
commit
d1e716cf43
@ -798,7 +798,7 @@ static void irpc_handler(struct messaging_context *msg_ctx, void *private,
|
||||
|
||||
m->from = src;
|
||||
|
||||
m->ndr = ndr_pull_init_blob(packet, m);
|
||||
m->ndr = ndr_pull_init_blob(packet, m, lp_iconv_convenience(global_loadparm));
|
||||
if (m->ndr == NULL) goto failed;
|
||||
|
||||
m->ndr->flags |= LIBNDR_FLAG_REF_ALLOC;
|
||||
|
@ -76,7 +76,7 @@ NTSTATUS samba3_read_share_info(const char *fn, TALLOC_CTX *ctx, struct samba3 *
|
||||
blob.data = (uint8_t *)vbuf.dptr;
|
||||
blob.length = vbuf.dsize;
|
||||
|
||||
pull = ndr_pull_init_blob(&blob, ctx);
|
||||
pull = ndr_pull_init_blob(&blob, ctx, lp_iconv_convenience(global_loadparm));
|
||||
|
||||
ndr_pull_security_descriptor(pull, NDR_SCALARS|NDR_BUFFERS, &share->secdesc);
|
||||
|
||||
|
@ -77,7 +77,8 @@ NTSTATUS smb_raw_query_secdesc_recv(struct smbcli_request *req,
|
||||
|
||||
nt.out.data.length = IVAL(nt.out.params.data, 0);
|
||||
|
||||
ndr = ndr_pull_init_blob(&nt.out.data, mem_ctx);
|
||||
ndr = ndr_pull_init_blob(&nt.out.data, mem_ctx,
|
||||
lp_iconv_convenience(global_loadparm));
|
||||
if (!ndr) {
|
||||
return NT_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ _PUBLIC_ size_t ndr_align_size(uint32_t offset, size_t n)
|
||||
/*
|
||||
initialise a ndr parse structure from a data blob
|
||||
*/
|
||||
_PUBLIC_ struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx)
|
||||
_PUBLIC_ struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience)
|
||||
{
|
||||
struct ndr_pull *ndr;
|
||||
|
||||
@ -67,7 +67,7 @@ _PUBLIC_ struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *
|
||||
|
||||
ndr->data = blob->data;
|
||||
ndr->data_size = blob->length;
|
||||
ndr->iconv_convenience = talloc_reference(ndr, lp_iconv_convenience(global_loadparm));
|
||||
ndr->iconv_convenience = talloc_reference(ndr, iconv_convenience);
|
||||
|
||||
return ndr;
|
||||
}
|
||||
@ -694,7 +694,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CT
|
||||
ndr_pull_flags_fn_t fn)
|
||||
{
|
||||
struct ndr_pull *ndr;
|
||||
ndr = ndr_pull_init_blob(blob, mem_ctx);
|
||||
ndr = ndr_pull_init_blob(blob, mem_ctx, lp_iconv_convenience(global_loadparm));
|
||||
NDR_ERR_HAVE_NO_MEMORY(ndr);
|
||||
NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
|
||||
return NDR_ERR_SUCCESS;
|
||||
@ -707,7 +707,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLO
|
||||
ndr_pull_flags_fn_t fn)
|
||||
{
|
||||
struct ndr_pull *ndr;
|
||||
ndr = ndr_pull_init_blob(blob, mem_ctx);
|
||||
ndr = ndr_pull_init_blob(blob, mem_ctx, lp_iconv_convenience(global_loadparm));
|
||||
NDR_ERR_HAVE_NO_MEMORY(ndr);
|
||||
NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
|
||||
if (ndr->offset < ndr->data_size) {
|
||||
@ -725,7 +725,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX
|
||||
uint32_t level, ndr_pull_flags_fn_t fn)
|
||||
{
|
||||
struct ndr_pull *ndr;
|
||||
ndr = ndr_pull_init_blob(blob, mem_ctx);
|
||||
ndr = ndr_pull_init_blob(blob, mem_ctx, lp_iconv_convenience(global_loadparm));
|
||||
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));
|
||||
@ -740,7 +740,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC
|
||||
uint32_t level, ndr_pull_flags_fn_t fn)
|
||||
{
|
||||
struct ndr_pull *ndr;
|
||||
ndr = ndr_pull_init_blob(blob, mem_ctx);
|
||||
ndr = ndr_pull_init_blob(blob, mem_ctx, lp_iconv_convenience(global_loadparm));
|
||||
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));
|
||||
|
@ -121,7 +121,7 @@
|
||||
r->out.count = _r.out.count;\
|
||||
r->out.result = _r.out.result;\
|
||||
if (_r.out.info) {\
|
||||
struct ndr_pull *_ndr_info = ndr_pull_init_blob(_r.out.info, ndr);\
|
||||
struct ndr_pull *_ndr_info = ndr_pull_init_blob(_r.out.info, ndr, ndr->iconv_convenience);\
|
||||
NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
|
||||
_ndr_info->flags= ndr->flags;\
|
||||
if (r->in.offered != _ndr_info->data_size) {\
|
||||
@ -470,7 +470,7 @@ enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flag
|
||||
}
|
||||
if (_r.out.data.length > 0 && r->out.needed <= _r.out.data.length) {
|
||||
struct __spoolss_GetPrinterData __r;
|
||||
struct ndr_pull *_ndr_data = ndr_pull_init_blob(&_r.out.data, ndr);
|
||||
struct ndr_pull *_ndr_data = ndr_pull_init_blob(&_r.out.data, ndr, ndr->iconv_convenience);
|
||||
NDR_ERR_HAVE_NO_MEMORY(_ndr_data);
|
||||
_ndr_data->flags= ndr->flags;
|
||||
__r.in.type = r->out.type;
|
||||
|
@ -164,13 +164,13 @@ void dcerpc_set_auth_length(DATA_BLOB *blob, uint16_t v)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
setup for a ndr pull, also setting up any flags from the binding string
|
||||
*/
|
||||
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);
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(blob, mem_ctx, lp_iconv_convenience(global_loadparm));
|
||||
|
||||
if (ndr == NULL) return ndr;
|
||||
|
||||
|
@ -439,7 +439,7 @@ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_
|
||||
NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct ndr_syntax_id *syntax)
|
||||
{
|
||||
TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data");
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx);
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx, lp_iconv_convenience(global_loadparm));
|
||||
enum ndr_err_code ndr_err;
|
||||
uint16_t if_version=0;
|
||||
|
||||
|
@ -304,7 +304,7 @@ static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
|
||||
blob.data = data;
|
||||
blob.length = size;
|
||||
|
||||
ndr_pull = ndr_pull_init_blob(&blob, mem_ctx);
|
||||
ndr_pull = ndr_pull_init_blob(&blob, mem_ctx, lp_iconv_convenience(cmdline_lp_ctx));
|
||||
ndr_pull->flags |= LIBNDR_FLAG_REF_ALLOC;
|
||||
|
||||
ndr_err = f->ndr_pull(ndr_pull, NDR_IN, st);
|
||||
@ -341,7 +341,7 @@ static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
|
||||
blob.data = data;
|
||||
blob.length = size;
|
||||
|
||||
ndr_pull = ndr_pull_init_blob(&blob, mem_ctx);
|
||||
ndr_pull = ndr_pull_init_blob(&blob, mem_ctx, lp_iconv_convenience(cmdline_lp_ctx));
|
||||
ndr_pull->flags |= LIBNDR_FLAG_REF_ALLOC;
|
||||
|
||||
ndr_err = f->ndr_pull(ndr_pull, flags, st);
|
||||
@ -397,7 +397,7 @@ static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
|
||||
ndrdump_data(v_blob.data, v_blob.length, dumpdata);
|
||||
}
|
||||
|
||||
ndr_v_pull = ndr_pull_init_blob(&v_blob, mem_ctx);
|
||||
ndr_v_pull = ndr_pull_init_blob(&v_blob, mem_ctx, lp_iconv_convenience(cmdline_lp_ctx));
|
||||
ndr_v_pull->flags |= LIBNDR_FLAG_REF_ALLOC;
|
||||
|
||||
ndr_err = f->ndr_pull(ndr_v_pull, flags, v_st);
|
||||
|
@ -116,10 +116,10 @@ static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx,
|
||||
|
||||
call->mem_ctx = mem_ctx;
|
||||
|
||||
call->ndr_pull_param = ndr_pull_init_blob(&trans->in.params, mem_ctx);
|
||||
call->ndr_pull_param = ndr_pull_init_blob(&trans->in.params, mem_ctx, lp_iconv_convenience(global_loadparm));
|
||||
call->ndr_pull_param->flags = RAPNDR_FLAGS;
|
||||
|
||||
call->ndr_pull_data = ndr_pull_init_blob(&trans->in.data, mem_ctx);
|
||||
call->ndr_pull_data = ndr_pull_init_blob(&trans->in.data, mem_ctx, lp_iconv_convenience(global_loadparm));
|
||||
call->ndr_pull_data->flags = RAPNDR_FLAGS;
|
||||
|
||||
call->heap = talloc(mem_ctx, struct rap_string_heap);
|
||||
|
@ -821,7 +821,8 @@ static NTSTATUS dcesrv_request(struct dcesrv_call_state *call)
|
||||
return dcesrv_fault(call, DCERPC_FAULT_UNK_IF);
|
||||
}
|
||||
|
||||
pull = ndr_pull_init_blob(&call->pkt.u.request.stub_and_verifier, call);
|
||||
pull = ndr_pull_init_blob(&call->pkt.u.request.stub_and_verifier, call,
|
||||
lp_iconv_convenience(global_loadparm));
|
||||
NT_STATUS_HAVE_NO_MEMORY(pull);
|
||||
|
||||
pull->flags |= LIBNDR_FLAG_REF_ALLOC;
|
||||
@ -1049,7 +1050,7 @@ NTSTATUS dcesrv_input_process(struct dcesrv_connection *dce_conn)
|
||||
blob = dce_conn->partial_input;
|
||||
blob.length = dcerpc_get_frag_length(&blob);
|
||||
|
||||
ndr = ndr_pull_init_blob(&blob, call);
|
||||
ndr = ndr_pull_init_blob(&blob, call, lp_iconv_convenience(call->conn->dce_ctx->lp_ctx));
|
||||
if (!ndr) {
|
||||
talloc_free(dce_conn->partial_input.data);
|
||||
talloc_free(call);
|
||||
|
@ -326,7 +326,7 @@ bool dcesrv_auth_request(struct dcesrv_call_state *call, DATA_BLOB *full_packet)
|
||||
pkt->u.request.stub_and_verifier.length -= auth_blob.length;
|
||||
|
||||
/* pull the auth structure */
|
||||
ndr = ndr_pull_init_blob(&auth_blob, call);
|
||||
ndr = ndr_pull_init_blob(&auth_blob, call, lp_iconv_convenience(call->conn->dce_ctx->lp_ctx));
|
||||
if (!ndr) {
|
||||
return false;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "torture/ndr/proto.h"
|
||||
#include "torture/ui.h"
|
||||
#include "util/dlinklist.h"
|
||||
#include "param/param.h"
|
||||
|
||||
struct ndr_pull_test_data {
|
||||
DATA_BLOB data;
|
||||
@ -38,7 +39,7 @@ static bool wrap_ndr_pull_test(struct torture_context *tctx,
|
||||
bool (*check_fn) (struct torture_context *ctx, void *data) = test->fn;
|
||||
const struct ndr_pull_test_data *data = (const struct ndr_pull_test_data *)test->data;
|
||||
void *ds = talloc_zero_size(tctx, data->struct_size);
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(&(data->data), tctx);
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(&(data->data), tctx, lp_iconv_convenience(tctx->lp_ctx));
|
||||
|
||||
ndr->flags |= LIBNDR_FLAG_REF_ALLOC;
|
||||
|
||||
@ -97,7 +98,7 @@ static bool test_check_string_terminator(struct torture_context *tctx)
|
||||
/* Simple test */
|
||||
blob = strhex_to_data_blob("0000");
|
||||
|
||||
ndr = ndr_pull_init_blob(&blob, mem_ctx);
|
||||
ndr = ndr_pull_init_blob(&blob, mem_ctx, lp_iconv_convenience(tctx->lp_ctx));
|
||||
|
||||
torture_assert_ndr_success(tctx, ndr_check_string_terminator(ndr, 1, 2),
|
||||
"simple check_string_terminator test failed");
|
||||
@ -115,7 +116,7 @@ static bool test_check_string_terminator(struct torture_context *tctx)
|
||||
talloc_free(ndr);
|
||||
|
||||
blob = strhex_to_data_blob("11220000");
|
||||
ndr = ndr_pull_init_blob(&blob, mem_ctx);
|
||||
ndr = ndr_pull_init_blob(&blob, mem_ctx, lp_iconv_convenience(tctx->lp_ctx));
|
||||
|
||||
torture_assert_ndr_success(tctx,
|
||||
ndr_check_string_terminator(ndr, 4, 1),
|
||||
|
@ -229,10 +229,12 @@ static NTSTATUS rap_cli_do_call(struct smbcli_tree *tree, struct rap_call *call)
|
||||
if (!NT_STATUS_IS_OK(result))
|
||||
return result;
|
||||
|
||||
call->ndr_pull_param = ndr_pull_init_blob(&trans.out.params, call);
|
||||
call->ndr_pull_param = ndr_pull_init_blob(&trans.out.params, call,
|
||||
lp_iconv_convenience(global_loadparm));
|
||||
call->ndr_pull_param->flags = RAPNDR_FLAGS;
|
||||
|
||||
call->ndr_pull_data = ndr_pull_init_blob(&trans.out.data, call);
|
||||
call->ndr_pull_data = ndr_pull_init_blob(&trans.out.data, call,
|
||||
lp_iconv_convenience(global_loadparm));
|
||||
call->ndr_pull_data->flags = RAPNDR_FLAGS;
|
||||
|
||||
return result;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "librpc/gen_ndr/ndr_eventlog_c.h"
|
||||
#include "librpc/gen_ndr/ndr_lsa.h"
|
||||
#include "torture/rpc/rpc.h"
|
||||
#include "param/param.h"
|
||||
|
||||
static void init_lsa_String(struct lsa_String *name, const char *s)
|
||||
{
|
||||
@ -137,7 +138,7 @@ static bool test_ReadEventLog(struct torture_context *tctx,
|
||||
blob.length = *r.out.sent_size;
|
||||
blob.data = talloc_steal(tctx, r.out.data);
|
||||
|
||||
ndr = ndr_pull_init_blob(&blob, tctx);
|
||||
ndr = ndr_pull_init_blob(&blob, tctx, lp_iconv_convenience(tctx->lp_ctx));
|
||||
|
||||
ndr_err = ndr_pull_eventlog_Record(
|
||||
ndr, NDR_SCALARS|NDR_BUFFERS, &rec);
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "system/filesys.h"
|
||||
#include "librpc/gen_ndr/ndr_xattr.h"
|
||||
#include "lib/util/wrap_xattr.h"
|
||||
#include "param/param.h"
|
||||
|
||||
static void ntacl_print_debug_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
|
||||
|
||||
@ -71,7 +72,7 @@ static NTSTATUS get_ntacl(TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
blob.length = size;
|
||||
|
||||
ndr = ndr_pull_init_blob(&blob, NULL);
|
||||
ndr = ndr_pull_init_blob(&blob, NULL, lp_iconv_convenience(global_loadparm));
|
||||
|
||||
ndr_err = ndr_pull_xattr_NTACL(ndr, NDR_SCALARS|NDR_BUFFERS, *ntacl);
|
||||
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user