summaryrefslogtreecommitdiffstats
path: root/source4/winbind/wb_connect_lsa.c
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2005-11-20 17:34:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:46:32 -0500
commita6852523d677f6c39a92e0e2b5d970211b29558b (patch)
tree814c6e25c913b0e259a6e24f3557bbd8bb7c8829 /source4/winbind/wb_connect_lsa.c
parentb31fe2d42b87d797d5f208946029cf8965bf0049 (diff)
downloadsamba-a6852523d677f6c39a92e0e2b5d970211b29558b.tar.gz
samba-a6852523d677f6c39a92e0e2b5d970211b29558b.tar.xz
samba-a6852523d677f6c39a92e0e2b5d970211b29558b.zip
r11812: Convert winbind to the async bind routines. Also remove tridge's hack for the
winbind "bug" :-) Volker (This used to be commit fb9a3c7ef376f289288c71bc47d67f548ddb7194)
Diffstat (limited to 'source4/winbind/wb_connect_lsa.c')
-rw-r--r--source4/winbind/wb_connect_lsa.c65
1 files changed, 52 insertions, 13 deletions
diff --git a/source4/winbind/wb_connect_lsa.c b/source4/winbind/wb_connect_lsa.c
index d5222a68546..9443ef0dc7c 100644
--- a/source4/winbind/wb_connect_lsa.c
+++ b/source4/winbind/wb_connect_lsa.c
@@ -43,6 +43,8 @@ struct init_lsa_state {
};
static void init_lsa_recv_pipe(struct composite_context *ctx);
+static void init_lsa_recv_anon_bind(struct composite_context *ctx);
+static void init_lsa_recv_auth_bind(struct composite_context *ctx);
static void init_lsa_recv_openpol(struct rpc_request *req);
struct composite_context *wb_init_lsa_send(TALLOC_CTX *mem_ctx,
@@ -86,17 +88,17 @@ static void init_lsa_recv_pipe(struct composite_context *ctx)
struct init_lsa_state *state =
talloc_get_type(ctx->async.private_data,
struct init_lsa_state);
- struct rpc_request *req;
state->ctx->status = dcerpc_pipe_open_smb_recv(ctx);
if (!composite_is_ok(state->ctx)) return;
switch (state->auth_type) {
case DCERPC_AUTH_TYPE_NONE:
- state->ctx->status =
- dcerpc_bind_auth_none(state->lsa_pipe,
- DCERPC_LSARPC_UUID,
- DCERPC_LSARPC_VERSION);
+ ctx = dcerpc_bind_auth_none_send(state, state->lsa_pipe,
+ DCERPC_LSARPC_UUID,
+ DCERPC_LSARPC_VERSION);
+ composite_continue(state->ctx, ctx, init_lsa_recv_anon_bind,
+ state);
break;
case DCERPC_AUTH_TYPE_NTLMSSP:
case DCERPC_AUTH_TYPE_SCHANNEL:
@@ -105,17 +107,54 @@ static void init_lsa_recv_pipe(struct composite_context *ctx)
return;
}
state->lsa_pipe->conn->flags |= (DCERPC_SIGN | DCERPC_SEAL);
- state->ctx->status =
- dcerpc_bind_auth(state->lsa_pipe,
- DCERPC_LSARPC_UUID,
- DCERPC_LSARPC_VERSION,
- state->creds, state->auth_type,
- NULL);
+ ctx = dcerpc_bind_auth_send(state, state->lsa_pipe,
+ DCERPC_LSARPC_UUID,
+ DCERPC_LSARPC_VERSION,
+ state->creds, state->auth_type,
+ NULL);
+ composite_continue(state->ctx, ctx, init_lsa_recv_auth_bind,
+ state);
break;
default:
- state->ctx->status = NT_STATUS_INTERNAL_ERROR;
-
+ composite_error(state->ctx, NT_STATUS_INTERNAL_ERROR);
}
+}
+
+static void init_lsa_recv_anon_bind(struct composite_context *ctx)
+{
+ struct init_lsa_state *state =
+ talloc_get_type(ctx->async.private_data,
+ struct init_lsa_state);
+ struct rpc_request *req;
+
+ state->ctx->status = dcerpc_bind_auth_none_recv(ctx);
+ if (!composite_is_ok(state->ctx)) return;
+
+ state->handle = talloc(state, struct policy_handle);
+ if (composite_nomem(state->handle, state->ctx)) return;
+
+ state->openpolicy.in.system_name =
+ talloc_asprintf(state, "\\\\%s",
+ dcerpc_server_name(state->lsa_pipe));
+ ZERO_STRUCT(state->objectattr);
+ state->openpolicy.in.attr = &state->objectattr;
+ state->openpolicy.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
+ state->openpolicy.out.handle = state->handle;
+
+ req = dcerpc_lsa_OpenPolicy2_send(state->lsa_pipe, state,
+ &state->openpolicy);
+ composite_continue_rpc(state->ctx, req, init_lsa_recv_openpol, state);
+}
+
+static void init_lsa_recv_auth_bind(struct composite_context *ctx)
+{
+ struct init_lsa_state *state =
+ talloc_get_type(ctx->async.private_data,
+ struct init_lsa_state);
+ struct rpc_request *req;
+
+ state->ctx->status = dcerpc_bind_auth_recv(ctx);
+ if (!composite_is_ok(state->ctx)) return;
state->handle = talloc(state, struct policy_handle);
if (composite_nomem(state->handle, state->ctx)) return;