summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-02-01 04:14:07 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:06:20 -0500
commit86c9bac4c31df1606e3758ec42672506dde26cc6 (patch)
tree1b0c707e273f3d44adb2ea3c4e87090d1cc99313 /source3/locking
parent0e551cd5a2f468ad297f1bfbccbc9f91579dc794 (diff)
downloadsamba-86c9bac4c31df1606e3758ec42672506dde26cc6.tar.gz
samba-86c9bac4c31df1606e3758ec42672506dde26cc6.tar.bz2
samba-86c9bac4c31df1606e3758ec42672506dde26cc6.zip
r13274: Fix for bug #3467. Not a show stopper.
jason qian <jason@infrant.com> was a *fantastic* help in tracking this down. Jeremy. (This used to be commit 9f4a9c70fa232047868e5d8a3f132a2dd6bfee82)
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/locking.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index e31ead30e4..e8309582fd 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -49,6 +49,7 @@ struct locking_data {
struct {
int num_share_mode_entries;
BOOL delete_on_close;
+ BOOL initial_delete_on_close; /* Only set at NTCreateX if file was created. */
} s;
struct share_mode_entry dummy; /* Needed for alignment. */
} u;
@@ -435,11 +436,15 @@ static BOOL parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck)
data = (struct locking_data *)dbuf.dptr;
lck->delete_on_close = data->u.s.delete_on_close;
+ lck->initial_delete_on_close = data->u.s.initial_delete_on_close;
lck->num_share_modes = data->u.s.num_share_mode_entries;
DEBUG(10, ("parse_share_modes: delete_on_close: %d, "
- "num_share_modes: %d\n", lck->delete_on_close,
- lck->num_share_modes));
+ "initial_delete_on_close: %d, "
+ "num_share_modes: %d\n",
+ lck->delete_on_close,
+ lck->initial_delete_on_close,
+ lck->num_share_modes));
if ((lck->num_share_modes < 0) || (lck->num_share_modes > 1000000)) {
DEBUG(0, ("invalid number of share modes: %d\n",
@@ -535,8 +540,10 @@ static TDB_DATA unparse_share_modes(struct share_mode_lock *lck)
ZERO_STRUCTP(data);
data->u.s.num_share_mode_entries = lck->num_share_modes;
data->u.s.delete_on_close = lck->delete_on_close;
- DEBUG(10, ("unparse_share_modes: del: %d, num: %d\n",
+ data->u.s.initial_delete_on_close = lck->initial_delete_on_close;
+ DEBUG(10, ("unparse_share_modes: del: %d, initial del %d, num: %d\n",
data->u.s.delete_on_close,
+ data->u.s.initial_delete_on_close,
data->u.s.num_share_mode_entries));
memcpy(result.dptr + sizeof(*data), lck->share_modes,
sizeof(struct share_mode_entry)*lck->num_share_modes);
@@ -613,6 +620,7 @@ struct share_mode_lock *get_share_mode_lock(TALLOC_CTX *mem_ctx,
lck->num_share_modes = 0;
lck->share_modes = NULL;
lck->delete_on_close = False;
+ lck->initial_delete_on_close = False;
lck->fresh = False;
lck->modified = False;
@@ -1046,6 +1054,7 @@ NTSTATUS can_set_delete_on_close(files_struct *fsp, BOOL delete_on_close,
changed the delete on close flag. This will be noticed
in the close code, the last closer will delete the file
if flag is set.
+ Note that setting this to any value clears the initial_delete_on_close flag.
****************************************************************************/
BOOL set_delete_on_close(files_struct *fsp, BOOL delete_on_close)
@@ -1070,6 +1079,11 @@ BOOL set_delete_on_close(files_struct *fsp, BOOL delete_on_close)
lck->modified = True;
}
+ if (lck->initial_delete_on_close) {
+ lck->initial_delete_on_close = False;
+ lck->modified = True;
+ }
+
talloc_free(lck);
return True;
}