su: fix shell suspend in tcsh (#597928)
This commit is contained in:
parent
9938e5be66
commit
6ff9fce161
@ -106,7 +106,7 @@ index f8f5b61..811aad7 100644
|
|||||||
static struct option const longopts[] =
|
static struct option const longopts[] =
|
||||||
{
|
{
|
||||||
{"command", required_argument, NULL, 'c'},
|
{"command", required_argument, NULL, 'c'},
|
||||||
@@ -200,7 +224,164 @@ log_su (struct passwd const *pw, bool successful)
|
@@ -200,7 +224,174 @@ log_su (struct passwd const *pw, bool successful)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ index f8f5b61..811aad7 100644
|
|||||||
+create_watching_parent (void)
|
+create_watching_parent (void)
|
||||||
+{
|
+{
|
||||||
+ pid_t child;
|
+ pid_t child;
|
||||||
+ sigset_t ourset;
|
+ sigset_t ourset, blockset;
|
||||||
+ int status = 0;
|
+ int status = 0;
|
||||||
+
|
+
|
||||||
+ retval = pam_open_session (pamh, 0);
|
+ retval = pam_open_session (pamh, 0);
|
||||||
@ -230,7 +230,17 @@ index f8f5b61..811aad7 100644
|
|||||||
+
|
+
|
||||||
+ if (pid != (pid_t)-1 && WIFSTOPPED (status))
|
+ if (pid != (pid_t)-1 && WIFSTOPPED (status))
|
||||||
+ {
|
+ {
|
||||||
|
+ /* tcsh sends SIGTSTP to the process group, and so is already pending */
|
||||||
+ kill (getpid (), SIGSTOP);
|
+ kill (getpid (), SIGSTOP);
|
||||||
|
+ if (WSTOPSIG(status) != SIGSTOP) {
|
||||||
|
+ sigemptyset(&blockset);
|
||||||
|
+ if (sigaddset(&blockset, WSTOPSIG(status)) ||
|
||||||
|
+ sigprocmask(SIG_UNBLOCK, &blockset, &ourset) ||
|
||||||
|
+ sigprocmask(SIG_SETMASK, &ourset, NULL))
|
||||||
|
+ {
|
||||||
|
+ error (0, errno, _("cannot set signal handler"));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
+ /* once we get here, we must have resumed */
|
+ /* once we get here, we must have resumed */
|
||||||
+ kill (pid, SIGCONT);
|
+ kill (pid, SIGCONT);
|
||||||
+ }
|
+ }
|
||||||
@ -271,7 +281,7 @@ index f8f5b61..811aad7 100644
|
|||||||
Return true if the user gives the correct password for entry PW,
|
Return true if the user gives the correct password for entry PW,
|
||||||
false if not. Return true without asking for a password if run by UID 0
|
false if not. Return true without asking for a password if run by UID 0
|
||||||
or if PW has an empty password. */
|
or if PW has an empty password. */
|
||||||
@@ -208,10 +389,52 @@ log_su (struct passwd const *pw, bool successful)
|
@@ -208,10 +399,52 @@ log_su (struct passwd const *pw, bool successful)
|
||||||
static bool
|
static bool
|
||||||
correct_password (const struct passwd *pw)
|
correct_password (const struct passwd *pw)
|
||||||
{
|
{
|
||||||
@ -325,7 +335,7 @@ index f8f5b61..811aad7 100644
|
|||||||
|
|
||||||
endspent ();
|
endspent ();
|
||||||
if (sp)
|
if (sp)
|
||||||
@@ -232,6 +455,7 @@ correct_password (const struct passwd *pw)
|
@@ -232,6 +465,7 @@ correct_password (const struct passwd *pw)
|
||||||
encrypted = crypt (unencrypted, correct);
|
encrypted = crypt (unencrypted, correct);
|
||||||
memset (unencrypted, 0, strlen (unencrypted));
|
memset (unencrypted, 0, strlen (unencrypted));
|
||||||
return STREQ (encrypted, correct);
|
return STREQ (encrypted, correct);
|
||||||
@ -333,7 +343,7 @@ index f8f5b61..811aad7 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Update `environ' for the new shell based on PW, with SHELL being
|
/* Update `environ' for the new shell based on PW, with SHELL being
|
||||||
@@ -274,19 +498,41 @@ modify_environment (const struct passwd *pw, const char *shell)
|
@@ -274,19 +508,41 @@ modify_environment (const struct passwd *pw, const char *shell)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -377,7 +387,7 @@ index f8f5b61..811aad7 100644
|
|||||||
if (setgid (pw->pw_gid))
|
if (setgid (pw->pw_gid))
|
||||||
error (EXIT_CANCELED, errno, _("cannot set group id"));
|
error (EXIT_CANCELED, errno, _("cannot set group id"));
|
||||||
if (setuid (pw->pw_uid))
|
if (setuid (pw->pw_uid))
|
||||||
@@ -500,9 +746,21 @@ main (int argc, char **argv)
|
@@ -500,9 +756,21 @@ main (int argc, char **argv)
|
||||||
shell = NULL;
|
shell = NULL;
|
||||||
}
|
}
|
||||||
shell = xstrdup (shell ? shell : pw->pw_shell);
|
shell = xstrdup (shell ? shell : pw->pw_shell);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Summary: A set of basic GNU tools commonly used in shell scripts
|
Summary: A set of basic GNU tools commonly used in shell scripts
|
||||||
Name: coreutils
|
Name: coreutils
|
||||||
Version: 8.12
|
Version: 8.12
|
||||||
Release: 5%{?dist}
|
Release: 6%{?dist}
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
Url: http://www.gnu.org/software/coreutils/
|
Url: http://www.gnu.org/software/coreutils/
|
||||||
@ -335,6 +335,9 @@ fi
|
|||||||
%{_libdir}/coreutils
|
%{_libdir}/coreutils
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Aug 23 2011 Ondrej Vasik <ovasik@redhat.com> - 8.12-6
|
||||||
|
- su: fix shell suspend in tcsh (#597928)
|
||||||
|
|
||||||
* Thu Aug 18 2011 Ondrej Vasik <ovasik@redhat.com> - 8.12-5
|
* Thu Aug 18 2011 Ondrej Vasik <ovasik@redhat.com> - 8.12-5
|
||||||
- variable "u" should be static in uname processor type patch
|
- variable "u" should be static in uname processor type patch
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user