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-local.c | |
parent | e95ead32efc48157de12e0a257ea1c52541a6ce1 (diff) |
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-local.c')
-rw-r--r-- | hw/virtio-9p-local.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/hw/virtio-9p-local.c b/hw/virtio-9p-local.c index 9bdcf02b72..1d7cb32411 100644 --- a/hw/virtio-9p-local.c +++ b/hw/virtio-9p-local.c @@ -240,9 +240,14 @@ static int local_rename(FsContext *ctx, const char *oldpath, } -static int local_chown(FsContext *ctx, const char *path, uid_t uid, gid_t gid) +static int local_chown(FsContext *fs_ctx, const char *path, FsCred *credp) { - return chown(rpath(ctx, path), uid, gid); + if (fs_ctx->fs_sm == SM_MAPPED) { + return local_set_xattr(rpath(fs_ctx, path), credp); + } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) { + return lchown(rpath(fs_ctx, path), credp->fc_uid, credp->fc_gid); + } + return -1; } static int local_utime(FsContext *ctx, const char *path, |