summaryrefslogtreecommitdiff
path: root/source4/winbind/wb_samba3_cmd.c
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2005-09-25 21:01:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:54 -0500
commit9593101ec118dd242bf25fabf3e17c58269e632c (patch)
treec06ef0370effd18294efff90624a177dae059bb7 /source4/winbind/wb_samba3_cmd.c
parent06085e7bc09e46c74fbe050633203fab619d501c (diff)
downloadsamba-9593101ec118dd242bf25fabf3e17c58269e632c.tar.gz
samba-9593101ec118dd242bf25fabf3e17c58269e632c.tar.bz2
samba-9593101ec118dd242bf25fabf3e17c58269e632c.zip
r10491: First step towards wbinfo -t: This issues a name request for the primary
domain and gets the DC's name via a mailslot call. Metze, I renamed wbsrv_queue_reply to wbsrv_send_reply in accordance with irpc_send_reply. Having _queue_ here and _send_ there is a bit confusing. And as everything is async anyway, the semantics should not be too much of a problem. Volker (This used to be commit 4637964b19c6e9f7d201b287e2d409d029fced01)
Diffstat (limited to 'source4/winbind/wb_samba3_cmd.c')
-rw-r--r--source4/winbind/wb_samba3_cmd.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/source4/winbind/wb_samba3_cmd.c b/source4/winbind/wb_samba3_cmd.c
index 14e9ac9e6d..4ff54e25b4 100644
--- a/source4/winbind/wb_samba3_cmd.c
+++ b/source4/winbind/wb_samba3_cmd.c
@@ -26,6 +26,10 @@
#include "nsswitch/winbindd_nss.h"
#include "winbind/wb_server.h"
#include "winbind/wb_samba3_protocol.h"
+#include "winbind/wb_async_helpers.h"
+#include "librpc/gen_ndr/nbt.h"
+#include "libcli/raw/libcliraw.h"
+#include "libcli/composite/composite.h"
NTSTATUS wbsrv_samba3_interface_version(struct wbsrv_samba3_call *s3call)
{
@@ -48,3 +52,63 @@ NTSTATUS wbsrv_samba3_ping(struct wbsrv_samba3_call *s3call)
s3call->response.result = WINBINDD_OK;
return NT_STATUS_OK;
}
+
+struct check_machacc_state {
+ struct wb_finddcs *io;
+};
+
+static void wbsrv_samba3_check_machacc_reply(struct composite_context *action)
+{
+ struct wbsrv_samba3_call *s3call =
+ talloc_get_type(action->async.private,
+ struct wbsrv_samba3_call);
+ struct check_machacc_state *state =
+ talloc_get_type(s3call->private_data,
+ struct check_machacc_state);
+ NTSTATUS status;
+
+ status = wb_finddcs_recv(action, s3call);
+ if (NT_STATUS_IS_OK(status)) {
+ DEBUG(10, ("Got name %s\n", state->io->out.dcs[0].name));
+ s3call->response.result = WINBINDD_OK;
+ } else {
+ DEBUG(10, ("Got no addr: %s\n", nt_errstr(status)));
+ s3call->response.result = WINBINDD_ERROR;
+ }
+
+ status = wbsrv_send_reply(s3call->call);
+ if (!NT_STATUS_IS_OK(status)) {
+ wbsrv_terminate_connection(s3call->call->wbconn,
+ "wbsrv_queue_reply() failed");
+ return;
+ }
+}
+
+NTSTATUS wbsrv_samba3_check_machacc(struct wbsrv_samba3_call *s3call)
+{
+ struct composite_context *resolve_req;
+ struct check_machacc_state *state;
+
+ DEBUG(5, ("check_machacc called\n"));
+
+ state = talloc(s3call, struct check_machacc_state);
+ NT_STATUS_HAVE_NO_MEMORY(state);
+
+ state->io = talloc(s3call, struct wb_finddcs);
+ NT_STATUS_HAVE_NO_MEMORY(state->io);
+ s3call->private_data = state;
+
+ state->io->in.msg_ctx = s3call->call->wbconn->conn->msg_ctx;
+ state->io->in.domain = lp_workgroup();
+
+ resolve_req = wb_finddcs_send(state->io, s3call->call->event_ctx);
+ NT_STATUS_HAVE_NO_MEMORY(resolve_req);
+
+ /* setup the callbacks */
+ resolve_req->async.fn = wbsrv_samba3_check_machacc_reply;
+ resolve_req->async.private = s3call;
+
+ /* tell the caller we reply later */
+ s3call->call->flags |= WBSRV_CALL_FLAGS_REPLY_ASYNC;
+ return NT_STATUS_OK;
+}