vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Petr Lautrbach 581bf3
diff -up openssh-6.1p1/session.c.privsep-selinux openssh-6.1p1/session.c
Petr Lautrbach 581bf3
--- openssh-6.1p1/session.c.privsep-selinux	2012-09-15 13:45:26.079476022 +0200
Petr Lautrbach 581bf3
+++ openssh-6.1p1/session.c	2012-09-15 13:45:28.460522390 +0200
Petr Lautrbach 581bf3
@@ -1513,6 +1513,7 @@ do_setusercontext(struct passwd *pw)
Petr Lautrbach 581bf3
 
Petr Lautrbach 581bf3
 		platform_setusercontext_post_groups(pw);
Petr Lautrbach 581bf3
 
Petr Lautrbach 581bf3
+
Petr Lautrbach 581bf3
 		if (options.chroot_directory != NULL &&
Petr Lautrbach 581bf3
 		    strcasecmp(options.chroot_directory, "none") != 0) {
Petr Lautrbach 581bf3
                         tmp = tilde_expand_filename(options.chroot_directory,
Petr Lautrbach 581bf3
@@ -1536,6 +1537,10 @@ do_setusercontext(struct passwd *pw)
Petr Lautrbach 0c438f
 		/* Permanently switch to the desired uid. */
Petr Lautrbach 0c438f
 		permanently_set_uid(pw);
Petr Lautrbach cd5891
 #endif
Petr Lautrbach 0c438f
+
Petr Lautrbach 0c438f
+#ifdef WITH_SELINUX
Petr Lautrbach 581bf3
+		ssh_selinux_copy_context();
Petr Lautrbach 0c438f
+#endif
Petr Lautrbach cd5891
 	}
Petr Lautrbach cd5891
 
Petr Lautrbach 0c438f
 	if (getuid() != pw->pw_uid || geteuid() != pw->pw_uid)
Petr Lautrbach 581bf3
diff -up openssh-6.1p1/sshd.c.privsep-selinux openssh-6.1p1/sshd.c
Petr Lautrbach 581bf3
--- openssh-6.1p1/sshd.c.privsep-selinux	2012-09-15 13:45:26.062475676 +0200
Petr Lautrbach 581bf3
+++ openssh-6.1p1/sshd.c	2012-09-15 13:45:28.467522539 +0200
Petr Lautrbach 581bf3
@@ -794,6 +794,13 @@ privsep_postauth(Authctxt *authctxt)
Petr Lautrbach 0c438f
 	do_setusercontext(authctxt->pw);
Petr Lautrbach 0c438f
 
Petr Lautrbach 0c438f
  skip:
Petr Lautrbach cd5891
+#ifdef WITH_SELINUX
Petr Lautrbach 0c438f
+	/* switch SELinux content for root too */
Petr Lautrbach 581bf3
+	if (authctxt->pw->pw_uid == 0) {
Petr Lautrbach cd5891
+		ssh_selinux_copy_context();
Petr Lautrbach cd5891
+	}
Petr Lautrbach cd5891
+#endif
Petr Lautrbach cd5891
+
Petr Lautrbach 0c438f
 	/* It is safe now to apply the key state */
Petr Lautrbach 0c438f
 	monitor_apply_keystate(pmonitor);
Petr Lautrbach 0c438f