1
0
mirror of https://github.com/samba-team/samba.git synced 2025-10-29 04:23:51 +03:00

added a basic dcerpc endpoint mapper to Samba4. Currently only

implements the epm_Lookup() call, I'll add the other important calls
soon. I was rather pleased to find that epm_Lookup() worked first
time, which is particularly surprising given its complexity.

This required quite a bit of new infrastructure:

  * a generic way of handling dcerpc policy handles in the rpc server

  * added type checked varients of talloc. These are much less error
    prone. I'd like to move to using these for nearly all uses of
    talloc.

  * added more dcerpc fault handling code, and translation from
    NTSTATUS to a dcerpc fault code

  * added data_blob_talloc_zero() for allocating an initially zero
    blob

  * added a endpoint enumeration hook in the dcerpc endpoint server
    operations
This commit is contained in:
Andrew Tridgell
-
parent 30a996b682
commit 3f85f9b782
14 changed files with 562 additions and 39 deletions

View File

@@ -23,7 +23,8 @@
enum endpoint_type {ENDPOINT_SMB, ENDPOINT_TCP};
/* a description of a single dcerpc endpoint */
/* a description of a single dcerpc endpoint. Not as flexible as a full epm tower,
but much easier to work with */
struct dcesrv_endpoint {
enum endpoint_type type;
union {
@@ -32,6 +33,13 @@ struct dcesrv_endpoint {
} info;
};
/* a endpoint combined with an interface description */
struct dcesrv_ep_iface {
struct dcesrv_endpoint endpoint;
const char *uuid;
uint32 if_version;
};
struct dcesrv_state;
/* the dispatch functions for an interface take this form */
@@ -50,8 +58,20 @@ struct dcesrv_call_state {
} *replies;
};
/* a dcerpc handle in internal format */
struct dcesrv_handle {
struct dcesrv_handle *next, *prev;
struct policy_handle wire_handle;
TALLOC_CTX *mem_ctx;
void *data;
};
/* the state associated with a dcerpc server connection */
struct dcesrv_state {
/* the top level context for this server */
struct server_context *smb;
TALLOC_CTX *mem_ctx;
/* the endpoint that was opened */
@@ -75,6 +95,11 @@ struct dcesrv_state {
/* private data for the endpoint server */
void *private;
/* current rpc handles - this is really the wrong scope for
them, but it will do for now */
uint32 next_handle;
struct dcesrv_handle *handles;
};
@@ -92,6 +117,10 @@ struct dcesrv_endpoint_ops {
/* disconnect() is called when the endpoint is disconnected */
void (*disconnect)(struct dcesrv_state *);
/* this function is used to ask an endpoint server for a list
of endpoints it wants to handle */
int (*lookup_endpoints)(TALLOC_CTX *mem_ctx, struct dcesrv_ep_iface **);
};