summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2004-10-13 20:09:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:51 -0500
commit24c0fbc0e88bf0f7bc34f75c99aa276ca19b0163 (patch)
tree940194a51090bcac85fd42db4a2a5523cdea6b1d /source4/librpc
parentb5fde9d2df707638f0244af925fa4e85be395eef (diff)
downloadsamba-24c0fbc0e88bf0f7bc34f75c99aa276ca19b0163.tar.gz
samba-24c0fbc0e88bf0f7bc34f75c99aa276ca19b0163.tar.bz2
samba-24c0fbc0e88bf0f7bc34f75c99aa276ca19b0163.zip
r2956: Fix towers_length for now. I'm currently working on a pidl extension
that can generate these kinds of functions (This used to be commit ebca2516502560edfd4056fbb4cfc9718a108efa)
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/idl/epmapper.idl2
-rw-r--r--source4/librpc/rpc/dcerpc_util.c52
2 files changed, 53 insertions, 1 deletions
diff --git a/source4/librpc/idl/epmapper.idl b/source4/librpc/idl/epmapper.idl
index 4898bbda2e..fffd2606c0 100644
--- a/source4/librpc/idl/epmapper.idl
+++ b/source4/librpc/idl/epmapper.idl
@@ -194,7 +194,7 @@ interface epmapper
} epm_towers;
typedef struct {
- uint32 tower_length;
+ [value(ndr_size_epm_towers(&r->towers))] uint32 tower_length;
[subcontext(4)] epm_towers towers;
} epm_twr_t;
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index 5f3d911d15..fad8417c3f 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -23,6 +23,58 @@
#include "includes.h"
/*
+ this ndr_size_* stuff should really be auto-generated ....
+*/
+
+static size_t ndr_size_epm_floor(struct epm_floor *fl)
+{
+ size_t ret = 5;
+ if (fl->lhs.protocol == EPM_PROTOCOL_UUID) {
+ ret += 18;
+ } else {
+ ret += fl->lhs.info.lhs_data.length;
+ }
+ switch (fl->lhs.protocol) {
+ case EPM_PROTOCOL_TCP:
+ case EPM_PROTOCOL_UDP:
+ case EPM_PROTOCOL_HTTP:
+ case EPM_PROTOCOL_UUID:
+ ret += 2;
+ break;
+ case EPM_PROTOCOL_IP:
+ ret += 4;
+ break;
+ case EPM_PROTOCOL_NCADG:
+ case EPM_PROTOCOL_NCACN:
+ case EPM_PROTOCOL_NCALRPC:
+ ret += 2;
+ break;
+
+ case EPM_PROTOCOL_SMB:
+ ret += strlen(fl->rhs.smb.unc)+1;
+ break;
+ case EPM_PROTOCOL_PIPE:
+ ret += strlen(fl->rhs.pipe.path)+1;
+ break;
+ case EPM_PROTOCOL_NETBIOS:
+ ret += strlen(fl->rhs.netbios.name)+1;
+ break;
+ }
+
+ return ret;
+}
+
+size_t ndr_size_epm_towers(struct epm_towers *towers)
+{
+ size_t ret = 2;
+ int i;
+ for (i=0;i<towers->num_floors;i++) {
+ ret += ndr_size_epm_floor(&towers->floors[i]);
+ }
+ return ret;
+}
+
+/*
work out what TCP port to use for a given interface on a given host
*/
NTSTATUS dcerpc_epm_map_tcp_port(const char *server,