Move error reporting of messaging context creation fail into
[ira/wip.git] / source3 / smbd / globals.c
index 340789ba8e18060573775c9fde05e45233845559..aac30ea9c1cf338c8cd115a7f1660daec2a1e79d 100644 (file)
@@ -38,21 +38,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;
@@ -117,9 +102,26 @@ int num_children = 0;
 
 struct smbd_server_connection *smbd_server_conn = NULL;
 
+struct smbd_server_connection *msg_ctx_to_sconn(struct messaging_context *msg_ctx)
+{
+       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 messaging_context *smbd_messaging_context(void)
 {
-       return server_messaging_context();
+       struct messaging_context *msg_ctx = server_messaging_context();
+       if (likely(msg_ctx != NULL)) {
+               return msg_ctx;
+       }
+       smb_panic("Could not init smbd's messaging context.\n");
 }
 
 struct memcache *smbd_memcache(void)