subject

Assume the following struct is declared for the permission list of a file in Linux. Each permission (u or g or o) is represented as an octal. For example, u=7 means rwx, u=5 means r-x.

typedef struct {
unsigned int uid; // owner id
unsigned int gid; // group id
unsigned char u; // owner's permission
unsigned char g; // group's permission
unsigned char o; // other's permission
} Permission;

The permission check procedure is

(1) A user requests an operation on a file.
(2) If the user is the owner of the file, the operation will be checked against the owner's permission of the file. The result is either grant or deny.
(3) Otherwise, if the user is not the owner but in the group of the file, the operation will be checked against the group's permission of the file. The result is either grant or deny.
(4) Otherwise, if the user is neither the owner nor in the group of the file, the operation will be checked against the other's permission of the file. The result is either grant or deny.

Write a C/C++ function accesscheck(unsigned int uid, unsigned int gid, unsigned char req, int fid) to enforce access control in Linux.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:30
Which of the following is an example of intellectual properly! oa. new version of a novelb. journal of ideasc. pages of a bookood. lines of a poem
Answers: 2
question
Computers and Technology, 22.06.2019 23:00
Is an attack that relies on guessing the isns of tcp packets
Answers: 2
question
Computers and Technology, 23.06.2019 06:30
How do you write an argumentative essay about the importance of free enterprise ?
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Choose the answers that best complete each sentence. on average,are more expensive than other kinds of postsecondary schools. the cost of room and board includes. to save money, some students attend auniversity in their home state.
Answers: 2
You know the right answer?
Assume the following struct is declared for the permission list of a file in Linux. Each permissio...
Questions