diff --git a/polkit.spec b/polkit.spec index 83ec45b..ca8ba0b 100644 --- a/polkit.spec +++ b/polkit.spec @@ -6,7 +6,7 @@ Summary: An authorization framework Name: polkit Version: 0.115 -Release: 10%{?dist} +Release: 10%{?dist}.1 License: LGPLv2+ URL: http://www.freedesktop.org/wiki/Software/polkit Source0: http://www.freedesktop.org/software/polkit/releases/%{name}-%{version}.tar.gz @@ -21,6 +21,7 @@ Patch6: 0001-backend-Compare-PolkitUnixProcess-uids-for-temporary.patch Patch7: Allow-uid-of-1-for-a-PolkitUnixProcess.patch # https://gitlab.freedesktop.org/polkit/polkit/merge_requests/4 Patch8: polkit-mozjs60.patch +Patch9: tty-echo-disabled-on-sigint.patch BuildRequires: gcc-c++ BuildRequires: glib2-devel >= 2.30.0 @@ -184,6 +185,9 @@ exit 0 %{_libdir}/girepository-1.0/*.typelib %changelog +* Thu Feb 14 2019 Jan Rybar - 0.115-10.1 +- pkttyagent: PolkitAgentTextListener leaves echo tty disabled if SIGINT/SIGTERM + * Fri Feb 08 2019 Pete Walter - 0.115-10 - Move to mozjs60 diff --git a/tty-echo-disabled-on-sigint.patch b/tty-echo-disabled-on-sigint.patch new file mode 100644 index 0000000..9c5eca9 --- /dev/null +++ b/tty-echo-disabled-on-sigint.patch @@ -0,0 +1,86 @@ +diff --git a/src/programs/pkttyagent.c b/src/programs/pkttyagent.c +index 3f324b8..3c8d502 100644 +--- a/src/programs/pkttyagent.c ++++ b/src/programs/pkttyagent.c +@@ -25,11 +25,44 @@ + + #include + #include ++#include ++#include + #include + #include + #define POLKIT_AGENT_I_KNOW_API_IS_SUBJECT_TO_CHANGE + #include + ++ ++static volatile sig_atomic_t tty_flags_saved; ++struct termios ts; ++FILE *tty = NULL; ++struct sigaction savesigterm, savesigint, savesigtstp; ++ ++ ++static void tty_handler(int signal) ++{ ++ switch (signal) ++ { ++ case SIGTERM: ++ sigaction (SIGTERM, &savesigterm, NULL); ++ break; ++ case SIGINT: ++ sigaction (SIGINT, &savesigint, NULL); ++ break; ++ case SIGTSTP: ++ sigaction (SIGTSTP, &savesigtstp, NULL); ++ break; ++ } ++ ++ if (tty_flags_saved) ++ { ++ tcsetattr (fileno (tty), TCSAFLUSH, &ts); ++ } ++ ++ kill(getpid(), signal); ++} ++ ++ + int + main (int argc, char *argv[]) + { +@@ -74,6 +107,8 @@ main (int argc, char *argv[]) + GMainLoop *loop = NULL; + guint ret = 126; + GVariantBuilder builder; ++ struct sigaction sa; ++ const char *tty_name = NULL; + + /* Disable remote file access from GIO. */ + setenv ("GIO_USE_VFS", "local", 1); +@@ -212,6 +247,27 @@ main (int argc, char *argv[]) + } + } + ++/* Bash leaves tty echo disabled if SIGINT/SIGTERM comes to polkitagenttextlistener.c::on_request(), ++ but due to threading the handlers cannot take care of the signal there. ++ Though if controlling terminal cannot be found, the world won't stop spinning. ++*/ ++ tty_name = ctermid(NULL); ++ if (tty_name != NULL) ++ { ++ tty = fopen(tty_name, "r+"); ++ } ++ ++ if (tty != NULL && !tcgetattr (fileno (tty), &ts)) ++ { ++ tty_flags_saved = TRUE; ++ } ++ ++ memset (&sa, 0, sizeof (sa)); ++ sa.sa_handler = &tty_handler; ++ sigaction (SIGTERM, &sa, &savesigterm); ++ sigaction (SIGINT, &sa, &savesigint); ++ sigaction (SIGTSTP, &sa, &savesigtstp); ++ + loop = g_main_loop_new (NULL, FALSE); + g_main_loop_run (loop); +