This commit was manufactured by cvs2svn to create tag
[Samba.git] / source / samrd / samrd.c
blob00e53dd264c28077c54f57fa79a1b759ae3f800d
1 /*
2 Unix SMB/Netbios implementation.
3 Version 1.9.
4 Main SMB server routines
5 Copyright (C) Andrew Tridgell 1992-1998
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "includes.h"
24 fstring pipe_name;
26 pstring servicesf = CONFIGFILE;
27 extern pstring debugf;
28 extern BOOL append_log;
29 extern int DEBUGLEVEL;
31 /*****************************************************************************
32 initialise srv_auth_fns array
33 *****************************************************************************/
34 static void auth_init(rpcsrv_struct *l)
36 extern srv_auth_fns ntlmssp_fns;
37 add_srv_auth_fn(l, &ntlmssp_fns);
40 /*************************************************************************
41 initialise an msrpc service
42 *************************************************************************/
43 static void service_init(char* service_name)
45 DEBUG(10,("msrpc_service_init\n"));
47 add_msrpc_command_processor( pipe_name, service_name, api_samr_rpc );
49 if (!pwdb_initialise(True))
51 exit(-1);
53 if (!pwdbsam_initialise())
55 exit(-1);
59 /****************************************************************************
60 reload the services file
61 **************************************************************************/
62 static BOOL reload_msrpc(BOOL test)
64 BOOL ret;
66 if (lp_loaded()) {
67 pstring fname;
68 pstrcpy(fname,lp_configfile());
69 if (file_exist(fname,NULL) && !strcsequal(fname,servicesf)) {
70 pstrcpy(servicesf,fname);
71 test = False;
75 reopen_logs();
77 if (test && !lp_file_list_changed())
78 return(True);
80 lp_killunused(NULL);
82 ret = lp_load(servicesf,False,False,True);
84 /* perhaps the config filename is now set */
85 if (!test)
86 reload_msrpc(True);
88 reopen_logs();
90 load_interfaces();
92 return(ret);
95 /****************************************************************************
96 main program
97 ****************************************************************************/
98 static int main_init(int argc,char *argv[])
100 #ifdef HAVE_SET_AUTH_PARAMETERS
101 set_auth_parameters(argc,argv);
102 #endif
104 #ifdef HAVE_SETLUID
105 /* needed for SecureWare on SCO */
106 setluid(0);
107 #endif
109 append_log = True;
111 TimeInit();
113 setup_logging(argv[0],False);
114 fstrcpy(pipe_name, "samr");
115 slprintf(debugf, sizeof(debugf), "%s/log.%s", LOGFILEBASE, pipe_name);
117 return 0;
120 static msrpc_service_fns fn_table =
122 auth_init,
123 service_init,
124 reload_msrpc,
125 main_init,
126 NULL
129 msrpc_service_fns *get_service_fns(void)
131 return &fn_table;