mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
virtio-9p: Security model for create/open2
In the mapped security model, VirtFS server intercepts and maps the file object create and get/set attribute requests. Files on the fileserver will be created with VirtFS servers (QEMU) user credentials and the client-users credentials are stored in extended attributes. On the request to get attributes, server extracts the client-users credentials from extended attributes and sends them to the client. On Host/Fileserver: -rw-------. 2 virfsuid virtfsgid 0 2010-05-11 09:19 afile On Guest/Client: -rw-r--r-- 2 guestuser guestuser 0 2010-05-11 12:19 afile Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
1237ad7607
commit
4750a96f6b
3 changed files with 61 additions and 8 deletions
|
@ -180,9 +180,17 @@ static int v9fs_do_fstat(V9fsState *s, int fd, struct stat *stbuf)
|
|||
return s->ops->fstat(&s->ctx, fd, stbuf);
|
||||
}
|
||||
|
||||
static int v9fs_do_open2(V9fsState *s, V9fsString *path, int flags, mode_t mode)
|
||||
static int v9fs_do_open2(V9fsState *s, V9fsCreateState *vs)
|
||||
{
|
||||
return s->ops->open2(&s->ctx, path->data, flags, mode);
|
||||
FsCred cred;
|
||||
int flags;
|
||||
|
||||
cred_init(&cred);
|
||||
cred.fc_uid = vs->fidp->uid;
|
||||
cred.fc_mode = vs->perm & 0777;
|
||||
flags = omode_to_uflags(vs->mode) | O_CREAT;
|
||||
|
||||
return s->ops->open2(&s->ctx, vs->fullname.data, flags, &cred);
|
||||
}
|
||||
|
||||
static int v9fs_do_symlink(V9fsState *s, V9fsString *oldpath,
|
||||
|
@ -1815,9 +1823,7 @@ static void v9fs_create_post_lstat(V9fsState *s, V9fsCreateState *vs, int err)
|
|||
err = v9fs_do_mksock(s, &vs->fullname);
|
||||
v9fs_create_post_mksock(s, vs, err);
|
||||
} else {
|
||||
vs->fidp->fd = v9fs_do_open2(s, &vs->fullname,
|
||||
omode_to_uflags(vs->mode) | O_CREAT,
|
||||
vs->perm & 0777);
|
||||
vs->fidp->fd = v9fs_do_open2(s, vs);
|
||||
v9fs_create_post_open2(s, vs, err);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue