Skip to content

Commit

Permalink
Merge pull request from GHSA-f489-557v-47jq
Browse files Browse the repository at this point in the history
Check auth_start_session() result
  • Loading branch information
metalefty authored Aug 24, 2023
2 parents 4b1482b + 25a1fab commit a111a0f
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
24 changes: 22 additions & 2 deletions sesman/libsesman/verify_user_pam.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,8 @@ auth_uds(const char *user, enum scp_login_status *errorcode)
/******************************************************************************/

/* returns error */
int
auth_start_session(struct auth_info *auth_info, int display_num)
static int
auth_start_session_private(struct auth_info *auth_info, int display_num)
{
int error;
char display[256];
Expand Down Expand Up @@ -436,6 +436,26 @@ auth_start_session(struct auth_info *auth_info, int display_num)
return 0;
}

/******************************************************************************/
/**
* Main routine to start a session
*
* Calls the private routine and logs an additional error if the private
* routine fails
*/
int
auth_start_session(struct auth_info *auth_info, int display_num)
{
int result = auth_start_session_private(auth_info, display_num);
if (result != 0)
{
LOG(LOG_LEVEL_ERROR,
"Can't start PAM session. See PAM logging for more info");
}

return result;
}

/******************************************************************************/
/* returns error */
static int
Expand Down
24 changes: 22 additions & 2 deletions sesman/libsesman/verify_user_pam_userpass.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ auth_uds(const char *user, enum scp_login_status *errorcode)
/******************************************************************************/

/* returns error */
int
auth_start_session(struct auth_info *auth_info, int display_num)
static int
auth_start_session_private(struct auth_info *auth_info, int display_num)
{
int error;
char display[256];
Expand Down Expand Up @@ -246,6 +246,26 @@ auth_start_session(struct auth_info *auth_info, int display_num)
return 0;
}

/******************************************************************************/
/**
* Main routine to start a session
*
* Calls the private routine and logs an additional error if the private
* routine fails
*/
int
auth_start_session(struct auth_info *auth_info, int display_num)
{
int result = auth_start_session_private(auth_info, display_num);
if (result != 0)
{
LOG(LOG_LEVEL_ERROR,
"Can't start PAM session. See PAM logging for more info");
}

return result;
}

/******************************************************************************/
/* returns error */
static int
Expand Down
7 changes: 6 additions & 1 deletion sesman/sesexec/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,12 @@ session_start_wrapped(struct login_info *login_info,
int window_manager_pid;
enum scp_screate_status status = E_SCP_SCREATE_GENERAL_ERROR;

auth_start_session(login_info->auth_info, s->display);
if (auth_start_session(login_info->auth_info, s->display) != 0)
{
// Errors are logged by the auth module, as they are
// specific to that module
return E_SCP_SCREATE_GENERAL_ERROR;
}
#ifdef USE_BSD_SETLOGIN
/**
* Create a new session and process group since the 4.4BSD
Expand Down

0 comments on commit a111a0f

Please sign in to comment.