return NT_STATUS_OK;
}
+static struct dcesrv_auth *dcesrv_auth_create(struct dcesrv_connection *conn)
+{
+ const struct dcesrv_endpoint *ep = conn->endpoint;
+ enum dcerpc_transport_t transport =
+ dcerpc_binding_get_transport(ep->ep_description);
+ struct dcesrv_auth *auth = NULL;
+
+ auth = talloc_zero(conn, struct dcesrv_auth);
+ if (auth == NULL) {
+ return NULL;
+ }
+
+ switch (transport) {
+ case NCACN_NP:
+ auth->session_key_fn = dcesrv_remote_session_key;
+ break;
+ case NCALRPC:
+ case NCACN_UNIX_STREAM:
+ auth->session_key_fn = dcesrv_local_fixed_session_key;
+ break;
+ default:
+ /*
+ * All other's get a NULL pointer, which
+ * results in NT_STATUS_NO_USER_SESSION_KEY
+ */
+ break;
+ }
+
+ return auth;
+}
+
/*
connect to a dcerpc endpoint
*/
uint32_t state_flags,
struct dcesrv_connection **_p)
{
- enum dcerpc_transport_t transport =
- dcerpc_binding_get_transport(ep->ep_description);
+ struct dcesrv_auth *auth = NULL;
struct dcesrv_connection *p;
if (!session_info) {
p = talloc_zero(mem_ctx, struct dcesrv_connection);
NT_STATUS_HAVE_NO_MEMORY(p);
- if (!talloc_reference(p, session_info)) {
- talloc_free(p);
- return NT_STATUS_NO_MEMORY;
- }
-
p->dce_ctx = dce_ctx;
p->endpoint = ep;
p->packet_log_dir = lpcfg_lock_directory(dce_ctx->lp_ctx);
p->max_xmit_frag = 5840;
p->max_total_request_size = DCERPC_NCACN_REQUEST_DEFAULT_MAX_SIZE;
- p->auth_state.session_info = session_info;
- switch (transport) {
- case NCACN_NP:
- p->auth_state.session_key_fn = dcesrv_remote_session_key;
- break;
- case NCALRPC:
- case NCACN_UNIX_STREAM:
- p->auth_state.session_key_fn = dcesrv_local_fixed_session_key;
- break;
- default:
- /*
- * All other's get a NULL pointer, which
- * results in NT_STATUS_NO_USER_SESSION_KEY
- */
- break;
+ auth = dcesrv_auth_create(p);
+ if (auth == NULL) {
+ talloc_free(p);
+ return NT_STATUS_NO_MEMORY;
}
+ auth->session_info = talloc_reference(auth, session_info);
+ if (auth->session_info == NULL) {
+ talloc_free(p);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ p->default_auth_state = auth;
+
/*
* For now we only support NDR32.
*/
talloc_steal(call, blob.data);
call->pkt = *pkt;
- call->auth_state = &dce_conn->auth_state;
+ call->auth_state = dce_conn->default_auth_state;
talloc_set_destructor(call, dcesrv_call_dequeue);
auth->auth_context_id = call->in_auth_info.auth_context_id;
server_credentials
- = cli_credentials_init(call);
+ = cli_credentials_init(auth);
if (!server_credentials) {
DEBUG(1, ("Failed to init server credentials\n"));
return false;
return false;
}
- status = samba_server_gensec_start(dce_conn, call->event_ctx,
+ status = samba_server_gensec_start(auth,
+ call->event_ctx,
call->msg_ctx,
call->conn->dce_ctx->lp_ctx,
server_credentials,
}
status = gensec_session_info(auth->gensec_security,
- dce_conn,
+ auth,
&auth->session_info);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Failed to establish session_info: %s\n",