The Samba-Bugzilla – Attachment 4824 Details for
Bug 6769
symlink unlink does nothing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
git-am patch for 3.4.3.
0001-Fix-bug-6769-symlink-unlink-does-nothing.patch (text/plain), 7.38 KB, created by
Jeremy Allison
on 2009-10-08 18:42:23 UTC
(
hide
)
Description:
git-am patch for 3.4.3.
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2009-10-08 18:42:23 UTC
Size:
7.38 KB
patch
obsolete
>From 81f137fa3d4624282a18b75bfec68093d729fd9b Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Thu, 8 Oct 2009 16:40:26 -0700 >Subject: [PATCH] Fix bug 6769 - symlink unlink does nothing. > Jeremy. > >--- > source3/modules/vfs_default.c | 6 +++- > source3/smbd/posix_acls.c | 57 ++++++++++++++++++++++++++++++----------- > source3/smbd/reply.c | 49 +++++++++++++++++++++++++++-------- > 3 files changed, 85 insertions(+), 27 deletions(-) > >diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c >index 0a66531..ca401b6 100644 >--- a/source3/modules/vfs_default.c >+++ b/source3/modules/vfs_default.c >@@ -1130,7 +1130,11 @@ static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle, > ret = SMB_VFS_FSTAT(fsp, &sbuf); > } > else { >- ret = SMB_VFS_STAT(handle->conn, fname, &sbuf); >+ if (lp_posix_pathnames()) { >+ ret = SMB_VFS_LSTAT(handle->conn, fname, &sbuf); >+ } else { >+ ret = SMB_VFS_STAT(handle->conn, fname, &sbuf); >+ } > } > > if (ret == -1) { >diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c >index 53bfaa1..766c7b0 100644 >--- a/source3/smbd/posix_acls.c >+++ b/source3/smbd/posix_acls.c >@@ -3341,13 +3341,19 @@ NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name, > SMB_ACL_T posix_acl = NULL; > SMB_ACL_T def_acl = NULL; > struct pai_val *pal; >+ int ret; > > *ppdesc = NULL; > > DEBUG(10,("posix_get_nt_acl: called for file %s\n", name )); > > /* Get the stat struct for the owner info. */ >- if(SMB_VFS_STAT(conn, name, &sbuf) != 0) { >+ if (lp_posix_pathnames()) { >+ ret = SMB_VFS_LSTAT(conn, name, &sbuf); >+ } else { >+ ret = SMB_VFS_STAT(conn, name, &sbuf); >+ } >+ if(ret != 0) { > return map_nt_error_from_unix(errno); > } > >@@ -3381,6 +3387,7 @@ int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid) > int ret; > files_struct *fsp; > SMB_STRUCT_STAT st; >+ bool posix_paths = lp_posix_pathnames(); > > if(!CAN_WRITE(conn)) { > return -1; >@@ -3388,7 +3395,11 @@ int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid) > > /* Case (1). */ > /* try the direct way first */ >- ret = SMB_VFS_CHOWN(conn, fname, uid, gid); >+ if (posix_paths) { >+ ret = SMB_VFS_LCHOWN(conn, fname, uid, gid); >+ } else { >+ ret = SMB_VFS_CHOWN(conn, fname, uid, gid); >+ } > if (ret == 0) > return 0; > >@@ -3428,7 +3439,12 @@ int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid) > return -1; > } > >- if (SMB_VFS_STAT(conn,fname,&st)) { >+ if (posix_paths) { >+ ret = SMB_VFS_LSTAT(conn,fname,&st); >+ } else { >+ ret = SMB_VFS_STAT(conn,fname,&st); >+ } >+ if (ret != 0) { > return -1; > } > >@@ -3664,6 +3680,8 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const SEC_DESC > bool set_acl_as_root = false; > bool acl_set_support = false; > bool ret = false; >+ bool posix_paths = lp_posix_pathnames(); >+ int sret; > > DEBUG(10,("set_nt_acl: called for file %s\n", fsp->fsp_name )); > >@@ -3677,8 +3695,14 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const SEC_DESC > */ > > if(fsp->is_directory || fsp->fh->fd == -1) { >- if(SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf) != 0) >+ if (posix_paths) { >+ sret = SMB_VFS_LSTAT(fsp->conn,fsp->fsp_name, &sbuf); >+ } else { >+ sret = SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf); >+ } >+ if (sret != 0) { > return map_nt_error_from_unix(errno); >+ } > } else { > if(SMB_VFS_FSTAT(fsp, &sbuf) != 0) > return map_nt_error_from_unix(errno); >@@ -3722,17 +3746,24 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const SEC_DESC > */ > > if(fsp->is_directory) { >- if(SMB_VFS_STAT(fsp->conn, fsp->fsp_name, &sbuf) != 0) { >+ if (posix_paths) { >+ sret = SMB_VFS_LSTAT(fsp->conn, fsp->fsp_name, &sbuf); >+ } else { >+ sret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name, &sbuf); >+ } >+ if (sret != 0) { > return map_nt_error_from_unix(errno); > } > } else { >- >- int sret; >- >- if(fsp->fh->fd == -1) >- sret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name, &sbuf); >- else >+ if(fsp->fh->fd == -1) { >+ if (posix_paths) { >+ sret = SMB_VFS_LSTAT(fsp->conn, fsp->fsp_name, &sbuf); >+ } else { >+ sret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name, &sbuf); >+ } >+ } else { > sret = SMB_VFS_FSTAT(fsp, &sbuf); >+ } > > if(sret != 0) > return map_nt_error_from_unix(errno); >@@ -3811,8 +3842,6 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const SEC_DESC > return map_nt_error_from_unix(errno); > } > } else { >- int sret = -1; >- > /* > * No default ACL - delete one if it exists. > */ >@@ -3874,8 +3903,6 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const SEC_DESC > } > > if (orig_mode != posix_perms) { >- int sret = -1; >- > DEBUG(3,("set_nt_acl: chmod %s. perms = 0%o.\n", > fsp->fsp_name, (unsigned int)posix_perms )); > >diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c >index 285056c..acd84d6 100644 >--- a/source3/smbd/reply.c >+++ b/source3/smbd/reply.c >@@ -918,10 +918,19 @@ void reply_checkpath(struct smb_request *req) > goto path_err; > } > >- if (!VALID_STAT(sbuf) && (SMB_VFS_STAT(conn,name,&sbuf) != 0)) { >- DEBUG(3,("reply_checkpath: stat of %s failed (%s)\n",name,strerror(errno))); >- status = map_nt_error_from_unix(errno); >- goto path_err; >+ if (!VALID_STAT(sbuf)) { >+ int ret; >+ >+ if (lp_posix_pathnames()) { >+ ret = SMB_VFS_LSTAT(conn,name,&sbuf); >+ } else { >+ ret = SMB_VFS_STAT(conn,name,&sbuf); >+ } >+ if (ret != 0) { >+ DEBUG(3,("reply_checkpath: stat of %s failed (%s)\n",name,strerror(errno))); >+ status = map_nt_error_from_unix(errno); >+ goto path_err; >+ } > } > > if (!S_ISDIR(sbuf.st_mode)) { >@@ -1027,11 +1036,20 @@ void reply_getatr(struct smb_request *req) > END_PROFILE(SMBgetatr); > return; > } >- if (!VALID_STAT(sbuf) && (SMB_VFS_STAT(conn,fname,&sbuf) != 0)) { >- DEBUG(3,("reply_getatr: stat of %s failed (%s)\n",fname,strerror(errno))); >- reply_unixerror(req, ERRDOS,ERRbadfile); >- END_PROFILE(SMBgetatr); >- return; >+ if (!VALID_STAT(sbuf)) { >+ int ret; >+ >+ if (lp_posix_pathnames()) { >+ ret = SMB_VFS_LSTAT(conn,fname,&sbuf); >+ } else { >+ ret = SMB_VFS_STAT(conn,fname,&sbuf); >+ } >+ if (ret != 0) { >+ DEBUG(3,("reply_getatr: stat of %s failed (%s)\n",fname,strerror(errno))); >+ reply_unixerror(req, ERRDOS,ERRbadfile); >+ END_PROFILE(SMBgetatr); >+ return; >+ } > } > > mode = dos_mode(conn,fname,&sbuf); >@@ -2260,6 +2278,8 @@ static NTSTATUS do_unlink(connection_struct *conn, > uint32 fattr; > files_struct *fsp; > uint32 dirtype_orig = dirtype; >+ bool posix_paths = lp_posix_pathnames(); >+ int ret; > NTSTATUS status; > > DEBUG(10,("do_unlink: %s, dirtype = %d\n", fname, dirtype )); >@@ -2268,7 +2288,12 @@ static NTSTATUS do_unlink(connection_struct *conn, > return NT_STATUS_MEDIA_WRITE_PROTECTED; > } > >- if (SMB_VFS_LSTAT(conn,fname,&sbuf) != 0) { >+ if (posix_paths) { >+ ret = SMB_VFS_LSTAT(conn,fname,&sbuf); >+ } else { >+ ret = SMB_VFS_STAT(conn,fname,&sbuf); >+ } >+ if (ret != 0) { > return map_nt_error_from_unix(errno); > } > >@@ -2356,7 +2381,9 @@ static NTSTATUS do_unlink(connection_struct *conn, > FILE_SHARE_NONE, /* share_access */ > FILE_OPEN, /* create_disposition*/ > FILE_NON_DIRECTORY_FILE, /* create_options */ >- FILE_ATTRIBUTE_NORMAL, /* file_attributes */ >+ /* file_attributes */ >+ posix_paths ? FILE_FLAG_POSIX_SEMANTICS|0777 : >+ FILE_ATTRIBUTE_NORMAL, > 0, /* oplock_request */ > 0, /* allocation_size */ > NULL, /* sd */ >-- >1.5.4.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 6769
:
4770
|
4771
|
4772
|
4792
|
4793
|
4796
|
4797
|
4801
|
4802
|
4811
|
4822
|
4823
| 4824 |
4862