diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-06-24 01:18:56 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:18:44 -0500 |
commit | 152a6a00c31f52d14a63bfc977ac54713c56c9cd (patch) | |
tree | 82a0b1a45404f08f32b647a47b7c332469650fc8 /source4/librpc | |
parent | d60b11c1f0151dbd758b896ba2934a8efa4ada75 (diff) | |
download | samba-152a6a00c31f52d14a63bfc977ac54713c56c9cd.tar.gz samba-152a6a00c31f52d14a63bfc977ac54713c56c9cd.tar.bz2 samba-152a6a00c31f52d14a63bfc977ac54713c56c9cd.zip |
r7865: changed pidl to take a "const void *" instead of a "void *" for the
structure in ndr_push_*() and ndr_print_*(). The push and print
functions really should not modify the structure.
metze, to make this work I had to change your spoolss hand
marshaller. Can you please check it is OK? I think that the IN and OUT
sides of that function are not ever called on the same structure, so I
think that attempt at remembering the value by assigning to
r->in._offered was not doing anything anyway, but please correct me if
I have misunderstood it.
If you really do need to remember something on those structures I'd
suggest the ndr_token_store() and ndr_token_retrieve() functions,
which are used by pidl for just this sort of thing.
(This used to be commit eee528be97fa43ca53bdc5652b4d29a0a2caf563)
Diffstat (limited to 'source4/librpc')
-rw-r--r-- | source4/librpc/ndr/libndr.h | 7 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr.c | 2 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_drsuapi.c | 3 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_orpc.c | 8 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_sec.c | 4 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_sec_helper.c | 16 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_spoolss_buf.c | 22 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.c | 4 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.h | 6 |
9 files changed, 35 insertions, 37 deletions
diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h index 93cc67eaad..17c06b79da 100644 --- a/source4/librpc/ndr/libndr.h +++ b/source4/librpc/ndr/libndr.h @@ -247,9 +247,8 @@ enum ndr_compression_alg { #define NDR_PUSH_ALLOC(ndr, s) NDR_PUSH_ALLOC_SIZE(ndr, s, sizeof(*(s))) /* these are used when generic fn pointers are needed for ndr push/pull fns */ -typedef NTSTATUS (*ndr_push_flags_fn_t)(struct ndr_push *, int ndr_flags, void *); -typedef NTSTATUS (*ndr_push_const_fn_t)(struct ndr_push *, int ndr_flags, const void *); +typedef NTSTATUS (*ndr_push_flags_fn_t)(struct ndr_push *, int ndr_flags, const void *); typedef NTSTATUS (*ndr_pull_flags_fn_t)(struct ndr_pull *, int ndr_flags, void *); -typedef void (*ndr_print_fn_t)(struct ndr_print *, const char *, void *); -typedef void (*ndr_print_function_t)(struct ndr_print *, const char *, int, void *); +typedef void (*ndr_print_fn_t)(struct ndr_print *, const char *, const void *); +typedef void (*ndr_print_function_t)(struct ndr_print *, const char *, int, const void *); diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index 74997748a3..6694209c68 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -622,7 +622,7 @@ NTSTATUS ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p /* push a struct to a blob using NDR */ -NTSTATUS ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, +NTSTATUS ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p, ndr_push_flags_fn_t fn) { NTSTATUS status; diff --git a/source4/librpc/ndr/ndr_drsuapi.c b/source4/librpc/ndr/ndr_drsuapi.c index f2f8469f5e..6f6dd74ea4 100644 --- a/source4/librpc/ndr/ndr_drsuapi.c +++ b/source4/librpc/ndr/ndr_drsuapi.c @@ -24,7 +24,8 @@ #include "includes.h" #include "librpc/gen_ndr/ndr_drsuapi.h" -void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name, struct drsuapi_DsReplicaObjectListItem *r) +void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name, + const struct drsuapi_DsReplicaObjectListItem *r) { ndr_print_struct(ndr, name, "drsuapi_DsReplicaObjectListItem"); ndr->depth++; diff --git a/source4/librpc/ndr/ndr_orpc.c b/source4/librpc/ndr/ndr_orpc.c index ccfd48e099..782b640073 100644 --- a/source4/librpc/ndr/ndr_orpc.c +++ b/source4/librpc/ndr/ndr_orpc.c @@ -78,7 +78,7 @@ NTSTATUS ndr_pull_DUALSTRINGARRAY(struct ndr_pull *ndr, int ndr_flags, struct DU return NT_STATUS_OK; } -NTSTATUS ndr_push_DUALSTRINGARRAY(struct ndr_push *ndr, int ndr_flags, struct DUALSTRINGARRAY *ar) +NTSTATUS ndr_push_DUALSTRINGARRAY(struct ndr_push *ndr, int ndr_flags, const struct DUALSTRINGARRAY *ar) { return NT_STATUS_NOT_SUPPORTED; } @@ -86,7 +86,7 @@ NTSTATUS ndr_push_DUALSTRINGARRAY(struct ndr_push *ndr, int ndr_flags, struct DU /* print a dom_sid */ -void ndr_print_DUALSTRINGARRAY(struct ndr_print *ndr, const char *name, struct DUALSTRINGARRAY *ar) +void ndr_print_DUALSTRINGARRAY(struct ndr_print *ndr, const char *name, const struct DUALSTRINGARRAY *ar) { int i; ndr->print(ndr, "%-25s: DUALSTRINGARRAY", name); @@ -149,7 +149,7 @@ NTSTATUS ndr_pull_STRINGARRAY(struct ndr_pull *ndr, int ndr_flags, struct STRING return NT_STATUS_OK; } -NTSTATUS ndr_push_STRINGARRAY(struct ndr_push *ndr, int ndr_flags, struct STRINGARRAY *ar) +NTSTATUS ndr_push_STRINGARRAY(struct ndr_push *ndr, int ndr_flags, const struct STRINGARRAY *ar) { return NT_STATUS_NOT_SUPPORTED; } @@ -157,7 +157,7 @@ NTSTATUS ndr_push_STRINGARRAY(struct ndr_push *ndr, int ndr_flags, struct STRING /* print a dom_sid */ -void ndr_print_STRINGARRAY(struct ndr_print *ndr, const char *name, struct STRINGARRAY *ar) +void ndr_print_STRINGARRAY(struct ndr_print *ndr, const char *name, const struct STRINGARRAY *ar) { int i; ndr->print(ndr, "%-25s: STRINGARRAY", name); diff --git a/source4/librpc/ndr/ndr_sec.c b/source4/librpc/ndr/ndr_sec.c index 2e9bf86aac..c6eb98c58a 100644 --- a/source4/librpc/ndr/ndr_sec.c +++ b/source4/librpc/ndr/ndr_sec.c @@ -47,7 +47,7 @@ NTSTATUS ndr_pull_dom_sid2(struct ndr_pull *ndr, int ndr_flags, struct dom_sid * /* parse a dom_sid2 - this is a dom_sid but with an extra copy of the num_auths field */ -NTSTATUS ndr_push_dom_sid2(struct ndr_push *ndr, int ndr_flags, struct dom_sid *sid) +NTSTATUS ndr_push_dom_sid2(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid) { if (!(ndr_flags & NDR_SCALARS)) { return NT_STATUS_OK; @@ -89,7 +89,7 @@ NTSTATUS ndr_pull_dom_sid28(struct ndr_pull *ndr, int ndr_flags, struct dom_sid /* push a dom_sid28 - this is a dom_sid in a 28 byte fixed buffer */ -NTSTATUS ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, struct dom_sid *sid) +NTSTATUS ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid) { uint32_t old_offset; uint32_t padding; diff --git a/source4/librpc/ndr/ndr_sec_helper.c b/source4/librpc/ndr/ndr_sec_helper.c index 268f270ebe..8325aef93d 100644 --- a/source4/librpc/ndr/ndr_sec_helper.c +++ b/source4/librpc/ndr/ndr_sec_helper.c @@ -27,7 +27,7 @@ /* return the wire size of a dom_sid */ -size_t ndr_size_dom_sid(struct dom_sid *sid) +size_t ndr_size_dom_sid(const struct dom_sid *sid) { if (!sid) return 0; return 8 + 4*sid->num_auths; @@ -36,7 +36,7 @@ size_t ndr_size_dom_sid(struct dom_sid *sid) /* return the wire size of a dom_sid */ -size_t ndr_length_dom_sid(struct dom_sid *sid) +size_t ndr_length_dom_sid(const struct dom_sid *sid) { if (!sid) return 0; if (sid->sid_rev_num == 0) return 0; @@ -46,7 +46,7 @@ size_t ndr_length_dom_sid(struct dom_sid *sid) /* return the wire size of a security_ace */ -size_t ndr_size_security_ace(struct security_ace *ace) +size_t ndr_size_security_ace(const struct security_ace *ace) { if (!ace) return 0; return 8 + ndr_size_dom_sid(&ace->trustee); @@ -56,7 +56,7 @@ size_t ndr_size_security_ace(struct security_ace *ace) /* return the wire size of a security_acl */ -size_t ndr_size_security_acl(struct security_acl *acl) +size_t ndr_size_security_acl(const struct security_acl *acl) { size_t ret; int i; @@ -71,7 +71,7 @@ size_t ndr_size_security_acl(struct security_acl *acl) /* return the wire size of a security descriptor */ -size_t ndr_size_security_descriptor(struct security_descriptor *sd) +size_t ndr_size_security_descriptor(const struct security_descriptor *sd) { size_t ret; if (!sd) return 0; @@ -87,17 +87,17 @@ size_t ndr_size_security_descriptor(struct security_descriptor *sd) /* print a dom_sid */ -void ndr_print_dom_sid(struct ndr_print *ndr, const char *name, struct dom_sid *sid) +void ndr_print_dom_sid(struct ndr_print *ndr, const char *name, const struct dom_sid *sid) { ndr->print(ndr, "%-25s: %s", name, dom_sid_string(ndr, sid)); } -void ndr_print_dom_sid2(struct ndr_print *ndr, const char *name, struct dom_sid *sid) +void ndr_print_dom_sid2(struct ndr_print *ndr, const char *name, const struct dom_sid *sid) { ndr_print_dom_sid(ndr, name, sid); } -void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, struct dom_sid *sid) +void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct dom_sid *sid) { ndr_print_dom_sid(ndr, name, sid); } diff --git a/source4/librpc/ndr/ndr_spoolss_buf.c b/source4/librpc/ndr/ndr_spoolss_buf.c index 46b72eaa5f..594c56dda3 100644 --- a/source4/librpc/ndr/ndr_spoolss_buf.c +++ b/source4/librpc/ndr/ndr_spoolss_buf.c @@ -179,7 +179,7 @@ /* spoolss_EnumPrinters */ -NTSTATUS ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, int flags, struct spoolss_EnumPrinters *r) +NTSTATUS ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinters *r) { NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinters,{ _r.in.flags = r->in.flags; @@ -211,7 +211,7 @@ uint32_t ndr_size_spoolss_EnumPrinters_info(TALLOC_CTX *mem_ctx, uint32_t level, /* spoolss_EnumJobs */ -NTSTATUS ndr_push_spoolss_EnumJobs(struct ndr_push *ndr, int flags, struct spoolss_EnumJobs *r) +NTSTATUS ndr_push_spoolss_EnumJobs(struct ndr_push *ndr, int flags, const struct spoolss_EnumJobs *r) { NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumJobs,{ _r.in.handle = r->in.handle; @@ -247,7 +247,7 @@ uint32_t ndr_size_spoolss_EnumJobss_info(TALLOC_CTX *mem_ctx, uint32_t level, ui /* spoolss_EnumPrinterDrivers */ -NTSTATUS ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push *ndr, int flags, struct spoolss_EnumPrinterDrivers *r) +NTSTATUS ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDrivers *r) { NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinterDrivers,{ _r.in.server = r->in.server; @@ -279,7 +279,7 @@ uint32_t ndr_size_spoolss_EnumPrinterDrivers_info(TALLOC_CTX *mem_ctx, uint32_t /* spoolss_EnumForms */ -NTSTATUS ndr_push_spoolss_EnumForms(struct ndr_push *ndr, int flags, struct spoolss_EnumForms *r) +NTSTATUS ndr_push_spoolss_EnumForms(struct ndr_push *ndr, int flags, const struct spoolss_EnumForms *r) { NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumForms,{ _r.in.handle = r->in.handle; @@ -307,7 +307,7 @@ uint32_t ndr_size_spoolss_EnumForms_info(TALLOC_CTX *mem_ctx, uint32_t level, ui /* spoolss_EnumPorts */ -NTSTATUS ndr_push_spoolss_EnumPorts(struct ndr_push *ndr, int flags, struct spoolss_EnumPorts *r) +NTSTATUS ndr_push_spoolss_EnumPorts(struct ndr_push *ndr, int flags, const struct spoolss_EnumPorts *r) { NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPorts,{ _r.in.servername= r->in.servername; @@ -335,7 +335,7 @@ uint32_t ndr_size_spoolss_EnumPorts_info(TALLOC_CTX *mem_ctx, uint32_t level, ui /* spoolss_EnumMonitors */ -NTSTATUS ndr_push_spoolss_EnumMonitors(struct ndr_push *ndr, int flags, struct spoolss_EnumMonitors *r) +NTSTATUS ndr_push_spoolss_EnumMonitors(struct ndr_push *ndr, int flags, const struct spoolss_EnumMonitors *r) { NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumMonitors,{ _r.in.servername= r->in.servername; @@ -363,7 +363,7 @@ uint32_t ndr_size_spoolss_EnumMonitors_info(TALLOC_CTX *mem_ctx, uint32_t level, /* spoolss_EnumPrintProcessors */ -NTSTATUS ndr_push_spoolss_EnumPrintProcessors(struct ndr_push *ndr, int flags, struct spoolss_EnumPrintProcessors *r) +NTSTATUS ndr_push_spoolss_EnumPrintProcessors(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcessors *r) { NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcessors,{ _r.in.servername = r->in.servername; @@ -395,7 +395,7 @@ uint32_t ndr_size_spoolss_EnumPrinterProcessors_info(TALLOC_CTX *mem_ctx, uint32 /* spoolss_GetPrinterData */ -NTSTATUS ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flags, struct spoolss_GetPrinterData *r) +NTSTATUS ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterData *r) { struct _spoolss_GetPrinterData _r; if (flags & NDR_IN) { @@ -487,7 +487,7 @@ NTSTATUS ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct /* spoolss_SetPrinterData */ -NTSTATUS ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flags, struct spoolss_SetPrinterData *r) +NTSTATUS ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterData *r) { struct _spoolss_SetPrinterData _r; if (flags & NDR_IN) { @@ -504,13 +504,11 @@ NTSTATUS ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flags, struct NDR_CHECK(ndr_push___spoolss_SetPrinterData(_ndr_data, NDR_OUT, &__r)); _data_blob_data = ndr_push_blob(_ndr_data); - r->in._offered = _data_blob_data.length; - _r.in.handle = r->in.handle; _r.in.value_name= r->in.value_name; _r.in.type = r->in.type; _r.in.data = _data_blob_data; - _r.in._offered = r->in._offered; + _r.in._offered = _data_blob_data.length; _r.out.result = r->out.result; NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr, flags, &_r)); } diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index bd4756cb21..d253fcaacc 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -1069,8 +1069,8 @@ static NTSTATUS dcerpc_ndr_validate_in(struct dcerpc_connection *c, TALLOC_CTX *mem_ctx, DATA_BLOB blob, size_t struct_size, - NTSTATUS (*ndr_push)(struct ndr_push *, int, void *), - NTSTATUS (*ndr_pull)(struct ndr_pull *, int, void *)) + ndr_push_flags_fn_t ndr_push, + ndr_pull_flags_fn_t ndr_pull) { void *st; struct ndr_pull *pull; diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h index 3b1cc20bca..c5b0ad159b 100644 --- a/source4/librpc/rpc/dcerpc.h +++ b/source4/librpc/rpc/dcerpc.h @@ -142,9 +142,9 @@ struct dcerpc_pipe { struct dcerpc_interface_call { const char *name; size_t struct_size; - NTSTATUS (*ndr_push)(struct ndr_push *, int , void *); - NTSTATUS (*ndr_pull)(struct ndr_pull *, int , void *); - void (*ndr_print)(struct ndr_print *, const char *, int, void *); + ndr_push_flags_fn_t ndr_push; + ndr_pull_flags_fn_t ndr_pull; + ndr_print_function_t ndr_print; }; struct dcerpc_endpoint_list { |