diff options
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/dsgetdcname.c | 12 |
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; } /**************************************************************** |