s3-sessionid: change session_db_ctx() to always return the session_id_ctx pointer.
authorGünther Deschner <gd@samba.org>
Wed, 4 Sep 2013 14:55:11 +0000 (16:55 +0200)
committerKarolin Seeger <kseeger@samba.org>
Fri, 6 Sep 2013 09:22:34 +0000 (11:22 +0200)
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
source3/lib/sessionid_tdb.c

index de3ccab26ae84003ccd15cee58841fff490b31c9..6bd39c4ef96fe3db411aeccc68258c5985222c96 100644 (file)
 #include "session.h"
 #include "util_tdb.h"
 
+static struct db_context *session_db_ctx_ptr = NULL;
+
 static struct db_context *session_db_ctx(void)
 {
-       static struct db_context *session_db_ctx_ptr;
-
-       if (session_db_ctx_ptr != NULL) {
-               return session_db_ctx_ptr;
-       }
+       return session_db_ctx_ptr;
+}
 
+static struct db_context *session_db_ctx_init(void)
+{
        session_db_ctx_ptr = db_open(NULL, lock_path("sessionid.tdb"), 0,
                                     TDB_CLEAR_IF_FIRST|TDB_DEFAULT|TDB_INCOMPATIBLE_HASH,
                                     O_RDWR | O_CREAT, 0644);
@@ -39,7 +40,7 @@ static struct db_context *session_db_ctx(void)
 
 bool sessionid_init(void)
 {
-       if (session_db_ctx() == NULL) {
+       if (session_db_ctx_init() == NULL) {
                DEBUG(1,("session_init: failed to open sessionid tdb\n"));
                return False;
        }