summaryrefslogtreecommitdiff
path: root/source4/winbind/wb_samba3_cmd.c
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2005-10-03 17:36:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:39:19 -0500
commit012893cb421d77efc538c9f4c78b2421aef3f06e (patch)
treebcc108dc0ffb1295908ffa17ec577d66c36a6413 /source4/winbind/wb_samba3_cmd.c
parent4a34e81ccc609366089d9a3f6c3a04c228cac8b3 (diff)
downloadsamba-012893cb421d77efc538c9f4c78b2421aef3f06e.tar.gz
samba-012893cb421d77efc538c9f4c78b2421aef3f06e.tar.bz2
samba-012893cb421d77efc538c9f4c78b2421aef3f06e.zip
r10691: This gets half-way to wbinfo -n. It acquires an lsa pipe, and does a
queryinfopolicy. Idea is to get a consistency check between that and our notion of the domain name and sid, and take the lsa pipe as the holder of the central smbcli_tree that netlogon and samr use as well. Volker (This used to be commit 126c80aefc4f53c4ba79afc12d70602ef9055ddb)
Diffstat (limited to 'source4/winbind/wb_samba3_cmd.c')
-rw-r--r--source4/winbind/wb_samba3_cmd.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/source4/winbind/wb_samba3_cmd.c b/source4/winbind/wb_samba3_cmd.c
index d4bfbd6219..751c48f8fd 100644
--- a/source4/winbind/wb_samba3_cmd.c
+++ b/source4/winbind/wb_samba3_cmd.c
@@ -311,3 +311,80 @@ static void wbsrv_samba3_check_machacc_receive_creds(struct composite_context *a
return;
}
}
+
+struct lookupname_state {
+ struct wbsrv_samba3_call *s3call;
+ struct wb_get_lsa_pipe *getlsa;
+};
+
+static void lookupname_recv_lsa(struct composite_context *req);
+
+NTSTATUS wbsrv_samba3_lookupname(struct wbsrv_samba3_call *s3call)
+{
+ struct composite_context *ctx;
+ struct lookupname_state *state;
+ struct wbsrv_service *service =
+ s3call->call->wbconn->listen_socket->service;
+
+ DEBUG(5, ("wbsrv_samba3_lookupname called\n"));
+
+ talloc_free(service->lsa_pipe);
+ service->lsa_pipe = NULL;
+
+ state = talloc(s3call, struct lookupname_state);
+ NT_STATUS_HAVE_NO_MEMORY(state);
+
+ state->s3call = s3call;
+ state->getlsa = talloc(s3call, struct wb_get_lsa_pipe);
+ NT_STATUS_HAVE_NO_MEMORY(state->getlsa);
+
+ state->getlsa->in.msg_ctx = s3call->call->wbconn->conn->msg_ctx;
+ state->getlsa->in.event_ctx = s3call->call->event_ctx;
+ state->getlsa->in.domain = lp_workgroup();
+
+ ctx = wb_get_lsa_pipe_send(state->getlsa);
+ NT_STATUS_HAVE_NO_MEMORY(ctx);
+
+ /* setup the callbacks */
+ ctx->async.fn = lookupname_recv_lsa;
+ ctx->async.private_data = state;
+
+ /* tell the caller we reply later */
+ s3call->call->flags |= WBSRV_CALL_FLAGS_REPLY_ASYNC;
+ return NT_STATUS_OK;
+}
+
+static void lookupname_recv_lsa(struct composite_context *ctx)
+{
+ struct lookupname_state *state =
+ talloc_get_type(ctx->async.private_data,
+ struct lookupname_state);
+ struct wbsrv_service *service =
+ state->s3call->call->wbconn->listen_socket->service;
+ NTSTATUS status;
+
+ status = wb_get_lsa_pipe_recv(ctx, service);
+ if (!NT_STATUS_IS_OK(status)) goto done;
+
+ service->lsa_pipe = state->getlsa->out.pipe;
+
+ done:
+ if (!NT_STATUS_IS_OK(status)) {
+ struct winbindd_response *resp = &state->s3call->response;
+ resp->result = WINBINDD_ERROR;
+ WBSRV_SAMBA3_SET_STRING(resp->data.auth.nt_status_string,
+ nt_errstr(status));
+ WBSRV_SAMBA3_SET_STRING(resp->data.auth.error_string,
+ nt_errstr(status));
+ resp->data.auth.pam_error = nt_status_to_pam(status);
+
+ }
+
+ status = wbsrv_send_reply(state->s3call->call);
+ if (!NT_STATUS_IS_OK(status)) {
+ wbsrv_terminate_connection(state->s3call->call->wbconn,
+ "wbsrv_queue_reply() failed");
+ return;
+ }
+
+}