summaryrefslogtreecommitdiff
path: root/librpc/ndr
diff options
context:
space:
mode:
Diffstat (limited to 'librpc/ndr')
-rw-r--r--librpc/ndr/libndr.h5
-rw-r--r--librpc/ndr/ndr.c8
-rw-r--r--librpc/ndr/ndr_krb5pac.c16
-rw-r--r--librpc/ndr/ndr_sec_helper.c20
4 files changed, 25 insertions, 24 deletions
diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
index eafaf688af..fdecddc0fc 100644
--- a/librpc/ndr/libndr.h
+++ b/librpc/ndr/libndr.h
@@ -103,6 +103,7 @@ struct ndr_print {
uint32_t flags; /* LIBNDR_FLAG_* */
uint32_t depth;
struct ndr_token_list *switch_list;
+ struct smb_iconv_convenience *iconv_convenience;
void (*print)(struct ndr_print *, const char *, ...) PRINTF_ATTRIBUTE(2,3);
void *private_data;
};
@@ -360,8 +361,8 @@ void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *
bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1, const struct ndr_syntax_id *i2);
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);
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);
-size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push);
-size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push);
+size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push, struct smb_iconv_convenience *);
+size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push, struct smb_iconv_convenience *);
uint32_t ndr_push_get_relative_base_offset(struct ndr_push *ndr);
void ndr_push_restore_relative_base_offset(struct ndr_push *ndr, uint32_t offset);
enum ndr_err_code ndr_push_setup_relative_base_offset1(struct ndr_push *ndr, const void *p, uint32_t offset);
diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c
index 12f95a9ceb..c382abba02 100644
--- a/librpc/ndr/ndr.c
+++ b/librpc/ndr/ndr.c
@@ -924,7 +924,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_
/*
generic ndr_size_*() handler for structures
*/
-_PUBLIC_ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push)
+_PUBLIC_ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push, struct smb_iconv_convenience *iconv_convenience)
{
struct ndr_push *ndr;
enum ndr_err_code status;
@@ -933,7 +933,7 @@ _PUBLIC_ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t pu
/* avoid recursion */
if (flags & LIBNDR_FLAG_NO_NDR_SIZE) return 0;
- ndr = ndr_push_init_ctx(NULL, global_iconv_convenience);
+ ndr = ndr_push_init_ctx(NULL, iconv_convenience);
if (!ndr) return 0;
ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
status = push(ndr, NDR_SCALARS|NDR_BUFFERS, discard_const(p));
@@ -949,7 +949,7 @@ _PUBLIC_ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t pu
/*
generic ndr_size_*() handler for unions
*/
-_PUBLIC_ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push)
+_PUBLIC_ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push, struct smb_iconv_convenience *iconv_convenience)
{
struct ndr_push *ndr;
enum ndr_err_code status;
@@ -958,7 +958,7 @@ _PUBLIC_ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_pus
/* avoid recursion */
if (flags & LIBNDR_FLAG_NO_NDR_SIZE) return 0;
- ndr = ndr_push_init_ctx(NULL, global_iconv_convenience);
+ ndr = ndr_push_init_ctx(NULL, iconv_convenience);
if (!ndr) return 0;
ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
diff --git a/librpc/ndr/ndr_krb5pac.c b/librpc/ndr/ndr_krb5pac.c
index 1b32df4c62..f6654f7380 100644
--- a/librpc/ndr/ndr_krb5pac.c
+++ b/librpc/ndr/ndr_krb5pac.c
@@ -23,9 +23,9 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_krb5pac.h"
-static size_t _ndr_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, int flags)
+static size_t _ndr_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, struct smb_iconv_convenience *ic, int flags)
{
- size_t s = ndr_size_PAC_INFO(r, level, flags);
+ size_t s = ndr_size_PAC_INFO(r, level, ic, flags);
switch (level) {
case PAC_TYPE_LOGON_INFO:
return NDR_ROUND(s,8);
@@ -34,9 +34,9 @@ static size_t _ndr_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, int fl
}
}
-static size_t _subcontext_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, int flags)
+static size_t _subcontext_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, struct smb_iconv_convenience *ic, int flags)
{
- size_t s = ndr_size_PAC_INFO(r, level, flags);
+ size_t s = ndr_size_PAC_INFO(r, level, ic, flags);
return NDR_ROUND(s,8);
}
@@ -45,7 +45,7 @@ enum ndr_err_code ndr_push_PAC_BUFFER(struct ndr_push *ndr, int ndr_flags, const
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_PAC_TYPE(ndr, NDR_SCALARS, r->type));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, _ndr_size_PAC_INFO(r->info,r->type,0)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, _ndr_size_PAC_INFO(r->info,r->type,ndr->iconv_convenience,0)));
{
uint32_t _flags_save_PAC_INFO = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8);
@@ -62,10 +62,10 @@ enum ndr_err_code ndr_push_PAC_BUFFER(struct ndr_push *ndr, int ndr_flags, const
NDR_CHECK(ndr_push_relative_ptr2(ndr, r->info));
{
struct ndr_push *_ndr_info;
- NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info, 0, _subcontext_size_PAC_INFO(r->info,r->type,0)));
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info, 0, _subcontext_size_PAC_INFO(r->info,r->type,ndr->iconv_convenience, 0)));
NDR_CHECK(ndr_push_set_switch_value(_ndr_info, r->info, r->type));
NDR_CHECK(ndr_push_PAC_INFO(_ndr_info, NDR_SCALARS|NDR_BUFFERS, r->info));
- NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info, 0, _subcontext_size_PAC_INFO(r->info,r->type,0)));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info, 0, _subcontext_size_PAC_INFO(r->info,r->type,ndr->iconv_convenience,0)));
}
}
ndr->flags = _flags_save_PAC_INFO;
@@ -127,7 +127,7 @@ void ndr_print_PAC_BUFFER(struct ndr_print *ndr, const char *name, const struct
ndr_print_struct(ndr, name, "PAC_BUFFER");
ndr->depth++;
ndr_print_PAC_TYPE(ndr, "type", r->type);
- ndr_print_uint32(ndr, "_ndr_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?_ndr_size_PAC_INFO(r->info,r->type,0):r->_ndr_size);
+ ndr_print_uint32(ndr, "_ndr_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?_ndr_size_PAC_INFO(r->info,r->type,ndr->iconv_convenience,0):r->_ndr_size);
ndr_print_ptr(ndr, "info", r->info);
ndr->depth++;
if (r->info) {
diff --git a/librpc/ndr/ndr_sec_helper.c b/librpc/ndr/ndr_sec_helper.c
index 898a4287ea..8f84c02f91 100644
--- a/librpc/ndr/ndr_sec_helper.c
+++ b/librpc/ndr/ndr_sec_helper.c
@@ -30,13 +30,13 @@
/*
return the wire size of a security_ace
*/
-size_t ndr_size_security_ace(const struct security_ace *ace, int flags)
+size_t ndr_size_security_ace(const struct security_ace *ace, struct smb_iconv_convenience *ic, int flags)
{
size_t ret;
if (!ace) return 0;
- ret = 8 + ndr_size_dom_sid(&ace->trustee, flags);
+ ret = 8 + ndr_size_dom_sid(&ace->trustee, ic, flags);
switch (ace->type) {
case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
@@ -91,14 +91,14 @@ enum ndr_err_code ndr_pull_security_ace(struct ndr_pull *ndr, int ndr_flags, str
/*
return the wire size of a security_acl
*/
-size_t ndr_size_security_acl(const struct security_acl *acl, int flags)
+size_t ndr_size_security_acl(const struct security_acl *acl, struct smb_iconv_convenience *ic, int flags)
{
size_t ret;
int i;
if (!acl) return 0;
ret = 8;
for (i=0;i<acl->num_aces;i++) {
- ret += ndr_size_security_ace(&acl->aces[i], flags);
+ ret += ndr_size_security_ace(&acl->aces[i], ic, flags);
}
return ret;
}
@@ -106,23 +106,23 @@ size_t ndr_size_security_acl(const struct security_acl *acl, int flags)
/*
return the wire size of a security descriptor
*/
-size_t ndr_size_security_descriptor(const struct security_descriptor *sd, int flags)
+size_t ndr_size_security_descriptor(const struct security_descriptor *sd, struct smb_iconv_convenience *ic, int flags)
{
size_t ret;
if (!sd) return 0;
ret = 20;
- ret += ndr_size_dom_sid(sd->owner_sid, flags);
- ret += ndr_size_dom_sid(sd->group_sid, flags);
- ret += ndr_size_security_acl(sd->dacl, flags);
- ret += ndr_size_security_acl(sd->sacl, flags);
+ ret += ndr_size_dom_sid(sd->owner_sid, ic, flags);
+ ret += ndr_size_dom_sid(sd->group_sid, ic, flags);
+ ret += ndr_size_security_acl(sd->dacl, ic, flags);
+ ret += ndr_size_security_acl(sd->sacl, ic, flags);
return ret;
}
/*
return the wire size of a dom_sid
*/
-size_t ndr_size_dom_sid(const struct dom_sid *sid, int flags)
+size_t ndr_size_dom_sid(const struct dom_sid *sid, struct smb_iconv_convenience *ic, int flags)
{
if (!sid) return 0;
return 8 + 4*sid->num_auths;