XenevaOS
Loading...
Searching...
No Matches
cred.h
Go to the documentation of this file.
1
32#ifndef __CRED_H__
33#define __CRED_H__
34
35#include <Cred/group.h>
36#include <Cred/user.h>
37#include <Fs/vfs.h>
38#include <process.h>
39
40#define CRED_CAP_SETUID 0
41#define CRED_CAP_SETGID 1
42#define CRED_CAP_BYPASS_PERM_CHECK 2
43#define CRED_CAP_BYPASS_SECURITY_CHECK 3
44#define CRED_CAP_IPC 4
45#define CRED_CAP_SETCAP 5
46
48#define CRED_IS_CAPABLE(a,b) ((a >> b) & 0x1)
49
51#define CRED_SET_CAP(b) (1ULL<< b)
52
54#define CRED_SET_CAP_ROOT(proc) (proc->creds.caps = UINT8_MAX)
55
56#define CRED_MARK_ROOT(proc) \
57 proc->creds.uid = 0; \
58 proc->creds.gid = 0
59
66extern int AuCredChangeID(int fd, UID_NUM uid, GID_NUM gid);
67
73extern int AuCredAddSGroup(int proc_id, int sgid);
74
80extern int AuCredSetCap(int proc_id, int cap);
81
82
87extern int AuCredGetCap(int proc_id);
88
97
103extern int AuSetUID(int proc_id, UID_NUM uid);
104
110extern int AuSetGID(int proc_id, GID_NUM gid);
111
112#endif
int AuCredChangeID(int fd, UID_NUM uid, GID_NUM gid)
AuCredChangeID – change credential ids.
Definition cred.c:201
int AuCredCheckPermissions(AuVFSNode *node, AuProcCredentials *cred)
AuCredCheckPermissions – before giving permission, check all credentials, enei aru access koriba dibi...
Definition cred.c:299
int AuSetGID(int proc_id, GID_NUM gid)
AuSetGID – change user id of a process.
Definition cred.c:368
int AuCredGetCap(int proc_id)
Definition cred.c:275
int AuSetUID(int proc_id, UID_NUM uid)
AuSetUID – change user id of a process.
Definition cred.c:334
int AuCredSetCap(int proc_id, int cap)
Definition cred.c:253
int AuCredAddSGroup(int proc_id, int sgid)
AuCredAddSGroup – add supplimentary gid to process.
Definition cred.c:228
#define GID_NUM
Definition group.h:38
Definition vfs.h:98
Definition process.h:95
#define UID_NUM
Definition user.h:35