smbd: Simplify an if-condition
[Samba.git] / source3 / rpc_server / rpcd_rpcecho.c
blob546666349c5323248fd77c67c447bece712ccf00
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 "replace.h"
19 #include "rpc_worker.h"
20 #include "librpc/gen_ndr/ndr_echo.h"
21 #include "librpc/gen_ndr/ndr_echo_scompat.h"
22 #include "param/loadparm.h"
23 #include "libds/common/roles.h"
25 static size_t rpcecho_interfaces(
26 const struct ndr_interface_table ***pifaces,
27 void *private_data)
29 static const struct ndr_interface_table *ifaces[] = {
30 &ndr_table_rpcecho,
32 size_t num_ifaces = ARRAY_SIZE(ifaces);
34 switch(lp_server_role()) {
35 case ROLE_ACTIVE_DIRECTORY_DC:
37 * On the AD DC rpcecho is provided by the 'samba'
38 * binary from source4/
40 num_ifaces = 0;
41 break;
42 default:
43 break;
46 *pifaces = ifaces;
47 return num_ifaces;
50 static NTSTATUS rpcecho_servers(
51 struct dcesrv_context *dce_ctx,
52 const struct dcesrv_endpoint_server ***_ep_servers,
53 size_t *_num_ep_servers,
54 void *private_data)
56 static const struct dcesrv_endpoint_server *ep_servers[1] = { NULL };
57 size_t num_servers = ARRAY_SIZE(ep_servers);
59 ep_servers[0] = rpcecho_get_ep_server();
61 switch(lp_server_role()) {
62 case ROLE_ACTIVE_DIRECTORY_DC:
64 * On the AD DC rpcecho is provided by the 'samba'
65 * binary from source4/
67 num_servers = 0;
68 break;
69 default:
70 break;
73 *_ep_servers = ep_servers;
74 *_num_ep_servers = num_servers;
75 return NT_STATUS_OK;
78 int main(int argc, const char *argv[])
80 return rpc_worker_main(
81 argc,
82 argv,
83 "rpcd_rpcecho",
86 rpcecho_interfaces,
87 rpcecho_servers,
88 NULL);