From 63c2e185c39009e791bdfb33e233d78882a76a0b Mon Sep 17 00:00:00 2001 From: matt335672 <30179339+matt335672@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:42:11 +0000 Subject: [PATCH] Fix missing displays on sesman restart --- libipm/ercp.c | 5 +---- libipm/ercp.h | 1 - sesman/ercp_process.c | 17 ++++++++++++++++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/libipm/ercp.c b/libipm/ercp.c index e048f5fb8f..0085838789 100644 --- a/libipm/ercp.c +++ b/libipm/ercp.c @@ -208,10 +208,7 @@ ercp_get_session_announce_event(struct trans *trans, if (rv == 0) { - if (display != NULL) - { - *display = i_display; - } + *display = i_display; *uid = (uid_t)i_uid; *type = (enum scp_session_type)i_type; *start_width = i_width; diff --git a/libipm/ercp.h b/libipm/ercp.h index c77bf984f1..0f608fd32e 100644 --- a/libipm/ercp.h +++ b/libipm/ercp.h @@ -188,7 +188,6 @@ ercp_send_session_announce_event(struct trans *trans, * * @param trans EICP transport * @param[out] display Display used by session. - * Pointer can be NULL if this is already known. * @param[out] uid UID of user logged in to session * @param[out] type Session type * @param[out] start_width Starting width of seenio diff --git a/sesman/ercp_process.c b/sesman/ercp_process.c index 4ac95990e4..8569b23b75 100644 --- a/sesman/ercp_process.c +++ b/sesman/ercp_process.c @@ -42,9 +42,10 @@ process_session_announce_event(struct session_item *si) { int rv; const char *start_ip_addr; + unsigned int display; rv = ercp_get_session_announce_event(si->sesexec_trans, - NULL, + &display, &si->uid, &si->type, &si->start_width, @@ -53,10 +54,24 @@ process_session_announce_event(struct session_item *si) &si->guid, &start_ip_addr, &si->start_time); + if (rv == 0) + { + // We may already know the display we sent sesexec. If we do, + // check sesexec sent the same value back. + if (si->display >= 0 && display != (unsigned int)si->display) + { + LOG(LOG_LEVEL_ERROR, "Bugcheck: sesman expected display %d, got %u", + si->display, display); + rv = 1; + } + } + if (rv == 0) { snprintf(si->start_ip_addr, sizeof(si->start_ip_addr), "%s", start_ip_addr); + si->display = display; + si->state = E_SESSION_RUNNING; }