Skip to content

Commit

Permalink
access_login_allowed: Remove primary group check
Browse files Browse the repository at this point in the history
This check is now performed within g_check_user_in_group()
  • Loading branch information
matt335672 committed Oct 6, 2023
1 parent 8323e80 commit e6bc4db
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions sesman/access.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
int
access_login_allowed(const char *user)
{
int gid;
int ok;

if ((0 == g_strncmp(user, "root", 5)) && (0 == g_cfg->sec.allow_root))
Expand All @@ -51,18 +50,6 @@ access_login_allowed(const char *user)
return 1;
}

if (0 != g_getuser_info(user, &gid, 0, 0, 0, 0))
{
LOG(LOG_LEVEL_ERROR, "Cannot read user info! - login denied");
return 0;
}

if (g_cfg->sec.ts_users == gid)
{
LOG(LOG_LEVEL_DEBUG, "ts_users is user's primary group");
return 1;
}

if (0 != g_check_user_in_group(user, g_cfg->sec.ts_users, &ok))
{
LOG(LOG_LEVEL_ERROR, "Cannot read group info! - login denied");
Expand All @@ -83,7 +70,6 @@ access_login_allowed(const char *user)
int
access_login_mng_allowed(const char *user)
{
int gid;
int ok;

if ((0 == g_strncmp(user, "root", 5)) && (0 == g_cfg->sec.allow_root))
Expand All @@ -100,18 +86,6 @@ access_login_mng_allowed(const char *user)
return 1;
}

if (0 != g_getuser_info(user, &gid, 0, 0, 0, 0))
{
LOG(LOG_LEVEL_ERROR, "[MNG] Cannot read user info! - login denied");
return 0;
}

if (g_cfg->sec.ts_admins == gid)
{
LOG(LOG_LEVEL_INFO, "[MNG] ts_users is user's primary group");
return 1;
}

if (0 != g_check_user_in_group(user, g_cfg->sec.ts_admins, &ok))
{
LOG(LOG_LEVEL_ERROR, "[MNG] Cannot read group info! - login denied");
Expand Down

0 comments on commit e6bc4db

Please sign in to comment.