summaryrefslogtreecommitdiffstats
path: root/source4/winbind/wb_irpc.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-07-31 15:38:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:15:17 -0500
commite48ed74f4a2fe490d70c444dca3aa9419409579f (patch)
tree5dd259e04d4c6e1b3ea8f825923320994e57ffc9 /source4/winbind/wb_irpc.c
parent7a845bcb0141a895d5685afcef1ffe7f93428d0f (diff)
downloadsamba-e48ed74f4a2fe490d70c444dca3aa9419409579f.tar.gz
samba-e48ed74f4a2fe490d70c444dca3aa9419409579f.tar.xz
samba-e48ed74f4a2fe490d70c444dca3aa9419409579f.zip
r17342: implement a SamLogon via IRPC in samba4's winbind
metze (This used to be commit c3ce7a0c3708f0c8e784404e86034f7a00685f88)
Diffstat (limited to 'source4/winbind/wb_irpc.c')
-rw-r--r--source4/winbind/wb_irpc.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/source4/winbind/wb_irpc.c b/source4/winbind/wb_irpc.c
new file mode 100644
index 00000000000..b81948a21d1
--- /dev/null
+++ b/source4/winbind/wb_irpc.c
@@ -0,0 +1,86 @@
+/*
+ Unix SMB/CIFS implementation.
+ Main winbindd irpc handlers
+
+ Copyright (C) Stefan Metzmacher 2006
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+#include "winbind/wb_server.h"
+#include "lib/messaging/irpc.h"
+#include "libcli/composite/composite.h"
+#include "librpc/gen_ndr/ndr_winbind.h"
+#include "smbd/service_task.h"
+
+struct wb_irpc_SamLogon_state {
+ struct irpc_message *msg;
+ struct winbind_SamLogon *req;
+};
+
+static void wb_irpc_SamLogon_callback(struct composite_context *ctx);
+
+static NTSTATUS wb_irpc_SamLogon(struct irpc_message *msg,
+ struct winbind_SamLogon *req)
+{
+ struct wbsrv_service *service = talloc_get_type(msg->private,
+ struct wbsrv_service);
+ struct wb_irpc_SamLogon_state *s;
+ struct composite_context *ctx;
+
+ DEBUG(5, ("wb_irpc_SamLogon called\n"));
+
+ s = talloc(msg, struct wb_irpc_SamLogon_state);
+ NT_STATUS_HAVE_NO_MEMORY(s);
+
+ s->msg = msg;
+ s->req = req;
+
+ ctx = wb_sam_logon_send(msg, service, req);
+ NT_STATUS_HAVE_NO_MEMORY(ctx);
+
+ ctx->async.fn = wb_irpc_SamLogon_callback;
+ ctx->async.private_data = s;
+
+ msg->defer_reply = True;
+ return NT_STATUS_OK;
+}
+
+static void wb_irpc_SamLogon_callback(struct composite_context *ctx)
+{
+ struct wb_irpc_SamLogon_state *s = talloc_get_type(ctx->async.private_data,
+ struct wb_irpc_SamLogon_state);
+ NTSTATUS status;
+
+ DEBUG(5, ("wb_irpc_SamLogon_callback called\n"));
+
+ status = wb_sam_logon_recv(ctx, s, s->req);
+
+ irpc_send_reply(s->msg, status);
+}
+
+NTSTATUS wbsrv_init_irpc(struct wbsrv_service *service)
+{
+ NTSTATUS status;
+
+ irpc_add_name(service->task->msg_ctx, "winbind_server");
+
+ status = IRPC_REGISTER(service->task->msg_ctx, winbind, WINBIND_SAMLOGON,
+ wb_irpc_SamLogon, service);
+ NT_STATUS_NOT_OK_RETURN(status);
+
+ return NT_STATUS_OK;
+}