summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/passdb/secrets.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index 0a3871e620..cecf13a7db 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -1134,6 +1134,10 @@ void secrets_fetch_ipc_userpass(char **username, char **domain, char **password)
Open or create the schannel session store tdb.
*******************************************************************************/
+#define SCHANNEL_STORE_VERSION_1 1
+#define SCHANNEL_STORE_VERSION_2 2
+#define SCHANNEL_STORE_VERSION_CURRENT SCHANNEL_STORE_VERSION_2
+
TDB_CONTEXT *open_schannel_session_store(TALLOC_CTX *mem_ctx)
{
TDB_DATA vers;
@@ -1153,21 +1157,22 @@ TDB_CONTEXT *open_schannel_session_store(TALLOC_CTX *mem_ctx)
return NULL;
}
+ again:
vers = tdb_fetch_bystring(tdb_sc, "SCHANNEL_STORE_VERSION");
if (vers.dptr == NULL) {
/* First opener, no version. */
- SIVAL(&ver,0,1);
+ SIVAL(&ver,0,SCHANNEL_STORE_VERSION_CURRENT);
vers.dptr = (uint8 *)&ver;
vers.dsize = 4;
tdb_store_bystring(tdb_sc, "SCHANNEL_STORE_VERSION", vers, TDB_REPLACE);
vers.dptr = NULL;
} else if (vers.dsize == 4) {
ver = IVAL(vers.dptr,0);
- if (ver != 1) {
- tdb_close(tdb_sc);
- tdb_sc = NULL;
+ if (ver != SCHANNEL_STORE_VERSION_CURRENT) {
DEBUG(0,("open_schannel_session_store: wrong version number %d in %s\n",
(int)ver, fname ));
+ tdb_wipe_all(tdb_sc);
+ goto again;
}
} else {
tdb_close(tdb_sc);