From f7613bee32ebd13ff4a8d721a59cf27b1fe5d94b Mon Sep 17 00:00:00 2001 From: "Venkateswararao Jujjuri (JV)" Date: Mon, 14 Jun 2010 13:34:43 -0700 Subject: virtio-9p: Security model for chown mapped model changes the owner in the extended attributes. passthrough model does the change through lchown() as the server don't need to follow the link and client will send the actual filesystem object. Signed-off-by: Venkateswararao Jujjuri Signed-off-by: Anthony Liguori --- hw/virtio-9p.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'hw/virtio-9p.c') diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c index 24291f4860..fa459c9260 100644 --- a/hw/virtio-9p.c +++ b/hw/virtio-9p.c @@ -209,7 +209,12 @@ static int v9fs_do_rename(V9fsState *s, V9fsString *oldpath, static int v9fs_do_chown(V9fsState *s, V9fsString *path, uid_t uid, gid_t gid) { - return s->ops->chown(&s->ctx, path->data, uid, gid); + FsCred cred; + cred_init(&cred); + cred.fc_uid = uid; + cred.fc_gid = gid; + + return s->ops->chown(&s->ctx, path->data, &cred); } static int v9fs_do_utime(V9fsState *s, V9fsString *path, @@ -2014,7 +2019,7 @@ static void v9fs_wstat_post_utime(V9fsState *s, V9fsWstatState *vs, int err) goto out; } - if (vs->v9stat.n_gid != -1) { + if (vs->v9stat.n_gid != -1 || vs->v9stat.n_uid != -1) { if (v9fs_do_chown(s, &vs->fidp->path, vs->v9stat.n_uid, vs->v9stat.n_gid)) { err = -errno; -- cgit v1.2.3