Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUACAMOLE-1555: Call openlog() after client plugin unload #377

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/guacd/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <syslog.h>

/**
* Parameters for the user thread.
Expand Down Expand Up @@ -353,6 +354,12 @@ static void guacd_exec_proc(guacd_proc* proc, const char* protocol) {
guacd_log(GUAC_LOG_DEBUG, "Requesting termination of client...");
result = guacd_timed_client_free(client, GUACD_CLIENT_FREE_TIMEOUT);

/* Reopen syslog now that client plugins have been unloaded. This fixes
guacd_log() segfaults in cases where the client plugins have called
openlog() causing syslog ident string to point to the plugin's
memory region. */
openlog(GUACD_LOG_NAME, LOG_PID, LOG_DAEMON);

/* If client was unable to be freed, warn and forcibly kill */
if (result) {
guacd_log(GUAC_LOG_WARNING, "Client did not terminate in a timely "
Expand Down