From 11c5fbaba4636700bb657f9d59883082be0ac625 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 6 Jan 1999 21:37:58 +0000 Subject: Added full pathname lock patch from Andy Jeremy. --- source/locking/locking_shm.c | 6 ++++-- source/locking/locking_slow.c | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/source/locking/locking_shm.c b/source/locking/locking_shm.c index 375a8b7f109..8429ab8f7b1 100644 --- a/source/locking/locking_shm.c +++ b/source/locking/locking_shm.c @@ -430,7 +430,7 @@ static BOOL shm_set_share_mode(int token, files_struct *fsp, uint16 port, uint16 /* We must create a share_mode_record */ share_mode_record *new_mode_p = NULL; int new_offset = shmops->shm_alloc(sizeof(share_mode_record) + - strlen(fsp->fsp_name) + 1); + strlen(fsp->fsp_name) + strlen(fsp->conn->connectpath) + 2); if(new_offset == 0) { DEBUG(0,("ERROR:set_share_mode shmops->shm_alloc fail!\n")); return False; @@ -441,7 +441,9 @@ static BOOL shm_set_share_mode(int token, files_struct *fsp, uint16 port, uint16 new_mode_p->st_ino = inode; new_mode_p->num_share_mode_entries = 0; new_mode_p->share_mode_entries = 0; - pstrcpy(new_mode_p->file_name, fsp->fsp_name); + pstrcpy(new_mode_p->file_name, fsp->conn->connectpath); + pstrcat(new_mode_p->file_name, "/"); + pstrcat(new_mode_p->file_name, fsp->fsp_name); /* Chain onto the start of the hash chain (in the hope we will be used first). */ new_mode_p->next_offset = mode_array[hash_entry]; diff --git a/source/locking/locking_slow.c b/source/locking/locking_slow.c index 9f70f171b5e..c91316d23d9 100644 --- a/source/locking/locking_slow.c +++ b/source/locking/locking_slow.c @@ -789,15 +789,17 @@ deleting it.\n", fname)); { /* New file - just use a single_entry. */ if((buf = (char *)malloc(SMF_HEADER_LENGTH + - strlen(fsp->fsp_name) + 1 + SMF_ENTRY_LENGTH)) == NULL) + strlen(fsp->fsp_name) + strlen(fsp->conn->connectpath) + 2 + SMF_ENTRY_LENGTH)) == NULL) { DEBUG(0,("ERROR: set_share_mode: malloc failed for single entry.\n")); return False; } SIVAL(buf,SMF_VERSION_OFFSET,LOCKING_VERSION); SIVAL(buf,SMF_NUM_ENTRIES_OFFSET,0); - SSVAL(buf,SMF_FILENAME_LEN_OFFSET,strlen(fsp->fsp_name) + 1); - pstrcpy(buf + SMF_HEADER_LENGTH, fsp->fsp_name); + SSVAL(buf,SMF_FILENAME_LEN_OFFSET,strlen(fsp->fsp_name) + strlen(fsp->conn->connectpath) + 2); + pstrcpy(buf + SMF_HEADER_LENGTH, fsp->conn->connectpath); + pstrcat(buf + SMF_HEADER_LENGTH, "/"); + pstrcat(buf + SMF_HEADER_LENGTH, fsp->fsp_name); } num_entries = IVAL(buf,SMF_NUM_ENTRIES_OFFSET); -- cgit