Line data Source code
1 : /* 2 : * Unix SMB/CIFS implementation. 3 : * 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. 8 : * 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. 13 : * 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/>. 16 : */ 17 : 18 : #include "includes.h" 19 : #include "rpc_worker.h" 20 : #include "librpc/gen_ndr/ndr_srvsvc.h" 21 : #include "librpc/gen_ndr/ndr_srvsvc_scompat.h" 22 : #include "librpc/gen_ndr/ndr_dfs.h" 23 : #include "librpc/gen_ndr/ndr_dfs_scompat.h" 24 : #include "librpc/gen_ndr/ndr_wkssvc.h" 25 : #include "librpc/gen_ndr/ndr_wkssvc_scompat.h" 26 : #include "librpc/gen_ndr/ndr_svcctl.h" 27 : #include "librpc/gen_ndr/ndr_svcctl_scompat.h" 28 : #include "librpc/gen_ndr/ndr_ntsvcs.h" 29 : #include "librpc/gen_ndr/ndr_ntsvcs_scompat.h" 30 : #include "librpc/gen_ndr/ndr_eventlog.h" 31 : #include "librpc/gen_ndr/ndr_eventlog_scompat.h" 32 : #include "librpc/gen_ndr/ndr_initshutdown.h" 33 : #include "librpc/gen_ndr/ndr_initshutdown_scompat.h" 34 : #include "source3/include/secrets.h" 35 : #include "locking/share_mode_lock.h" 36 : #include "source3/smbd/proto.h" 37 : 38 35 : static size_t classic_interfaces( 39 : const struct ndr_interface_table ***pifaces, 40 : void *private_data) 41 : { 42 : static const struct ndr_interface_table *ifaces[] = { 43 : &ndr_table_srvsvc, 44 : &ndr_table_netdfs, 45 : &ndr_table_initshutdown, 46 : &ndr_table_svcctl, 47 : &ndr_table_ntsvcs, 48 : &ndr_table_eventlog, 49 : /* 50 : * This last item is truncated from the list by the 51 : * num_ifaces -= 1 below. Take care when adding new 52 : * services. 53 : */ 54 : &ndr_table_wkssvc, 55 : }; 56 35 : size_t num_ifaces = ARRAY_SIZE(ifaces); 57 : 58 35 : switch(lp_server_role()) { 59 4 : case ROLE_ACTIVE_DIRECTORY_DC: 60 : /* 61 : * On the AD DC wkssvc is provided by the 'samba' 62 : * binary from source4/ 63 : */ 64 4 : num_ifaces -= 1; 65 4 : break; 66 31 : default: 67 31 : break; 68 : } 69 : 70 35 : *pifaces = ifaces; 71 35 : return num_ifaces; 72 : 73 : } 74 : 75 35 : static size_t classic_servers( 76 : struct dcesrv_context *dce_ctx, 77 : const struct dcesrv_endpoint_server ***_ep_servers, 78 : void *private_data) 79 : { 80 : static const struct dcesrv_endpoint_server *ep_servers[7] = { NULL }; 81 35 : size_t num_servers = ARRAY_SIZE(ep_servers); 82 : bool ok; 83 : 84 35 : ep_servers[0] = srvsvc_get_ep_server(); 85 35 : ep_servers[1] = netdfs_get_ep_server(); 86 35 : ep_servers[2] = initshutdown_get_ep_server(); 87 35 : ep_servers[3] = svcctl_get_ep_server(); 88 35 : ep_servers[4] = ntsvcs_get_ep_server(); 89 35 : ep_servers[5] = eventlog_get_ep_server(); 90 35 : ep_servers[6] = wkssvc_get_ep_server(); 91 : 92 35 : switch(lp_server_role()) { 93 3 : case ROLE_ACTIVE_DIRECTORY_DC: 94 : /* 95 : * On the AD DC wkssvc is provided by the 'samba' 96 : * binary from source4/ 97 : */ 98 3 : num_servers -= 1; 99 3 : break; 100 32 : default: 101 32 : break; 102 : } 103 : 104 35 : ok = secrets_init(); 105 35 : if (!ok) { 106 0 : DBG_ERR("secrets_init() failed\n"); 107 0 : exit(1); 108 : } 109 : 110 35 : ok = locking_init(); 111 35 : if (!ok) { 112 0 : DBG_ERR("locking_init() failed\n"); 113 0 : exit(1); 114 : } 115 : 116 35 : lp_load_with_shares(get_dyn_CONFIGFILE()); 117 : 118 35 : mangle_reset_cache(); 119 : 120 35 : *_ep_servers = ep_servers; 121 35 : return num_servers; 122 : } 123 : 124 70 : int main(int argc, const char *argv[]) 125 : { 126 70 : return rpc_worker_main( 127 : argc, 128 : argv, 129 : "rpcd_classic", 130 : 5, 131 : 60, 132 : classic_interfaces, 133 : classic_servers, 134 : NULL); 135 : }