X-Git-Url: http://git.samba.org/?a=blobdiff_plain;f=source3%2Fsmbd%2Fglobals.c;h=3199a37c905f9766315e32ce0dcfa06b48177b60;hb=1515f7db00ec3c01bc9c808edddf44052ac91c3f;hp=87d6405ee96b442e139b0e41d09254899f69118b;hpb=aba1bf4b5e1bf82f769c3c545578414202c74106;p=kai%2Fsamba.git diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c index 87d6405ee96..3199a37c905 100644 --- a/source3/smbd/globals.c +++ b/source3/smbd/globals.c @@ -18,8 +18,12 @@ */ #include "includes.h" +#include "smbd/smbd.h" #include "smbd/globals.h" +#include "lib/smbd_shim.h" #include "memcache.h" +#include "messages.h" +#include "tdb_compat.h" #if defined(WITH_AIO) struct aio_extra *aio_list_head = NULL; @@ -38,21 +42,6 @@ bool dfree_broken = false; /* how many write cache buffers have been allocated */ unsigned int allocated_write_caches = 0; -int real_max_open_files = 0; -struct bitmap *file_bmap = NULL; -files_struct *Files = NULL; -int files_used = 0; -struct fsp_singleton_cache fsp_fi_cache = { - .fsp = NULL, - .id = { - .devid = 0, - .inode = 0, - .extid = 0 - } -}; -unsigned long file_gen_counter = 0; -int first_file = 0; - const struct mangle_fns *mangle_fns = NULL; unsigned char *chartest = NULL; @@ -69,18 +58,18 @@ struct msg_state *smbd_msg_state = NULL; bool logged_ioctl_message = false; -pid_t mypid = 0; time_t last_smb_conf_reload_time = 0; time_t last_printer_reload_time = 0; +pid_t background_lpq_updater_pid = -1; + /**************************************************************************** structure to hold a linked list of queued messages. for processing. ****************************************************************************/ -struct pending_message_list *deferred_open_queue = NULL; uint32_t common_flags2 = FLAGS2_LONG_PATH_COMPONENTS|FLAGS2_32_BIT_ERROR_CODES|FLAGS2_EXTENDED_ATTRIBUTES; -struct smb_srv_trans_enc_ctx *partial_srv_trans_enc_ctx = NULL; -struct smb_srv_trans_enc_ctx *srv_trans_enc_ctx = NULL; +struct smb_trans_enc_state *partial_srv_trans_enc_ctx = NULL; +struct smb_trans_enc_state *srv_trans_enc_ctx = NULL; /* A stack of security contexts. We include the current context as being the first one, so there is room for another MAX_SEC_CTX_DEPTH more. */ @@ -109,18 +98,23 @@ int32_t exclusive_oplocks_open = 0; int32_t level_II_oplocks_open = 0; struct kernel_oplocks *koplocks = NULL; -int am_parent = 1; -int server_fd = -1; +struct smbd_parent_context *am_parent = NULL; struct memcache *smbd_memcache_ctx = NULL; bool exit_firsttime = true; -struct child_pid *children = 0; -int num_children = 0; struct smbd_server_connection *smbd_server_conn = NULL; -struct messaging_context *smbd_messaging_context(void) +struct smbd_server_connection *msg_ctx_to_sconn(struct messaging_context *msg_ctx) { - return server_messaging_context(); + struct server_id my_id, msg_id; + + my_id = messaging_server_id(smbd_server_conn->msg_ctx); + msg_id = messaging_server_id(msg_ctx); + + if (!procid_equal(&my_id, &msg_id)) { + return NULL; + } + return smbd_server_conn; } struct memcache *smbd_memcache(void) @@ -141,18 +135,33 @@ struct memcache *smbd_memcache(void) return smbd_memcache_ctx; } +static const struct smbd_shim smbd_shim_fns = +{ + .cancel_pending_lock_requests_by_fid = smbd_cancel_pending_lock_requests_by_fid, + .send_stat_cache_delete_message = smbd_send_stat_cache_delete_message, + .change_to_root_user = smbd_change_to_root_user, + + .contend_level2_oplocks_begin = smbd_contend_level2_oplocks_begin, + .contend_level2_oplocks_end = smbd_contend_level2_oplocks_end, + + .become_root = smbd_become_root, + .unbecome_root = smbd_unbecome_root +}; void smbd_init_globals(void) { + set_smbd_shim(&smbd_shim_fns); + ZERO_STRUCT(conn_ctx_stack); ZERO_STRUCT(sec_ctx_stack); - smbd_server_conn = talloc_zero(smbd_event_context(), struct smbd_server_connection); + smbd_server_conn = talloc_zero(server_event_context(), struct smbd_server_connection); if (!smbd_server_conn) { exit_server("failed to create smbd_server_connection"); } + smbd_server_conn->ev_ctx = server_event_context(); smbd_server_conn->smb1.echo_handler.trusted_fd = -1; smbd_server_conn->smb1.echo_handler.socket_lock_fd = -1; }