diff options
-rw-r--r-- | source3/include/proto.h | 6 | ||||
-rw-r--r-- | source3/lib/sessionid_tdb.c | 83 | ||||
-rw-r--r-- | source3/smbd/server.c | 3 |
3 files changed, 0 insertions, 92 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index ac3d205100..7c5a5a7346 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1509,12 +1509,6 @@ void server_messaging_context_free(void); /* The following definitions come from lib/sessionid_tdb.c */ struct sessionid; -bool sessionid_init(void); -struct db_record *sessionid_fetch_record(TALLOC_CTX *mem_ctx, const char *key); -NTSTATUS sessionid_traverse(int (*fn)(struct db_record *rec, const char *key, - struct sessionid *session, - void *private_data), - void *private_data); NTSTATUS sessionid_traverse_read(int (*fn)(const char *key, struct sessionid *session, void *private_data), diff --git a/source3/lib/sessionid_tdb.c b/source3/lib/sessionid_tdb.c index fafdb9a875..045b3d2f2d 100644 --- a/source3/lib/sessionid_tdb.c +++ b/source3/lib/sessionid_tdb.c @@ -25,89 +25,6 @@ #include "util_tdb.h" #include "smbd/globals.h" -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; - } - - 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, - DBWRAP_LOCK_ORDER_1); - return session_db_ctx_ptr; -} - -bool sessionid_init(void) -{ - if (session_db_ctx() == NULL) { - DEBUG(1,("session_init: failed to open sessionid tdb\n")); - return False; - } - - return True; -} - -struct db_record *sessionid_fetch_record(TALLOC_CTX *mem_ctx, const char *key) -{ - struct db_context *db; - - db = session_db_ctx(); - if (db == NULL) { - return NULL; - } - return dbwrap_fetch_locked(db, mem_ctx, string_term_tdb_data(key)); -} - -struct sessionid_traverse_state { - int (*fn)(struct db_record *rec, const char *key, - struct sessionid *session, void *private_data); - void *private_data; -}; - -static int sessionid_traverse_fn(struct db_record *rec, void *private_data) -{ - TDB_DATA key; - TDB_DATA value; - struct sessionid_traverse_state *state = - (struct sessionid_traverse_state *)private_data; - struct sessionid session; - - key = dbwrap_record_get_key(rec); - value = dbwrap_record_get_value(rec); - if ((key.dptr[key.dsize-1] != '\0') - || (value.dsize != sizeof(struct sessionid))) { - DEBUG(1, ("Found invalid record in sessionid.tdb\n")); - return 0; - } - - memcpy(&session, value.dptr, sizeof(session)); - - return state->fn(rec, (char *)key.dptr, &session, - state->private_data); -} - -NTSTATUS sessionid_traverse(int (*fn)(struct db_record *rec, const char *key, - struct sessionid *session, - void *private_data), - void *private_data) -{ - struct db_context *db; - struct sessionid_traverse_state state; - NTSTATUS status; - - db = session_db_ctx(); - if (db == NULL) { - return NT_STATUS_UNSUCCESSFUL; - } - state.fn = fn; - state.private_data = private_data; - status = dbwrap_traverse(db, sessionid_traverse_fn, &state, NULL); - return status; -} - struct sessionid_traverse_read_state { int (*fn)(const char *key, struct sessionid *session, void *private_data); diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 8eb3d9ef93..bad67526b4 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -1398,9 +1398,6 @@ extern void build_options(bool screen); exit(1); } - if (!sessionid_init()) { - exit(1); - } status = smbXsrv_session_global_init(); if (!NT_STATUS_IS_OK(status)) { exit(1); |