Revision 758e8e38 hw/virtio-9p.c
b/hw/virtio-9p.c | ||
---|---|---|
67 | 67 |
return ret; |
68 | 68 |
} |
69 | 69 |
|
70 |
static int v9fs_do_lstat(V9fsState *s, V9fsString *path, struct stat *stbuf)
|
|
70 |
void cred_init(FsCred *credp)
|
|
71 | 71 |
{ |
72 |
return s->ops->lstat(&s->ctx, path->data, stbuf); |
|
72 |
credp->fc_uid = -1; |
|
73 |
credp->fc_gid = -1; |
|
74 |
credp->fc_mode = -1; |
|
75 |
credp->fc_rdev = -1; |
|
73 | 76 |
} |
74 | 77 |
|
75 |
static int v9fs_do_setuid(V9fsState *s, uid_t uid)
|
|
78 |
static int v9fs_do_lstat(V9fsState *s, V9fsString *path, struct stat *stbuf)
|
|
76 | 79 |
{ |
77 |
return s->ops->setuid(&s->ctx, uid);
|
|
80 |
return s->ops->lstat(&s->ctx, path->data, stbuf);
|
|
78 | 81 |
} |
79 | 82 |
|
80 | 83 |
static ssize_t v9fs_do_readlink(V9fsState *s, V9fsString *path, V9fsString *buf) |
... | ... | |
348 | 351 |
|
349 | 352 |
for (f = s->fid_list; f; f = f->next) { |
350 | 353 |
if (f->fid == fid) { |
351 |
v9fs_do_setuid(s, f->uid); |
|
352 | 354 |
return f; |
353 | 355 |
} |
354 | 356 |
} |
... | ... | |
2253 | 2255 |
exit(1); |
2254 | 2256 |
} |
2255 | 2257 |
|
2256 |
if (!strcmp(fse->security_model, "passthrough") && |
|
2257 |
!strcmp(fse->security_model, "mapped")) { |
|
2258 |
if (!strcmp(fse->security_model, "passthrough")) { |
|
2259 |
/* Files on the Fileserver set to client user credentials */ |
|
2260 |
s->ctx.fs_sm = SM_PASSTHROUGH; |
|
2261 |
} else if (!strcmp(fse->security_model, "mapped")) { |
|
2262 |
/* Files on the fileserver are set to QEMU credentials. |
|
2263 |
* Client user credentials are saved in extended attributes. |
|
2264 |
*/ |
|
2265 |
s->ctx.fs_sm = SM_MAPPED; |
|
2266 |
} else { |
|
2258 | 2267 |
/* user haven't specified a correct security option */ |
2259 | 2268 |
fprintf(stderr, "one of the following must be specified as the" |
2260 | 2269 |
"security option:\n\t security_model=passthrough \n\t " |
Also available in: Unified diff