source: branches/samba-3.5.x/source3/smbd/globals.c

Last change on this file was 414, checked in by Herwig Bauernfeind, 15 years ago

Samba 3.5.0: Initial import

File size: 4.5 KB
Line 
1/*
2 Unix SMB/Netbios implementation.
3 smbd globals
4 Copyright (C) Stefan Metzmacher 2009
5
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.
10
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.
15
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/>.
18*/
19
20#include "includes.h"
21#include "smbd/globals.h"
22
23#if defined(WITH_AIO)
24struct aio_extra *aio_list_head = NULL;
25struct tevent_signal *aio_signal_event = NULL;
26int aio_pending_size = 0;
27int outstanding_aio_calls = 0;
28#endif
29
30/* dlink list we store pending lock records on. */
31struct blocking_lock_record *blocking_lock_queue = NULL;
32
33/* dlink list we move cancelled lock records onto. */
34struct blocking_lock_record *blocking_lock_cancelled_queue = NULL;
35
36/* The event that makes us process our blocking lock queue */
37struct timed_event *brl_timeout = NULL;
38
39bool blocking_lock_unlock_state = false;
40bool blocking_lock_cancel_state = false;
41
42#ifdef USE_DMAPI
43struct smbd_dmapi_context *dmapi_ctx = NULL;
44#endif
45
46
47bool dfree_broken = false;
48
49/* how many write cache buffers have been allocated */
50unsigned int allocated_write_caches = 0;
51
52int real_max_open_files = 0;
53struct bitmap *file_bmap = NULL;
54files_struct *Files = NULL;
55int files_used = 0;
56struct fsp_singleton_cache fsp_fi_cache = {
57 .fsp = NULL,
58 .id = {
59 .devid = 0,
60 .inode = 0,
61 .extid = 0
62 }
63};
64unsigned long file_gen_counter = 0;
65int first_file = 0;
66
67const struct mangle_fns *mangle_fns = NULL;
68
69unsigned char *chartest = NULL;
70TDB_CONTEXT *tdb_mangled_cache = NULL;
71
72/* these tables are used to provide fast tests for characters */
73unsigned char char_flags[256];
74/*
75 this determines how many characters are used from the original filename
76 in the 8.3 mangled name. A larger value leads to a weaker hash and more collisions.
77 The largest possible value is 6.
78*/
79unsigned mangle_prefix = 0;
80unsigned char base_reverse[256];
81
82char *last_from = NULL;
83char *last_to = NULL;
84
85struct msg_state *smbd_msg_state = NULL;
86
87bool logged_ioctl_message = false;
88
89int trans_num = 0;
90pid_t mypid = 0;
91time_t last_smb_conf_reload_time = 0;
92time_t last_printer_reload_time = 0;
93/****************************************************************************
94 structure to hold a linked list of queued messages.
95 for processing.
96****************************************************************************/
97struct pending_message_list *deferred_open_queue = NULL;
98uint32_t common_flags2 = FLAGS2_LONG_PATH_COMPONENTS|FLAGS2_32_BIT_ERROR_CODES|FLAGS2_EXTENDED_ATTRIBUTES;
99
100struct smb_srv_trans_enc_ctx *partial_srv_trans_enc_ctx = NULL;
101struct smb_srv_trans_enc_ctx *srv_trans_enc_ctx = NULL;
102
103/* A stack of security contexts. We include the current context as being
104 the first one, so there is room for another MAX_SEC_CTX_DEPTH more. */
105struct sec_ctx sec_ctx_stack[MAX_SEC_CTX_DEPTH + 1];
106int sec_ctx_stack_ndx = 0;
107bool become_uid_done = false;
108bool become_gid_done = false;
109
110connection_struct *last_conn = NULL;
111uint16_t last_flags = 0;
112
113struct db_context *session_db_ctx_ptr = NULL;
114
115uint32_t global_client_caps = 0;
116
117uint16_t fnf_handle = 257;
118
119/* A stack of current_user connection contexts. */
120struct conn_ctx conn_ctx_stack[MAX_SEC_CTX_DEPTH];
121int conn_ctx_stack_ndx = 0;
122
123struct vfs_init_function_entry *backends = NULL;
124char *sparse_buf = NULL;
125char *LastDir = NULL;
126
127/* Current number of oplocks we have outstanding. */
128int32_t exclusive_oplocks_open = 0;
129int32_t level_II_oplocks_open = 0;
130bool global_client_failed_oplock_break = false;
131struct kernel_oplocks *koplocks = NULL;
132
133int am_parent = 1;
134int server_fd = -1;
135struct event_context *smbd_event_ctx = NULL;
136struct messaging_context *smbd_msg_ctx = NULL;
137struct memcache *smbd_memcache_ctx = NULL;
138bool exit_firsttime = true;
139struct child_pid *children = 0;
140int num_children = 0;
141
142struct smbd_server_connection *smbd_server_conn = NULL;
143
144void smbd_init_globals(void)
145{
146 ZERO_STRUCT(char_flags);
147 ZERO_STRUCT(base_reverse);
148
149 ZERO_STRUCT(conn_ctx_stack);
150
151 ZERO_STRUCT(sec_ctx_stack);
152
153 smbd_server_conn = talloc_zero(smbd_event_context(), struct smbd_server_connection);
154 if (!smbd_server_conn) {
155 exit_server("failed to create smbd_server_connection");
156 }
157}
Note: See TracBrowser for help on using the repository browser.