1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

smbd: Use share_mode_forall_entries() in has_delete_on_close()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2019-08-16 11:11:36 +02:00 committed by Jeremy Allison
parent 14cc16948f
commit 5b1fd018a2

View File

@ -1615,24 +1615,36 @@ bool is_stat_open(uint32_t access_mask)
((access_mask & ~stat_open_bits) == 0));
}
struct has_delete_on_close_state {
bool ret;
};
static bool has_delete_on_close_fn(
struct share_mode_entry *e,
bool *modified,
void *private_data)
{
struct has_delete_on_close_state *state = private_data;
state->ret = !share_entry_stale_pid(e);
return state->ret;
}
static bool has_delete_on_close(struct share_mode_lock *lck,
uint32_t name_hash)
{
struct share_mode_data *d = lck->data;
uint32_t i;
struct has_delete_on_close_state state = { .ret = false };
bool ok;
if (d->num_share_modes == 0) {
return false;
}
if (!is_delete_on_close_set(lck, name_hash)) {
return false;
}
for (i=0; i<d->num_share_modes; i++) {
if (!share_mode_stale_pid(d, i)) {
return true;
}
ok= share_mode_forall_entries(lck, has_delete_on_close_fn, &state);
if (!ok) {
DBG_DEBUG("share_mode_forall_entries failed\n");
return false;
}
return false;
return state.ret;
}
/****************************************************************************