/* version 1 - initial version - metze */
#define DCERPC_MODULE_VERSION 1
-enum endpoint_type {ENDPOINT_SMB, ENDPOINT_TCP};
-
-/* a description of a single dcerpc endpoint. Not as flexible as a full epm tower,
- but much easier to work with */
-struct dcesrv_ep_description {
- enum endpoint_type type;
- union {
- const char *smb_pipe;
- uint32_t tcp_port;
- } info;
-};
-
struct dcesrv_connection;
struct dcesrv_call_state;
struct dcesrv_auth;
-/* the dispatch functions for an interface take this form */
-typedef NTSTATUS (*dcesrv_dispatch_fn_t)(struct dcesrv_call_state *, TALLOC_CTX *, void *);
-
struct dcesrv_interface {
- /* the ndr function table for the chosen interface */
- const struct dcerpc_interface_table *ndr;
+ const char *name;
+ const char *uuid;
+ uint32_t if_version;
/* this function is called when the client binds to this interface */
NTSTATUS (*bind)(struct dcesrv_call_state *, const struct dcesrv_interface *);
/* this function is called when the client disconnects the endpoint */
void (*unbind)(struct dcesrv_connection *, const struct dcesrv_interface *);
+
+ /* the ndr_pull function for the chosen interface.
+ */
+ NTSTATUS (*ndr_pull)(struct dcesrv_call_state *, TALLOC_CTX *, struct ndr_pull *, void **);;
+
/* the dispatch function for the chosen interface.
*/
- dcesrv_dispatch_fn_t dispatch;
-};
+ NTSTATUS (*dispatch)(struct dcesrv_call_state *, TALLOC_CTX *, void *);
+
+ /* the ndr_push function for the chosen interface.
+ */
+ NTSTATUS (*ndr_push)(struct dcesrv_call_state *, TALLOC_CTX *, struct ndr_push *,void *);
+
+ /* for any private use by the interface code */
+ const void *private;
+};
/* the state of an ongoing dcerpc call */
struct dcesrv_call_state {
struct dcesrv_call_state *next, *prev;
struct dcesrv_connection *conn;
- TALLOC_CTX *mem_ctx;
struct dcerpc_packet pkt;
DATA_BLOB input;
struct dcesrv_handle {
struct dcesrv_handle *next, *prev;
struct policy_handle wire_handle;
- TALLOC_CTX *mem_ctx;
void *data;
void (*destroy)(struct dcesrv_connection *, struct dcesrv_handle *);
};
-struct dcesrv_crypto_ops {
- const char *name;
- uint8 auth_type;
- NTSTATUS (*start)(struct dcesrv_auth *auth);
- NTSTATUS (*update)(struct dcesrv_auth *auth, TALLOC_CTX *out_mem_ctx,
- const DATA_BLOB in, DATA_BLOB *out);
- NTSTATUS (*session_info)(struct dcesrv_auth *auth, struct auth_session_info **session_info);
- NTSTATUS (*seal)(struct dcesrv_auth *auth, TALLOC_CTX *sig_mem_ctx,
- uint8_t *data, size_t length, DATA_BLOB *sig);
- NTSTATUS (*sign)(struct dcesrv_auth *auth, TALLOC_CTX *sig_mem_ctx,
- const uint8_t *data, size_t length, DATA_BLOB *sig);
- NTSTATUS (*check_sig)(struct dcesrv_auth *auth, TALLOC_CTX *sig_mem_ctx,
- const uint8_t *data, size_t length, const DATA_BLOB *sig);
- NTSTATUS (*unseal)(struct dcesrv_auth *auth, TALLOC_CTX *sig_mem_ctx,
- uint8_t *data, size_t length, DATA_BLOB *sig);
- void (*end)(struct dcesrv_auth *auth);
-};
-
/* hold the authentication state information */
struct dcesrv_auth {
struct dcerpc_auth *auth_info;
- struct {
- void *private_data;
- const struct dcesrv_crypto_ops *ops;
- } crypto_ctx;
+ struct gensec_security *gensec_security;
+ struct auth_session_info *session_info;
+ NTSTATUS (*session_key)(struct dcesrv_connection *, DATA_BLOB *session_key);
};
/* the top level context for this server */
struct dcesrv_context *dce_ctx;
- TALLOC_CTX *mem_ctx;
-
/* the endpoint that was opened */
const struct dcesrv_endpoint *endpoint;
/* the current authentication state */
struct dcesrv_auth auth_state;
- /* the transport level session key, if any */
- DATA_BLOB session_key;
+ struct server_connection *srv_conn;
+
+ /* the transport level session key */
+ DATA_BLOB transport_session_key;
};
/* this function can be used by other endpoint servers to
* ask for a dcesrv_interface implementation
- * - iface must be referenz to an allready existent struct !
+ * - iface must be reference to an already existing struct !
*/
BOOL (*interface_by_uuid)(struct dcesrv_interface *iface, const char *, uint32_t);
/* this function can be used by other endpoint servers to
* ask for a dcesrv_interface implementation
- * - iface must be referenz to an allready existent struct !
+ * - iface must be reference to an already existeng struct !
*/
BOOL (*interface_by_name)(struct dcesrv_interface *iface, const char *);
};
/* server-wide context information for the dcerpc server */
struct dcesrv_context {
- TALLOC_CTX *mem_ctx;
-
/* the list of endpoints that have registered
* by the configured endpoint servers
*/
struct dcesrv_endpoint {
struct dcesrv_endpoint *next, *prev;
/* the type and location of the endpoint */
- struct dcesrv_ep_description ep_description;
+ struct dcerpc_binding ep_description;
/* the security descriptor for smb named pipes */
struct security_descriptor *sd;
/* the list of interfaces available on this endpoint */
int sizeof_dcesrv_context;
int sizeof_dcesrv_endpoint;
int sizeof_dcesrv_endpoint_server;
- int sizeof_dcesrv_ep_description;
int sizeof_dcesrv_interface;
int sizeof_dcesrv_if_list;
int sizeof_dcesrv_connection;