Security about the user

This commit is contained in:
Pcornat 2021-03-21 22:09:23 +01:00
parent a0a74729fc
commit ef0adeb721
No known key found for this signature in database
GPG Key ID: 873C3ACCF970C74E
1 changed files with 6 additions and 0 deletions

View File

@ -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;