diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
commit | 6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch) | |
tree | 850c71039563c16a5d563c47e7ba2ab645baf198 /source3/libsmb/samlogon_cache.c | |
parent | 6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff) | |
parent | 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff) | |
download | samba-4.0.0alpha16.tar.gz samba-4.0.0alpha16.tar.xz samba-4.0.0alpha16.zip |
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16samba-4.0.0alpha16
Diffstat (limited to 'source3/libsmb/samlogon_cache.c')
-rw-r--r-- | source3/libsmb/samlogon_cache.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/source3/libsmb/samlogon_cache.c b/source3/libsmb/samlogon_cache.c index facdbc7dc19..618a570c4e0 100644 --- a/source3/libsmb/samlogon_cache.c +++ b/source3/libsmb/samlogon_cache.c @@ -25,6 +25,7 @@ #include "system/filesys.h" #include "librpc/gen_ndr/ndr_krb5pac.h" #include "../libcli/security/security.h" +#include "util_tdb.h" #define NETSAMLOGON_TDB "netsamlogon_cache.tdb" @@ -70,16 +71,9 @@ clear: } first_try = false; - DEBUG(0,("retry after CLEAR_IF_FIRST for '%s'\n", path)); - tdb = tdb_open_log(path, 0, TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, - O_RDWR | O_CREAT, 0600); - if (tdb) { - tdb_close(tdb); - goto again; - } - DEBUG(0,("tdb_open_log(%s) with CLEAR_IF_FIRST - failed\n", path)); - - return false; + DEBUG(0,("retry after truncate for '%s'\n", path)); + truncate(path, 0); + goto again; } @@ -155,7 +149,7 @@ bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3) /* Prepare data */ - if (!(mem_ctx = TALLOC_P( NULL, int))) { + if (!(mem_ctx = talloc( NULL, int))) { DEBUG(0,("netsamlogon_cache_store: talloc() failed!\n")); return false; } @@ -185,7 +179,7 @@ bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3) data.dsize = blob.length; data.dptr = blob.data; - if (tdb_store_bystring(netsamlogon_tdb, keystr, data, TDB_REPLACE) != -1) { + if (tdb_store_bystring(netsamlogon_tdb, keystr, data, TDB_REPLACE) == 0) { result = true; } @@ -223,7 +217,7 @@ struct netr_SamInfo3 *netsamlogon_cache_get(TALLOC_CTX *mem_ctx, const struct do return NULL; } - info3 = TALLOC_ZERO_P(mem_ctx, struct netr_SamInfo3); + info3 = talloc_zero(mem_ctx, struct netr_SamInfo3); if (!info3) { goto done; } |