2 Unix SMB/CIFS implementation.
4 run s3 winbindd server within Samba4
6 Copyright (C) Andrew Tridgell 2011
7 Copyright (C) Andrew Bartlett 2014
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 #include "system/filesys.h"
27 #include "lib/param/param.h"
28 #include "source4/smbd/service.h"
29 #include "source4/smbd/process_model.h"
30 #include "file_server/file_server.h"
31 #include "dynconfig.h"
32 #include "nsswitch/winbind_client.h"
35 called if winbindd exits
37 static void winbindd_done(struct tevent_req
*subreq
)
39 struct task_server
*task
=
40 tevent_req_callback_data(subreq
,
45 ret
= samba_runcmd_recv(subreq
, &sys_errno
);
47 DEBUG(0,("winbindd daemon died with exit status %d\n", sys_errno
));
49 DEBUG(0,("winbindd daemon exited normally\n"));
51 task_server_terminate(task
, "winbindd child process exited", true);
56 startup a copy of winbindd as a child daemon
58 static void winbindd_task_init(struct task_server
*task
)
60 struct tevent_req
*subreq
;
61 const char *winbindd_path
;
62 const char *winbindd_cmd
[2] = { NULL
, NULL
};
64 task_server_set_title(task
, "task[winbindd_parent]");
66 winbindd_path
= talloc_asprintf(task
, "%s/winbindd", dyn_SBINDIR
);
67 winbindd_cmd
[0] = winbindd_path
;
69 /* start it as a child process */
70 subreq
= samba_runcmd_send(task
, task
->event_ctx
, timeval_zero(), 1, 0,
73 "--option=server role check:inhibit=yes",
75 debug_get_output_is_stdout()?"--stdout":NULL
,
78 DEBUG(0, ("Failed to start winbindd as child daemon\n"));
79 task_server_terminate(task
, "Failed to startup winbindd task", true);
83 tevent_req_set_callback(subreq
, winbindd_done
, task
);
85 DEBUG(5,("Started file server child winbindd\n"));
88 /* called at winbindd startup - register ourselves as a server service */
89 NTSTATUS
server_service_winbindd_init(void);
91 NTSTATUS
server_service_winbindd_init(void)
93 return register_server_service("winbindd", winbindd_task_init
);