r3005: added talloc wrappers around tdb_open() and ldb_connect(), so that the
[samba.git] / source4 / smbd / rewrite.c
1 #include "includes.h"
2
3 /*
4
5  this is a set of temporary stub functions used during the core smbd rewrite.
6  This file will need to go away before the rewrite is complete
7 */
8
9 BOOL set_current_service(void *conn, BOOL x)
10 { return True; }
11
12 void change_to_root_user(void)
13 {}
14
15 BOOL pcap_printername_ok(const char *service, const char *foo)
16 { return True; }
17
18 BOOL share_access_check(struct smbsrv_request *req, struct smbsrv_tcon *tcon, int snum, uint32_t desired_access)
19 { return True; }
20
21 /*
22  * initialize an smb process
23  */
24 void smbd_process_init(void)
25 {
26         TALLOC_CTX *mem_ctx;
27
28         mem_ctx = talloc_init("smbd_process_init talloc");
29         if (!mem_ctx) {
30                 DEBUG(0,("smbd_process_init: ERROR: No memory\n"));
31                 exit(1);
32         }
33
34         /* possibly reload the services file. */
35         reload_services(NULL, True);
36
37         if (*lp_rootdir()) {
38                 if (sys_chroot(lp_rootdir()) == 0)
39                         DEBUG(2,("Changed root to %s\n", lp_rootdir()));
40         }
41
42         /* Start old-style secrets subsystem */
43         
44         talloc_destroy(mem_ctx);
45 }
46
47 void init_subsystems(void)
48 {
49         /* Setup the PROCESS_MODEL subsystem */
50         if (!process_model_init())
51                 exit(1);
52
53         /* Setup the SERVER_SERVICE subsystem */
54         if (!server_service_init())
55                 exit(1);
56
57         /* Setup the AUTH subsystem */
58         if (!auth_init())
59                 exit(1);
60
61         /* Setup the NTVFS subsystem */
62         if (!ntvfs_init())
63                 exit(1);
64
65         /* Setup the DCERPC subsystem */
66         if (!subsystem_dcerpc_init())
67                 exit(1);
68
69 }
70
71 /****************************************************************************
72  Reload the services file.
73 **************************************************************************/
74 BOOL reload_services(struct smbsrv_connection *smb, BOOL test)
75 {
76         BOOL ret;
77         
78         if (lp_loaded()) {
79                 pstring fname;
80                 pstrcpy(fname,lp_configfile());
81                 if (file_exist(fname, NULL) &&
82                     !strcsequal(fname, dyn_CONFIGFILE)) {
83                         pstrcpy(dyn_CONFIGFILE, fname);
84                         test = False;
85                 }
86         }
87
88         reopen_logs();
89
90         if (test && !lp_file_list_changed())
91                 return(True);
92
93         if (smb) {
94                 lp_killunused(smb, conn_snum_used);
95         }
96         
97         ret = lp_load(dyn_CONFIGFILE, False, False, True);
98
99         /* perhaps the config filename is now set */
100         if (!test)
101                 reload_services(smb, True);
102
103         reopen_logs();
104
105         load_interfaces();
106
107         /* this forces service parameters to be flushed */
108         set_current_service(NULL,True);
109
110         return(ret);
111 }
112