auth: initial implementation + some filesystem checks

This commit is contained in:
Matheus
2024-08-24 20:00:46 -03:00
parent dd70116695
commit 4d51507953
19 changed files with 251 additions and 34 deletions
+3 -2
View File
@@ -4,6 +4,7 @@
#include <kernel/alloc.h>
#include <errno.h>
#include <logging.h>
#include <kernel/auth.h>
syscallret_t syscall_openat(context_t *context, int dirfd, char *path, int flags, mode_t mode) {
syscallret_t ret = {
@@ -54,8 +55,8 @@ syscallret_t syscall_openat(context_t *context, int dirfd, char *path, int flags
if (ret.errno == ENOENT && (flags & O_CREAT)) {
vattr_t attr = {
.mode = UMASK(mode),
.gid = _cpu()->thread->proc->cred.gid,
.uid = _cpu()->thread->proc->cred.uid
.gid = _cpu()->thread->proc->cred.egid,
.uid = _cpu()->thread->proc->cred.euid
};
ret.errno = vfs_create(dirnode, pathbuf, &attr, V_TYPE_REGULAR, &vnode);