Userspace: init now sets user and group ids before running their shell
This commit is contained in:
		
							parent
							
								
									bb4d81a4fa
								
							
						
					
					
						commit
						12d56be5cc
					
				| 
						 | 
					@ -131,6 +131,11 @@ int main()
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					printf("Welcome back %s!\n", user.name.data());
 | 
										printf("Welcome back %s!\n", user.name.data());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										if (setgid(user.gid) == -1)
 | 
				
			||||||
 | 
											perror("setgid");
 | 
				
			||||||
 | 
										if (setuid(user.uid) == -1)
 | 
				
			||||||
 | 
											perror("setuid");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					execl(user.shell.data(), user.shell.data(), nullptr);
 | 
										execl(user.shell.data(), user.shell.data(), nullptr);
 | 
				
			||||||
					perror("execl");
 | 
										perror("execl");
 | 
				
			||||||
					
 | 
										
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue