summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-01-25 14:23:19 -0800
committerJeremy Allison <jra@samba.org>2011-01-25 14:23:19 -0800
commit44732734cca2328a8aceb2db9b577c923920f644 (patch)
tree05bc735662ba82137e96479322c4d3737bff9693 /source3/libsmb
parenta65bce4e38d0b940286c7c93c226651e5fb45082 (diff)
downloadsamba-44732734cca2328a8aceb2db9b577c923920f644.tar.gz
samba-44732734cca2328a8aceb2db9b577c923920f644.tar.bz2
samba-44732734cca2328a8aceb2db9b577c923920f644.zip
Fix bug #7863 - Unlink may unlink wrong file when hardlinks are involved.
Do this by keeping a linked list of delete on close tokens, one for each filename that identifies a path to the dev/inode. Use the jenkins hash of the pathname to identify the correct token.
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/smb_share_modes.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/source3/libsmb/smb_share_modes.c b/source3/libsmb/smb_share_modes.c
index 2eda7a499f..9392349b10 100644
--- a/source3/libsmb/smb_share_modes.c
+++ b/source3/libsmb/smb_share_modes.c
@@ -257,7 +257,7 @@ int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx,
return 0;
}
- *p_delete_on_close = ld->u.s.delete_on_close;
+ *p_delete_on_close = ld->u.s.num_delete_token_entries != 0;
*pp_list = list;
free(db_data.dptr);
return list_num;
@@ -324,8 +324,7 @@ int smb_create_share_mode_entry_ex(struct smbdb_ctx *db_ctx,
ld = (struct locking_data *)db_data.dptr;
memset(ld, '\0', sizeof(struct locking_data));
ld->u.s.num_share_mode_entries = 1;
- ld->u.s.delete_on_close = 0;
- ld->u.s.delete_token_size = 0;
+ ld->u.s.num_delete_token_entries = 0;
shares = (struct share_mode_entry *)(db_data.dptr + sizeof(struct locking_data));
create_share_mode_entry(shares, new_entry, name_hash);
@@ -371,7 +370,7 @@ int smb_create_share_mode_entry_ex(struct smbdb_ctx *db_ctx,
ld = (struct locking_data *)new_data_p;
ld->u.s.num_share_mode_entries++;
- /* Append the original delete_token and filenames. */
+ /* Append the original delete_tokens and filenames. */
memcpy(new_data_p + sizeof(struct locking_data) + (ld->u.s.num_share_mode_entries * sizeof(struct share_mode_entry)),
db_data.dptr + sizeof(struct locking_data) + (orig_num_share_modes * sizeof(struct share_mode_entry)),
db_data.dsize - sizeof(struct locking_data) - (orig_num_share_modes * sizeof(struct share_mode_entry)));
@@ -488,7 +487,7 @@ int smb_delete_share_mode_entry(struct smbdb_ctx *db_ctx,
return tdb_delete(db_ctx->smb_tdb, locking_key);
}
- /* Copy any delete token plus the terminating filenames. */
+ /* Copy any delete tokens plus the terminating filenames. */
remaining_ptr = db_data.dptr + sizeof(struct locking_data) + (orig_num_share_modes * sizeof(struct share_mode_entry));
remaining_size = db_data.dsize - (remaining_ptr - db_data.dptr);