openssh/openssh-5.8p1-pwchange.patch

32 lines
841 B
Diff
Raw Normal View History

2011-03-31 19:48:35 +00:00
diff -up openssh-5.8p1/session.c.pwchange openssh-5.8p1/session.c
2011-04-20 19:59:24 +00:00
--- openssh-5.8p1/session.c.pwchange 2011-04-20 10:46:50.144658782 +0200
+++ openssh-5.8p1/session.c 2011-04-20 11:36:09.055648048 +0200
@@ -1542,11 +1542,27 @@ do_setusercontext(struct passwd *pw)
static void
do_pwchange(Session *s)
{
+#ifdef WITH_SELINUX
+ pid_t pid;
+#endif
+
fflush(NULL);
fprintf(stderr, "WARNING: Your password has expired.\n");
2011-03-31 19:48:35 +00:00
if (s->ttyfd != -1) {
fprintf(stderr,
"You must change your password now and login again!\n");
2011-04-20 19:59:24 +00:00
+#ifdef WITH_SELINUX
+ switch (pid = fork()) {
+ case -1:
+ fatal("cannot fork");
+ case 0:
+ setexeccon(NULL);
+ break;
+ default:
+ waitpid(pid, NULL, 0);
+ exit(0);
+ }
+#endif
2011-03-31 19:48:35 +00:00
#ifdef PASSWD_NEEDS_USERNAME
execl(_PATH_PASSWD_PROG, "passwd", s->pw->pw_name,
(char *)NULL);