diff options
author | Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com> | 2010-06-14 13:34:46 -0700 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-06-22 15:15:51 -0500 |
commit | 00ec5c37601accb2b85b089d72fc7ddff2f4222e (patch) | |
tree | a36bb07705c0045bc2db955115274e32071dae7c /hw/virtio-9p.c | |
parent | 4750a96f6baf8949cc04a0c5b7167606544a4401 (diff) |
virtio-9p: Security model for mkdir
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 | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c index 49a3065be9..005f725a47 100644 --- a/hw/virtio-9p.c +++ b/hw/virtio-9p.c @@ -170,9 +170,15 @@ static int v9fs_do_mksock(V9fsState *s, V9fsString *path) return s->ops->mksock(&s->ctx, path->data); } -static int v9fs_do_mkdir(V9fsState *s, V9fsString *path, mode_t mode) +static int v9fs_do_mkdir(V9fsState *s, V9fsCreateState *vs) { - return s->ops->mkdir(&s->ctx, path->data, mode); + FsCred cred; + + cred_init(&cred); + cred.fc_uid = vs->fidp->uid; + cred.fc_mode = vs->perm & 0777; + + return s->ops->mkdir(&s->ctx, vs->fullname.data, &cred); } static int v9fs_do_fstat(V9fsState *s, int fd, struct stat *stbuf) @@ -1776,7 +1782,7 @@ static void v9fs_create_post_lstat(V9fsState *s, V9fsCreateState *vs, int err) } if (vs->perm & P9_STAT_MODE_DIR) { - err = v9fs_do_mkdir(s, &vs->fullname, vs->perm & 0777); + err = v9fs_do_mkdir(s, vs); v9fs_create_post_mkdir(s, vs, err); } else if (vs->perm & P9_STAT_MODE_SYMLINK) { err = v9fs_do_symlink(s, &vs->extension, &vs->fullname); |