summaryrefslogtreecommitdiff
path: root/libcli/auth
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-06-23 10:37:13 +1000
committerJeremy Allison <jra@samba.org>2010-06-25 12:00:36 -0700
commitc84b74dddd6c74ad28597f069a43a0a3d334b04a (patch)
tree869fe6721689766b6f270273dd5c2a6e0ec56b4f /libcli/auth
parentcfece164981142168aa6c846c7433f0459fb6de7 (diff)
downloadsamba-c84b74dddd6c74ad28597f069a43a0a3d334b04a.tar.gz
samba-c84b74dddd6c74ad28597f069a43a0a3d334b04a.tar.bz2
samba-c84b74dddd6c74ad28597f069a43a0a3d334b04a.zip
schannel Change to TDB_CLEAR_IF_FIRST to reduce fsync()
By making this DB TDB_NOSYNC, and by making that safe with TDB_CLEAR_IF_FIRST, we greatly reduce the fsync() load on the server. This particularly helps the source4/ 'make test', which otherwise tries to disable fsync() in ldb. Andrew Bartlett Signed-off-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'libcli/auth')
-rw-r--r--libcli/auth/schannel_state_tdb.c33
1 files changed, 1 insertions, 32 deletions
diff --git a/libcli/auth/schannel_state_tdb.c b/libcli/auth/schannel_state_tdb.c
index 0e4ab06515..0dcc3361c8 100644
--- a/libcli/auth/schannel_state_tdb.c
+++ b/libcli/auth/schannel_state_tdb.c
@@ -42,8 +42,6 @@
struct tdb_wrap *open_schannel_session_store(TALLOC_CTX *mem_ctx,
const char *private_dir)
{
- TDB_DATA vers;
- uint32_t ver;
struct tdb_wrap *tdb_sc = NULL;
char *fname = talloc_asprintf(mem_ctx, "%s/schannel_store.tdb", private_dir);
@@ -51,7 +49,7 @@ struct tdb_wrap *open_schannel_session_store(TALLOC_CTX *mem_ctx,
return NULL;
}
- tdb_sc = tdb_wrap_open(mem_ctx, fname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+ tdb_sc = tdb_wrap_open(mem_ctx, fname, 0, TDB_CLEAR_IF_FIRST|TDB_NOSYNC, O_RDWR|O_CREAT, 0600);
if (!tdb_sc) {
DEBUG(0,("open_schannel_session_store: Failed to open %s - %s\n",
@@ -60,35 +58,6 @@ struct tdb_wrap *open_schannel_session_store(TALLOC_CTX *mem_ctx,
return NULL;
}
- again:
- vers = tdb_fetch_bystring(tdb_sc->tdb, "SCHANNEL_STORE_VERSION");
- if (vers.dptr == NULL) {
- /* First opener, no version. */
- SIVAL(&ver,0,SCHANNEL_STORE_VERSION_CURRENT);
- vers.dptr = (uint8_t *)&ver;
- vers.dsize = 4;
- tdb_store_bystring(tdb_sc->tdb, "SCHANNEL_STORE_VERSION", vers, TDB_REPLACE);
- vers.dptr = NULL;
- } else if (vers.dsize == 4) {
- ver = IVAL(vers.dptr,0);
- if (ver == SCHANNEL_STORE_VERSION_2) {
- DEBUG(0,("open_schannel_session_store: wrong version number %d in %s\n",
- (int)ver, fname ));
- tdb_wipe_all(tdb_sc->tdb);
- goto again;
- }
- if (ver != SCHANNEL_STORE_VERSION_CURRENT) {
- DEBUG(0,("open_schannel_session_store: wrong version number %d in %s\n",
- (int)ver, fname ));
- TALLOC_FREE(tdb_sc);
- }
- } else {
- TALLOC_FREE(tdb_sc);
- DEBUG(0,("open_schannel_session_store: wrong version number size %d in %s\n",
- (int)vers.dsize, fname ));
- }
-
- SAFE_FREE(vers.dptr);
TALLOC_FREE(fname);
return tdb_sc;