Security about the user
This commit is contained in:
		
					parent
					
						
							
								a0a74729fc
							
						
					
				
			
			
				commit
				
					
						ef0adeb721
					
				
			
		
					 1 changed files with 6 additions and 0 deletions
				
			
		
							
								
								
									
										6
									
								
								main.cpp
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								main.cpp
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -11,6 +11,12 @@ int main(int argc, char *argv[]) {
 | 
			
		|||
	auto logger = spdlog::stdout_color_st("single_log");
 | 
			
		||||
	spdlog::set_default_logger(logger);
 | 
			
		||||
 | 
			
		||||
	// If the user si root, stop the program
 | 
			
		||||
	if (getuid() == 0) {
 | 
			
		||||
		spdlog::error("The user is root. Stopping the program.");
 | 
			
		||||
		return EXIT_FAILURE;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	po::options_description description{ "Allowed options" };
 | 
			
		||||
	description.add_options()("help", "produce help message")("config", po::value<std::string>(), "path to the config file");
 | 
			
		||||
	po::variables_map vm;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue