diff --git a/.gitignore b/.gitignore index 1d9cf6d..a5a0047 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/nuxwdog-1.0.1.tar.gz +SOURCES/nuxwdog-1.0.3.tar.gz diff --git a/.nuxwdog.metadata b/.nuxwdog.metadata index 06b08ae..00601e5 100644 --- a/.nuxwdog.metadata +++ b/.nuxwdog.metadata @@ -1 +1 @@ -bf480dd791a9a617441df7d9a2736908c9ad12d3 SOURCES/nuxwdog-1.0.1.tar.gz +6e9a0dc4687fb8f3c239a4970caa8042e25b6ea1 SOURCES/nuxwdog-1.0.3.tar.gz diff --git a/SOURCES/nuxwdog-1214838-null-term.patch b/SOURCES/nuxwdog-1214838-null-term.patch deleted file mode 100644 index ae6d5eb..0000000 --- a/SOURCES/nuxwdog-1214838-null-term.patch +++ /dev/null @@ -1,34 +0,0 @@ -Index: src/com/redhat/nuxwdog/watchdog.cpp -=================================================================== ---- src/com/redhat/nuxwdog/watchdog.cpp (revision 85) -+++ src/com/redhat/nuxwdog/watchdog.cpp (revision 87) -@@ -574,7 +574,7 @@ - // check error code?? - } // otherwise can fall through without prompting - } -- if ((pwd_result==NULL) || (strlen(pwd_result)==0) || (_watchdog_server_init_done==1)) { -+ if ((pwd_result==NULL) || (strlen(pwd_result)==0)) { - if (pwd_result != NULL) free(pwd_result); - pwd_result = (char *) malloc(strlen(NON_EMPTY_MESSAGE) + 1); - sprintf(pwd_result, "%s", NON_EMPTY_MESSAGE); -Index: src/com/redhat/nuxwdog/wdpwd.cpp -=================================================================== ---- src/com/redhat/nuxwdog/wdpwd.cpp (revision 85) -+++ src/com/redhat/nuxwdog/wdpwd.cpp (revision 87) -@@ -171,7 +171,7 @@ - return 0; - } - -- *pwdvalue = (char *) malloc(pwdp->pwdlen); -+ *pwdvalue = (char *) malloc(pwdp->pwdlen + 1); - keysize = keyctl_read(pwdp->pwdserial, (char *) *pwdvalue, - pwdp->pwdlen); - -@@ -185,6 +185,7 @@ - "expect [%ld] got [%ld].\n", pwdp->pwdlen, keysize); - return 0; - } -+ (*pwdvalue)[keysize] = '\0'; - return 1; - } - } diff --git a/SOURCES/nuxwdog-1214838-systemd.patch b/SOURCES/nuxwdog-1214838-systemd.patch deleted file mode 100644 index 029915f..0000000 --- a/SOURCES/nuxwdog-1214838-systemd.patch +++ /dev/null @@ -1,210 +0,0 @@ -Index: src/com/redhat/nuxwdog/wdsignals.h -=================================================================== ---- src/com/redhat/nuxwdog/wdsignals.h (revision 87) -+++ src/com/redhat/nuxwdog/wdsignals.h (revision 89) -@@ -32,5 +32,6 @@ - void watchdog_create_signal_handlers(void); - void watchdog_delete_signal_handlers(void); - void watchdog_wait_signal(void); -+void disable_sigchld_for_one_signal(void); - - #endif /* _WDSIGNAL_H_ */ -Index: src/com/redhat/nuxwdog/watchdog.cpp -=================================================================== ---- src/com/redhat/nuxwdog/watchdog.cpp (revision 87) -+++ src/com/redhat/nuxwdog/watchdog.cpp (revision 89) -@@ -570,7 +570,9 @@ - watchdog_error(errstr); - // _watchdog_death = 1; ??? - } -- rv = watchdog_pwd_save(prompt, serial, pwd_result); -+ if (pwd_result != NULL) { -+ rv = watchdog_pwd_save(prompt, serial, pwd_result); -+ } - // check error code?? - } // otherwise can fall through without prompting - } -Index: src/com/redhat/nuxwdog/wdpwd.cpp -=================================================================== ---- src/com/redhat/nuxwdog/wdpwd.cpp (revision 87) -+++ src/com/redhat/nuxwdog/wdpwd.cpp (revision 89) -@@ -20,7 +20,9 @@ - - #include - #include -+#include - #include -+#include - #include - #include - #include -@@ -27,6 +29,7 @@ - #include - #include "config.h" - #include "wdlog.h" -+#include "wdsignals.h" - - #ifdef USE_KEYRING - #include -@@ -40,10 +43,10 @@ - static void echoOff(int fd) - { - if (isatty(fd)) { -- struct termios tio; -- tcgetattr(fd, &tio); -- tio.c_lflag &= ~ECHO; -- tcsetattr(fd, TCSAFLUSH, &tio); -+ struct termios tio; -+ tcgetattr(fd, &tio); -+ tio.c_lflag &= ~ECHO; -+ tcsetattr(fd, TCSAFLUSH, &tio); - } - } - -@@ -50,10 +53,10 @@ - static void echoOn(int fd) - { - if (isatty(fd)) { -- struct termios tio; -- tcgetattr(fd, &tio); -- tio.c_lflag |= ECHO; -- tcsetattr(fd, TCSAFLUSH, &tio); -+ struct termios tio; -+ tcgetattr(fd, &tio); -+ tio.c_lflag |= ECHO; -+ tcsetattr(fd, TCSAFLUSH, &tio); - } - } - -@@ -120,7 +123,7 @@ - watchdog_pwd_decrypt(pwdenc_t *pwdcrypt) - { - if (!pwdcrypt->ptr) { -- return NULL; -+ return NULL; - } - { - char *buf; -@@ -331,6 +334,52 @@ - } - #endif - -+/* -+ * is systemd running -+ */ -+bool -+check_systemd_running () -+{ -+ struct stat a, b; -+ -+ /* We simply test whether the systemd cgroup hierarchy is -+ * mounted */ -+ -+ return (lstat("/sys/fs/cgroup", &a) == 0) -+ && (lstat("/sys/fs/cgroup/systemd", &b) == 0) -+ && (a.st_dev != b.st_dev); -+ -+} -+ -+static bool -+watchdog_get_passwd_systemd(const char *prompt, char *input, const int capacity) -+{ -+ char *cmd, *ret; -+ FILE *ask_pass_fp = NULL; -+ bool retval = false; -+ -+ /* temporarily disable SIGCHLD handler */ -+ disable_sigchld_for_one_signal(); -+ -+ cmd = ret = NULL; -+ if (asprintf(&cmd, "systemd-ask-password \"%s\"", prompt) >= 0) { -+ ask_pass_fp = popen (cmd, "re"); -+ free (cmd); -+ } -+ -+ if (ask_pass_fp) { -+ ret = fgets(input, capacity, ask_pass_fp); -+ pclose(ask_pass_fp); -+ } -+ -+ if (ret) { -+ int len = strlen(input); -+ if (input[len - 1] == '\n') input[len - 1] = '\0'; -+ return true; -+ } -+ return false; -+} -+ - int - watchdog_pwd_prompt(const char *prompt, int serial, char **pwdvalue) - { -@@ -340,6 +389,25 @@ - int isTTY = isatty(infd); - int plen; - -+ char *started_by_systemd = getenv("STARTED_BY_SYSTEMD"); -+ -+ if (started_by_systemd) { -+ if (!check_systemd_running()) { -+ fprintf(stderr, -+ "STARTED_BY_SYSTEMD set indicating that nuxwdog has been started by systemd, but " -+ "systemd is not running."); -+ return -1; -+ } -+ -+ char pvalue[256]; -+ pvalue[0] = '\0'; -+ if (watchdog_get_passwd_systemd(prompt, pvalue, 256)) { -+ *pwdvalue = strdup(pvalue); -+ return 0; -+ } -+ return -1; -+ } -+ - /* Turn off buffering to avoid leaving password in I/O buffer */ - setbuf(stdin, NULL); - -@@ -400,4 +468,3 @@ - - return 0; - } -- -Index: src/com/redhat/nuxwdog/wdsignals.cpp -=================================================================== ---- src/com/redhat/nuxwdog/wdsignals.cpp (revision 87) -+++ src/com/redhat/nuxwdog/wdsignals.cpp (revision 89) -@@ -37,6 +37,8 @@ - - static int watchdog_pending_signal = 0; - -+static struct sigaction prev_sigchld_handler; -+ - static void - sig_term(int sig) - { -@@ -217,3 +219,25 @@ - sigsuspend(&holdset); - } - } -+ -+static void -+temp_sig_chld(int sig) -+{ -+ sigaction(SIGCHLD, &prev_sigchld_handler, NULL); -+} -+ -+void -+disable_sigchld_for_one_signal() -+{ -+ struct sigaction sa; -+ sa.sa_handler = temp_sig_chld; -+ sigemptyset(&sa.sa_mask); -+ sigaddset(&sa.sa_mask, SIGCHLD); -+#ifdef SA_NOCLDSTOP -+ sa.sa_flags = SA_NOCLDSTOP; -+#else -+ sa.sa_flags = 0; -+#endif /* SA_NOCLDSTOP */ -+ sigaction(SIGCHLD, &sa, &prev_sigchld_handler); -+} -+ diff --git a/SPECS/nuxwdog.spec b/SPECS/nuxwdog.spec index a94edb9..90f94bc 100644 --- a/SPECS/nuxwdog.spec +++ b/SPECS/nuxwdog.spec @@ -1,6 +1,6 @@ Name: nuxwdog -Version: 1.0.1 -Release: 11%{?dist} +Version: 1.0.3 +Release: 2%{?dist} Summary: Watchdog server to start and stop processes, and prompt for passwords # The entire source code is LGPLv2 except for the perl module, which is GPL+ or Artistic License: LGPLv2 and (GPL+ or Artistic) @@ -24,17 +24,11 @@ Obsoletes: nuxwdog-client Obsoletes: nuxwdog-client-perl Source0: https://fedorahosted.org/released/nuxwdog/%{name}-%{version}.tar.gz -Patch0: nuxwdog-1214838-null-term.patch -Patch1: nuxwdog-1214838-systemd.patch # Note: there is an rpmlint warning about Nuxwdogclient.so being a private-shared-object-provide # This would ordinarily be fixed by calling the macro perl_default_filter, but # this disables rpms file coloring and makes the package fail multilib tests. -%if 0%{?rhel} -ExcludeArch: ppc ppc64 s390 s390x -%endif - %description The nuxwdog package supplies the nuxwdog watchdog daemon, used to start,stop, prompt for passwords and monitor processes. @@ -67,8 +61,6 @@ server. %prep %setup -q -n %{name}-%{version} -%patch0 -p0 -%patch1 -p0 %build ant \ @@ -136,8 +128,15 @@ rm -rf %{buildroot} %{_jnidir}/* %changelog -* Mon May 11 2015 Ade Lee 1.0.1-11 -- Resolves: rhbz#1214838 - Fixes for null termination, systemd support +* Wed Jun 17 2015 Ade Lee 1.0.3-2 +- Resolves: rhbz#1229817 - Re-enable builds for ppc64/ppc64le/s390x + +* Sun May 10 2015 Ade Lee 1.0.3-1 +- Add systemd support + +* Wed Apr 22 2015 Ade Lee 1.0.2-1 +- Allow passwords to be retrieved post-init phase +- Fix null termination issue on returned stored passwords * Tue Sep 30 2014 Ade Lee - 1.0.1-10 - Resolves: rhbz#1117072 - ppc64le is missing from ExcludeArch @@ -184,7 +183,7 @@ rm -rf %{buildroot} - Remove old encryption scheme - Store passwords in kernel keyring -* Wed Dec 16 2010 Ade Lee 1.0.0-13 +* Thu Dec 16 2010 Ade Lee 1.0.0-13 - Resolves: #643546 - [RFE] Add nuxwdog to RHEL. * Wed Dec 15 2010 Ade Lee 1.0.0-12