aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2011-12-05 13:11:09 +0100
committerMiklos Szeredi <mszeredi@suse.cz>2011-12-05 13:11:09 +0100
commit2ce40698324756c09bc53f19b671fffddbc414f1 (patch)
tree0e51972aceeb680ab88aac1e74a2d22e6d0d19a0
parent97228b866ab9a37a55244463a6b9fc3fdc6d0419 (diff)
downloadsshfs-2ce40698324756c09bc53f19b671fffddbc414f1.tar
sshfs-2ce40698324756c09bc53f19b671fffddbc414f1.tar.gz
sshfs-2ce40698324756c09bc53f19b671fffddbc414f1.tar.bz2
sshfs-2ce40698324756c09bc53f19b671fffddbc414f1.zip
Make chown respect the UID mapping policy
Reported and tested by Vivenzio Pagliari
-rw-r--r--ChangeLog5
-rw-r--r--sshfs.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 8f11917..9b3fb9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-25 Miklos Szeredi <miklos@szeredi.hu>
+
+ * Make chown respect the UID mapping policy. Reported and tested
+ by Vivenzio Pagliari
+
2011-11-16 Miklos Szeredi <miklos@szeredi.hu>
* Submit max 32k reads and writes to the sftp server. Also don't
diff --git a/sshfs.c b/sshfs.c
index e14aa71..323ab6c 100644
--- a/sshfs.c
+++ b/sshfs.c
@@ -2150,6 +2150,10 @@ static int sshfs_chown(const char *path, uid_t uid, gid_t gid)
{
int err;
struct buffer buf;
+
+ if (sshfs.remote_uid_detected && uid == sshfs.local_uid)
+ uid = sshfs.remote_uid;
+
buf_init(&buf, 0);
buf_add_path(&buf, path);
buf_add_uint32(&buf, SSH_FILEXFER_ATTR_UIDGID);