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 | 52d03a14e6ca0773b3427bf3ed8ea2ecd175b769 (patch) | |
tree | b962e63109eb5776f8d1887ee74a73043c4ca8bc /hw/virtio-9p.c | |
parent | ea10ac40d4f9de9fbd0041ea75a8478867ab0ba2 (diff) | |
download | qemu-52d03a14e6ca0773b3427bf3ed8ea2ecd175b769.tar.gz qemu-52d03a14e6ca0773b3427bf3ed8ea2ecd175b769.tar.bz2 qemu-52d03a14e6ca0773b3427bf3ed8ea2ecd175b769.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; |