summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-08-26 11:46:58 +0200
committerGünther Deschner <gd@samba.org>2009-08-27 15:55:20 +0200
commitb089506136f953961a0290d8af030fbaac3e7136 (patch)
tree98c2e1740a0dd67a6a76d1285e0b434346d59a52 /source3/passdb
parent21a93c2ddc87da3e6e1af8ad7819018526c4b40b (diff)
downloadsamba-b089506136f953961a0290d8af030fbaac3e7136.tar.gz
samba-b089506136f953961a0290d8af030fbaac3e7136.tar.bz2
samba-b089506136f953961a0290d8af030fbaac3e7136.zip
s3-schannel: upgrade old format schannel_store.tdb.
Guenther
Diffstat (limited to 'source3/passdb')
-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);