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
86extern int AuCredGetCap(int proc_id);
87
96
102extern int AuSetUID(int proc_id, UID_NUM uid);
103
109extern int AuSetGID(int proc_id, GID_NUM gid);
110
116extern bool AuCredIsRoot(AuProcCredentials* c);
117
124extern bool AuCredInGroup(AuProcCredentials* c, GID_NUM gid);
125
126#endif
int AuCredChangeID(int fd, UID_NUM uid, GID_NUM gid)
AuCredChangeID – change credential ids.
Definition cred.c:198
bool AuCredIsRoot(AuProcCredentials *c)
AuCredIsRoot – check if credential information is in root.
Definition cred.c:433
int AuCredCheckPermissions(AuVFSNode *node, AuProcCredentials *cred)
AuCredCheckPermissions – before giving permission, check all credentials, enei aru access koriba dibi...
Definition cred.c:321
bool AuCredInGroup(AuProcCredentials *c, GID_NUM gid)
AuCredInGroup – check the credentials if it lies in desired groupd.
Definition cred.c:443
int AuSetGID(int proc_id, GID_NUM gid)
AuSetGID – change user id of a process.
Definition cred.c:397
int AuCredGetCap(int proc_id)
Definition cred.c:291
int AuSetUID(int proc_id, UID_NUM uid)
AuSetUID – change user id of a process.
Definition cred.c:361
int AuCredSetCap(int proc_id, int cap)
Definition cred.c:264
int AuCredAddSGroup(int proc_id, int sgid)
AuCredAddSGroup – add supplimentary gid to process.
Definition cred.c:231
#define GID_NUM
Definition group.h:38
void int node
Definition kthread.h:31
Definition vfs.h:129
Definition process.h:103
Definition file.h:140
#define UID_NUM
Definition user.h:35