diff options
author | Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com> | 2010-06-14 13:34:43 -0700 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-06-22 15:15:50 -0500 |
commit | f7613bee32ebd13ff4a8d721a59cf27b1fe5d94b (patch) | |
tree | b962e63109eb5776f8d1887ee74a73043c4ca8bc /hw/virtio-9p.c | |
parent | e95ead32efc48157de12e0a257ea1c52541a6ce1 (diff) | |
download | qemu-f7613bee32ebd13ff4a8d721a59cf27b1fe5d94b.zip |
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 <jvrao@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-9p.c')
-rw-r--r-- | hw/virtio-9p.c | 9 |
1 files changed, 7 insertions, 2 deletions
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; |