s4:s3compat Provide a way to get at the Samba4 lp_ctx in Samba3.
[abartlet/samba.git/.git] / source4 / s3compat / s3compat.c
1 /*
2    Unix SMB/CIFS implementation.
3
4    s3 compatibility routines
5
6    Copyright (C) Andrew Tridgell                2010
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3 of the License, or
11    (at your option) any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #include "includes.h"
23 #include "source3/smbd/globals.h"
24
25
26 _PUBLIC_ const char *s3compat_samba_version_string(void)
27 {
28         const char *samba_version_string(void);
29         return samba_version_string();
30 }
31
32 _PUBLIC_
33 void s3compat_initialise(const char *config_file, bool interactive)
34 {
35         talloc_stackframe();
36         /* use stdout logging for now */
37         setup_logging("s3compat", interactive);
38         load_case_tables();
39         sec_init();
40         set_remote_machine_name("smbd", false);
41         init_sec_ctx();
42
43         lp_load_initial_only(config_file);
44         smbd_messaging_context();
45         reload_services(false);
46         smbd_init_globals();
47         TimeInit();
48
49         init_names();
50         file_init();
51         memcache_set_global(smbd_memcache());
52         sessionid_init();
53         connections_init(True);
54         locking_init();
55         messaging_tdb_parent_init();
56         notify_internal_parent_init();
57         serverid_parent_init();
58         namecache_enable();
59         print_backend_init(smbd_messaging_context());
60         init_guest_info();
61         share_info_db_init();
62
63         DEBUG(0,("s3compat: initialised samba3 version: %s\n",
64                  s3compat_samba_version_string()));
65 }
66
67 _PUBLIC_
68 void s3compat_set_server_fd(int fd)
69 {
70         extern int server_fd;
71         server_fd = fd;
72 }
73
74 _PUBLIC_
75 void s3compat_set_event_ctx(struct tevent_context *ctx)
76 {
77         extern struct tevent_context *smbd_event_ctx;
78         smbd_event_ctx = ctx;
79 }
80
81 _PUBLIC_
82 void s3compat_smbd_process(void)
83 {
84         void smbd_process(void);
85         smbd_process();
86 }