summaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
authorManoj Srivastava <srivasta@debian.org>2014-02-09 16:09:49 +0000
committerColin Watson <cjwatson@debian.org>2014-10-07 14:26:47 +0100
commitc9638aa44d787849cea1ae273f0908c6313fd19b (patch)
tree6b8681822821aad0dcc92575411f0e6fdfb994bf /session.c
parentb25d6dd3b6b5a2cb93723586c56d6fa0277ea56a (diff)
Handle SELinux authorisation roles
Rejected upstream due to discomfort with magic usernames; a better approach will need an SSH protocol change. In the meantime, this came from Debian's SELinux maintainer, so we'll keep it until we have something better. Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1641 Bug-Debian: http://bugs.debian.org/394795 Last-Update: 2013-09-14 Patch-Name: selinux-role.patch
Diffstat (limited to 'session.c')
-rw-r--r--session.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/session.c b/session.c
index 3e96557b8..6f389ac66 100644
--- a/session.c
+++ b/session.c
@@ -1486,7 +1486,7 @@ safely_chroot(const char *path, uid_t uid)
1486 1486
1487/* Set login name, uid, gid, and groups. */ 1487/* Set login name, uid, gid, and groups. */
1488void 1488void
1489do_setusercontext(struct passwd *pw) 1489do_setusercontext(struct passwd *pw, const char *role)
1490{ 1490{
1491 char *chroot_path, *tmp; 1491 char *chroot_path, *tmp;
1492#ifdef USE_LIBIAF 1492#ifdef USE_LIBIAF
@@ -1517,7 +1517,7 @@ do_setusercontext(struct passwd *pw)
1517 endgrent(); 1517 endgrent();
1518#endif 1518#endif
1519 1519
1520 platform_setusercontext_post_groups(pw); 1520 platform_setusercontext_post_groups(pw, role);
1521 1521
1522 if (options.chroot_directory != NULL && 1522 if (options.chroot_directory != NULL &&
1523 strcasecmp(options.chroot_directory, "none") != 0) { 1523 strcasecmp(options.chroot_directory, "none") != 0) {
@@ -1676,7 +1676,7 @@ do_child(Session *s, const char *command)
1676 1676
1677 /* Force a password change */ 1677 /* Force a password change */
1678 if (s->authctxt->force_pwchange) { 1678 if (s->authctxt->force_pwchange) {
1679 do_setusercontext(pw); 1679 do_setusercontext(pw, s->authctxt->role);
1680 child_close_fds(); 1680 child_close_fds();
1681 do_pwchange(s); 1681 do_pwchange(s);
1682 exit(1); 1682 exit(1);
@@ -1703,7 +1703,7 @@ do_child(Session *s, const char *command)
1703 /* When PAM is enabled we rely on it to do the nologin check */ 1703 /* When PAM is enabled we rely on it to do the nologin check */
1704 if (!options.use_pam) 1704 if (!options.use_pam)
1705 do_nologin(pw); 1705 do_nologin(pw);
1706 do_setusercontext(pw); 1706 do_setusercontext(pw, s->authctxt->role);
1707 /* 1707 /*
1708 * PAM session modules in do_setusercontext may have 1708 * PAM session modules in do_setusercontext may have
1709 * generated messages, so if this in an interactive 1709 * generated messages, so if this in an interactive
@@ -2114,7 +2114,7 @@ session_pty_req(Session *s)
2114 tty_parse_modes(s->ttyfd, &n_bytes); 2114 tty_parse_modes(s->ttyfd, &n_bytes);
2115 2115
2116 if (!use_privsep) 2116 if (!use_privsep)
2117 pty_setowner(s->pw, s->tty); 2117 pty_setowner(s->pw, s->tty, s->authctxt->role);
2118 2118
2119 /* Set window size from the packet. */ 2119 /* Set window size from the packet. */
2120 pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel); 2120 pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel);