summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-07-11 17:44:09 +0200
committerVolker Lendecke <vl@samba.org>2008-07-11 17:53:25 +0200
commitd670d0a09bec3b6900421df17fc9d959545ee953 (patch)
tree0f772cbe645829c2f92219a04f4fad03cd0a27b4 /source3/libsmb
parentd803fa6e46c98cc6cdcacfb0225388d786617f0a (diff)
downloadsamba-d670d0a09bec3b6900421df17fc9d959545ee953.tar.gz
samba-d670d0a09bec3b6900421df17fc9d959545ee953.tar.bz2
samba-d670d0a09bec3b6900421df17fc9d959545ee953.zip
Revert "Remove gencache_[un]lock_entry"
This reverts commit 7a5a575ffe5196caecedc93970a25abfbe6f8059. (This used to be commit 62e444dd50ae974c2ab9a553cdf7f188a8f2c538)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/dsgetdcname.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c
index afc87030d0..2a445cbd5a 100644
--- a/source3/libsmb/dsgetdcname.c
+++ b/source3/libsmb/dsgetdcname.c
@@ -159,6 +159,7 @@ static NTSTATUS dsgetdcname_cache_store(TALLOC_CTX *mem_ctx,
{
time_t expire_time;
char *key;
+ bool ret = false;
if (!gencache_init()) {
return NT_STATUS_INTERNAL_DB_ERROR;
@@ -171,8 +172,15 @@ static NTSTATUS dsgetdcname_cache_store(TALLOC_CTX *mem_ctx,
expire_time = time(NULL) + DSGETDCNAME_CACHE_TTL;
- return gencache_set_data_blob(key, blob, expire_time)
- ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ if (gencache_lock_entry(key) != 0) {
+ return NT_STATUS_LOCK_NOT_GRANTED;
+ }
+
+ ret = gencache_set_data_blob(key, blob, expire_time);
+
+ gencache_unlock_entry(key);
+
+ return ret ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
}
/****************************************************************