summaryrefslogtreecommitdiff
path: root/source4/rpc_server/handles.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-12-16 09:50:49 +0000
committerAndrew Tridgell <tridge@samba.org>2003-12-16 09:50:49 +0000
commit6f12e4ace1609fbf00d42226134b1dbb259f38bc (patch)
tree7f116155578f01adfed2c4c5085a022b717025ea /source4/rpc_server/handles.c
parent7779b1e00022599f9b77dab7f5f983d930514f15 (diff)
downloadsamba-6f12e4ace1609fbf00d42226134b1dbb259f38bc.tar.gz
samba-6f12e4ace1609fbf00d42226134b1dbb259f38bc.tar.bz2
samba-6f12e4ace1609fbf00d42226134b1dbb259f38bc.zip
it turns out that a wire policy handle isn't a blob either, its a
uint32 followed by a GUID. I needed to fix this to support running in mixed-mode rpc (where smbtorture is bigendian and w2k3 is little-endian). Otherwise when you send back a policy handle the server doesn't recognise it. (This used to be commit 9b1c76a8e9e953e051072441f8938ee17a674d35)
Diffstat (limited to 'source4/rpc_server/handles.c')
-rw-r--r--source4/rpc_server/handles.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/source4/rpc_server/handles.c b/source4/rpc_server/handles.c
index 6b7d422267..df7745f6da 100644
--- a/source4/rpc_server/handles.c
+++ b/source4/rpc_server/handles.c
@@ -43,15 +43,9 @@ struct dcesrv_handle *dcesrv_handle_new(struct dcesrv_state *dce,
h->mem_ctx = mem_ctx;
h->data = NULL;
- memset(h->wire_handle.data, 'H', sizeof(h->wire_handle.data));
- strncpy(h->wire_handle.data, dce->ndr->name, 11);
- h->wire_handle.data[11] = handle_type;
+ h->wire_handle.handle_type = handle_type;
+ uuid_generate_random(&h->wire_handle.uuid);
- /* TODO: check for wraparound here */
- SIVAL(&h->wire_handle.data, 12, random());
- dce->next_handle++;
- SIVAL(&h->wire_handle.data, 16, dce->next_handle);
-
DLIST_ADD(dce->handles, h);
return h;
@@ -78,12 +72,18 @@ struct dcesrv_handle *dcesrv_handle_fetch(struct dcesrv_state *dce,
{
struct dcesrv_handle *h;
- if (all_zero(p->data, sizeof(p->data))) {
+ if (p->handle_type == 0 && uuid_all_zero(&p->uuid)) {
return dcesrv_handle_new(dce, handle_type);
}
for (h=dce->handles; h; h=h->next) {
- if (memcmp(h->wire_handle.data, p->data, sizeof(p->data)) == 0) {
+ if (h->wire_handle.handle_type == p->handle_type &&
+ uuid_equal(&p->uuid, &h->wire_handle.uuid)) {
+ if (p->handle_type != handle_type) {
+ DEBUG(0,("client gave us the wrong handle type (%d should be %d)\n",
+ p->handle_type, handle_type));
+ return NULL;
+ }
return h;
}
}