From f5038178a9a2ad295365e54ff4e7661daf55f2df Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 24 May 2007 00:13:24 +0000 Subject: r23106: Use lchown for symlinks. Jeremy. (This used to be commit b98175440b2c235fe223b4375441f15ea027a5b2) --- source3/smbd/trans2.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'source3/smbd') 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); -- cgit