s3:smbd: move all globals and static variables in globals.[ch]
[samba.git] / source3 / smbd / session.c
index 8163eb30af63b4522767587d1ab50f6eef070d8b..ebfffb7d57ead87d83843ff787d8088c406f1dc3 100644 (file)
 */
 
 #include "includes.h"
+#include "smbd/globals.h"
 
 /********************************************************************
 ********************************************************************/
 
 static struct db_context *session_db_ctx(void)
 {
-       static struct db_context *ctx;
+       if (session_db_ctx_ptr)
+               return session_db_ctx_ptr;
 
-       if (ctx)
-               return ctx;
-
-       ctx = db_open(NULL, lock_path("sessionid.tdb"), 0,
-                     TDB_CLEAR_IF_FIRST|TDB_DEFAULT, 
-                     O_RDWR | O_CREAT, 0644);
-       return ctx;
+       session_db_ctx_ptr = db_open(NULL, lock_path("sessionid.tdb"), 0,
+                                    TDB_CLEAR_IF_FIRST|TDB_DEFAULT,
+                                    O_RDWR | O_CREAT, 0644);
+       return session_db_ctx_ptr;
 }
 
 bool session_init(void)