Skip to content

Commit

Permalink
Add check if username is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
Tessa Todorowski committed May 28, 2024
1 parent 28f1c45 commit 8b26aa5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/monitor/process_monitor_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ namespace monitor
static void drop_privileges()
{
auto orig_user = getpwnam(config().user.c_str());
if (orig_user == nullptr)
{
Log::error() << "No user found with specified username.";
throw_errno();
}

gid_t original_uid = orig_user->pw_uid;
uid_t original_gid = orig_user->pw_gid;

Expand Down

0 comments on commit 8b26aa5

Please sign in to comment.