dcerpc.idl Add symbolic constant for /root/ncalrpc_as_system
[Samba.git] / source3 / smbd / globals.c
blob6bc448b901d68fa0fc799405a6f0d02da8ac20eb
1 /*
2 Unix SMB/Netbios implementation.
3 smbd globals
4 Copyright (C) Stefan Metzmacher 2009
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "includes.h"
21 #include "smbd/smbd.h"
22 #include "smbd/globals.h"
23 #include "../lib/util/memcache.h"
24 #include "messages.h"
25 #include <tdb.h>
27 #ifdef USE_DMAPI
28 struct smbd_dmapi_context *dmapi_ctx = NULL;
29 #endif
31 /* how many write cache buffers have been allocated */
32 unsigned int allocated_write_caches = 0;
34 const struct mangle_fns *mangle_fns = NULL;
36 unsigned char *chartest = NULL;
37 TDB_CONTEXT *tdb_mangled_cache = NULL;
40 this determines how many characters are used from the original filename
41 in the 8.3 mangled name. A larger value leads to a weaker hash and more collisions.
42 The largest possible value is 6.
44 unsigned mangle_prefix = 0;
46 bool logged_ioctl_message = false;
48 time_t last_smb_conf_reload_time = 0;
49 pid_t background_lpq_updater_pid = -1;
51 /****************************************************************************
52 structure to hold a linked list of queued messages.
53 for processing.
54 ****************************************************************************/
55 uint32_t common_flags2 = FLAGS2_LONG_PATH_COMPONENTS|FLAGS2_32_BIT_ERROR_CODES|FLAGS2_EXTENDED_ATTRIBUTES;
57 struct smb_trans_enc_state *partial_srv_trans_enc_ctx = NULL;
58 struct smb_trans_enc_state *srv_trans_enc_ctx = NULL;
60 /* A stack of security contexts. We include the current context as being
61 the first one, so there is room for another MAX_SEC_CTX_DEPTH more. */
62 struct sec_ctx sec_ctx_stack[MAX_SEC_CTX_DEPTH + 1];
63 int sec_ctx_stack_ndx = 0;
64 bool become_uid_done = false;
65 bool become_gid_done = false;
67 connection_struct *last_conn = NULL;
68 uint16_t last_flags = 0;
70 uint32_t global_client_caps = 0;
72 uint16_t fnf_handle = 257;
74 /* A stack of current_user connection contexts. */
75 struct conn_ctx conn_ctx_stack[MAX_SEC_CTX_DEPTH];
76 int conn_ctx_stack_ndx = 0;
78 struct vfs_init_function_entry *backends = NULL;
79 char *sparse_buf = NULL;
80 char *LastDir = NULL;
82 struct smbd_parent_context *am_parent = NULL;
83 struct memcache *smbd_memcache_ctx = NULL;
84 bool exit_firsttime = true;
86 struct smbXsrv_client *global_smbXsrv_client = NULL;
88 struct memcache *smbd_memcache(void)
90 if (!smbd_memcache_ctx) {
92 * Note we MUST use the NULL context here, not the
93 * autofree context, to avoid side effects in forked
94 * children exiting.
96 smbd_memcache_ctx = memcache_init(NULL,
97 lp_max_stat_cache_size()*1024);
99 if (!smbd_memcache_ctx) {
100 smb_panic("Could not init smbd memcache");
103 return smbd_memcache_ctx;
106 void smbd_init_globals(void)
108 ZERO_STRUCT(conn_ctx_stack);
110 ZERO_STRUCT(sec_ctx_stack);