summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-05-24 00:13:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:22:46 -0500
commitf5038178a9a2ad295365e54ff4e7661daf55f2df (patch)
tree25c43541ea0b1a32cd262f24225fee4d0a0ac476
parent57d6318a0b5ecc0154547a04acef8ac222c1d28f (diff)
downloadsamba-f5038178a9a2ad295365e54ff4e7661daf55f2df.tar.gz
samba-f5038178a9a2ad295365e54ff4e7661daf55f2df.tar.bz2
samba-f5038178a9a2ad295365e54ff4e7661daf55f2df.zip
r23106: Use lchown for symlinks.
Jeremy. (This used to be commit b98175440b2c235fe223b4375441f15ea027a5b2)
-rw-r--r--source3/smbd/trans2.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index bd66980983..835fd0cedb 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -5268,9 +5268,18 @@ size = %.0f, uid = %u, gid = %u, raw perms = 0%o\n",
*/
if ((set_owner != (uid_t)SMB_UID_NO_CHANGE) && (psbuf->st_uid != set_owner)) {
- DEBUG(10,("smb_set_file_unix_basic: SMB_SET_FILE_UNIX_BASIC changing owner %u for file %s\n",
+ int ret;
+
+ DEBUG(10,("smb_set_file_unix_basic: SMB_SET_FILE_UNIX_BASIC changing owner %u for path %s\n",
(unsigned int)set_owner, fname ));
- if (SMB_VFS_CHOWN(conn, fname, set_owner, (gid_t)-1) != 0) {
+
+ if (S_ISLNK(psbuf->st_mode)) {
+ ret = SMB_VFS_LCHOWN(conn, fname, set_owner, (gid_t)-1);
+ } else {
+ ret = SMB_VFS_CHOWN(conn, fname, set_owner, (gid_t)-1);
+ }
+
+ if (ret != 0) {
status = map_nt_error_from_unix(errno);
if (delete_on_fail) {
SMB_VFS_UNLINK(conn,fname);