s3: libsmb: In cli_qpathinfo_send() (SMBtrans2:TRANSACT2_QPATHINFO) check for DFS...
[Samba.git] / source3 / rpc_server / rpcd_lsad.c
blob3ca0ed43fdd6a470387988439fe623b765a137cf
1 /*
2 * Unix SMB/CIFS implementation.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 #include "includes.h"
19 #include "rpc_worker.h"
20 #include "librpc/gen_ndr/ndr_lsa.h"
21 #include "librpc/gen_ndr/ndr_lsa_scompat.h"
22 #include "librpc/gen_ndr/ndr_samr.h"
23 #include "librpc/gen_ndr/ndr_samr_scompat.h"
24 #include "librpc/gen_ndr/ndr_netlogon.h"
25 #include "librpc/gen_ndr/ndr_netlogon_scompat.h"
26 #include "librpc/gen_ndr/ndr_dssetup.h"
27 #include "librpc/gen_ndr/ndr_dssetup_scompat.h"
28 #include "source3/include/auth.h"
29 #include "source3/include/secrets.h"
31 static size_t lsad_interfaces(
32 const struct ndr_interface_table ***pifaces,
33 void *private_data)
35 static const struct ndr_interface_table *ifaces[] = {
36 &ndr_table_lsarpc,
37 &ndr_table_samr,
38 &ndr_table_dssetup,
39 &ndr_table_netlogon,
41 size_t num_ifaces = ARRAY_SIZE(ifaces);
43 switch(lp_server_role()) {
44 case ROLE_STANDALONE:
45 case ROLE_DOMAIN_MEMBER:
46 /* no netlogon for non-dc */
47 num_ifaces -= 1;
48 break;
49 default:
50 break;
53 *pifaces = ifaces;
54 return num_ifaces;
57 static size_t lsad_servers(
58 struct dcesrv_context *dce_ctx,
59 const struct dcesrv_endpoint_server ***_ep_servers,
60 void *private_data)
62 static const struct dcesrv_endpoint_server *ep_servers[4] = { NULL, };
63 size_t num_servers = ARRAY_SIZE(ep_servers);
64 bool ok;
66 ep_servers[0] = lsarpc_get_ep_server();
67 ep_servers[1] = samr_get_ep_server();
68 ep_servers[2] = dssetup_get_ep_server();
69 ep_servers[3] = netlogon_get_ep_server();
71 ok = secrets_init();
72 if (!ok) {
73 DBG_ERR("secrets_init() failed\n");
74 exit(1);
77 switch(lp_server_role()) {
78 case ROLE_STANDALONE:
79 case ROLE_DOMAIN_MEMBER:
80 /* no netlogon for non-dc */
81 num_servers -= 1;
82 break;
83 default:
84 break;
87 *_ep_servers = ep_servers;
88 return num_servers;
91 int main(int argc, const char *argv[])
93 return rpc_worker_main(
94 argc,
95 argv,
96 "rpcd_lsad",
98 60,
99 lsad_interfaces,
100 lsad_servers,
101 NULL);