diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-01-05 02:01:19 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:08:18 -0500 |
commit | 58d9adf409ac11c5d8fd62cbb1bca9974cfbeb7d (patch) | |
tree | 635adb720a577497e3d8470e8de9ae7d15820752 /source4/librpc | |
parent | d9ab65a8b40b540f163b454c6d543f090759cdae (diff) | |
download | samba-58d9adf409ac11c5d8fd62cbb1bca9974cfbeb7d.tar.gz samba-58d9adf409ac11c5d8fd62cbb1bca9974cfbeb7d.tar.bz2 samba-58d9adf409ac11c5d8fd62cbb1bca9974cfbeb7d.zip |
r4526: - much simpler (and more accurate!) ndr_size_*() code generation. It
is less efficient, but I really doubt that matters.
- use enum in epmapper.idl for protocol type
- added support for "enum8bit" flag, used in epmapper.idl
(This used to be commit 1a24a50384b7f588844cd012f1218ca242ca4507)
Diffstat (limited to 'source4/librpc')
-rw-r--r-- | source4/librpc/idl/drsblobs.idl | 4 | ||||
-rw-r--r-- | source4/librpc/idl/epmapper.idl | 8 | ||||
-rw-r--r-- | source4/librpc/idl/netlogon.idl | 2 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr.c | 21 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.c | 2 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_util.c | 12 |
6 files changed, 39 insertions, 10 deletions
diff --git a/source4/librpc/idl/drsblobs.idl b/source4/librpc/idl/drsblobs.idl index ff8be33478..51c4071a25 100644 --- a/source4/librpc/idl/drsblobs.idl +++ b/source4/librpc/idl/drsblobs.idl @@ -94,13 +94,13 @@ interface drsblobs { typedef [gensize,flag(NDR_PAHEX)] struct { /* this includes the 8 bytes of the repsFromToBlob header */ - [value(ndr_size_repsFromTo1(8, r, ndr->flags))] uint32 blobsize; + [value(ndr_size_repsFromTo1(r, ndr->flags)+8)] uint32 blobsize; uint32 consecutive_sync_failures; NTTIME_1sec last_success; NTTIME_1sec last_attempt; WERROR result_last_attempt; [relative,length_is(other_info_length)] repsFromTo1OtherInfo *other_info; - [value(ndr_size_repsFromTo1OtherInfo(0, r->other_info, ndr->flags))] uint32 other_info_length; + [value(ndr_size_repsFromTo1OtherInfo(r->other_info, ndr->flags))] uint32 other_info_length; uint32 replica_flags; uint8 schedule[84]; uint32 reserved; diff --git a/source4/librpc/idl/epmapper.idl b/source4/librpc/idl/epmapper.idl index e32b01a874..9e59f721bf 100644 --- a/source4/librpc/idl/epmapper.idl +++ b/source4/librpc/idl/epmapper.idl @@ -41,7 +41,7 @@ interface epmapper uint16 version; } epm_prot_uuid; - typedef enum { + typedef [enum8bit] enum { /* Level 4 and higher */ EPM_PROTOCOL_DNET_NSP = 0x04, @@ -71,7 +71,7 @@ interface epmapper EPM_PROTOCOL_HTTP = 0x1f, EPM_PROTOCOL_UNIX_DS = 0x20, /* Unix domain socket */ EPM_PROTOCOL_NULL = 0x21 - } epm_protocols; + } epm_protocol; typedef [nodiscriminant] union { [case(EPM_PROTOCOL_UUID)] epm_prot_uuid uuid; @@ -206,7 +206,7 @@ interface epmapper } epm_rhs; typedef struct { - uint8 protocol; + epm_protocol protocol; [switch_is(protocol)] epm_protocol_info info; } epm_lhs; @@ -226,7 +226,7 @@ interface epmapper } epm_tower; typedef struct { - [value(ndr_size_epm_tower(0, &r->tower,ndr->flags))] uint32 tower_length; + [value(ndr_size_epm_tower(&r->tower, ndr->flags))] uint32 tower_length; [subcontext(4)] epm_tower tower; } epm_twr_t; diff --git a/source4/librpc/idl/netlogon.idl b/source4/librpc/idl/netlogon.idl index 582b21beff..ca867a265c 100644 --- a/source4/librpc/idl/netlogon.idl +++ b/source4/librpc/idl/netlogon.idl @@ -638,7 +638,7 @@ interface netlogon } netr_DELTA_ID_UNION; typedef struct { - uint16 delta_type; + netr_DeltaEnum delta_type; [switch_is(delta_type)] netr_DELTA_ID_UNION delta_id_union; [switch_is(delta_type)] netr_DELTA_UNION delta_union; } netr_DELTA_ENUM; diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index 0543fbf0d3..44915bac5b 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -862,3 +862,24 @@ NTSTATUS ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, return NT_STATUS_OK; } + +/* + generic ndr_size_*() handler for structures +*/ +size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push) +{ + struct ndr_push *ndr; + NTSTATUS status; + size_t ret; + + ndr = ndr_push_init_ctx(NULL); + if (!ndr) return 0; + ndr->flags |= flags; + status = push(ndr, NDR_SCALARS|NDR_BUFFERS, discard_const(p)); + if (!NT_STATUS_IS_OK(status)) { + return 0; + } + ret = ndr->offset; + talloc_free(ndr); + return ret; +} diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index e329297ab6..3fe2d87475 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -907,7 +907,7 @@ struct rpc_request *dcerpc_request_send(struct dcerpc_pipe *p, if (object) { pkt.u.request.object.object = *object; pkt.pfc_flags |= DCERPC_PFC_FLAG_ORPC; - chunk_size -= ndr_size_GUID(0,object,0); + chunk_size -= ndr_size_GUID(object,0); } DLIST_ADD(p->pending, req); diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index 8c454ab64f..4219b75392 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -137,7 +137,7 @@ static const struct { const char *name; enum dcerpc_transport_t transport; int num_protocols; - enum epm_protocols protseq[MAX_PROTSEQ]; + enum epm_protocol protseq[MAX_PROTSEQ]; } transports[] = { { "ncacn_np", NCACN_NP, 3, { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_SMB, EPM_PROTOCOL_NETBIOS }}, @@ -430,6 +430,10 @@ const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *flo case EPM_PROTOCOL_NULL: return NULL; + + default: + DEBUG(0,("Unsupported lhs protocol %d\n", floor->lhs.protocol)); + break; } return NULL; @@ -514,6 +518,10 @@ static NTSTATUS dcerpc_floor_set_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor case EPM_PROTOCOL_NULL: return NT_STATUS_OK; + + default: + DEBUG(0,("Unsupported lhs protocol %d\n", floor->lhs.protocol)); + break; } return NT_STATUS_NOT_SUPPORTED; @@ -602,7 +610,7 @@ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, struct epm_tower *tower, NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding, struct epm_tower *tower) { - const enum epm_protocols *protseq = NULL; + const enum epm_protocol *protseq = NULL; int num_protocols = -1, i; NTSTATUS status; |