Skip to content

Commit

Permalink
Merge pull request from GHSA-f489-557v-47jq
Browse files Browse the repository at this point in the history
[v0.9] Check auth_start_session() result
  • Loading branch information
metalefty committed Aug 24, 2023
2 parents 469a89c + 322d11b commit 8c5b7cd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
7 changes: 6 additions & 1 deletion sesman/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,12 @@ session_start_fork(tbus data, tui8 type, struct SCP_SESSION *s)
g_delete_wait_obj(g_sigchld_event);
g_delete_wait_obj(g_term_event);

auth_start_session(data, display);
if (auth_start_session(data, display) != 0)
{
// Errors are logged by the auth module, as they are
// specific to that module
g_exit(1);
}
sesman_close_all();
g_sprintf(geometry, "%dx%d", s->width, s->height);
g_sprintf(depth, "%d", s->bpp);
Expand Down
24 changes: 22 additions & 2 deletions sesman/verify_user_pam.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ auth_userpass(const char *user, const char *pass, int *errorcode)

/******************************************************************************/
/* returns error */
int
auth_start_session(long in_val, int in_display)
static int
auth_start_session_private(long in_val, int in_display)
{
struct t_auth_info *auth_info;
int error;
Expand Down Expand Up @@ -357,6 +357,26 @@ auth_start_session(long in_val, int in_display)
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(long in_val, int in_display)
{
int result = auth_start_session_private(in_val, in_display);
if (result != 0)
{
LOG(LOG_LEVEL_ERROR,
"Can't start PAM session. See PAM logging for more info");
}

return result;
}

/******************************************************************************/
/* returns error */
int
Expand Down

0 comments on commit 8c5b7cd

Please sign in to comment.