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>2017-10-04 13:54:48 +0100
commit4b276122c04aed0726803a92c8ca955e614a4d3a (patch)
tree5c5638fad9f6edf9ada6a4661f6c5cbb1bec2696 /session.c
parentcdd9076a145a95c21538eedb3f728a897480c5de (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: 2017-10-04 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 4bccb62d1..d40afe4f7 100644
--- a/session.c
+++ b/session.c
@@ -1312,7 +1312,7 @@ safely_chroot(const char *path, uid_t uid)
1312 1312
1313/* Set login name, uid, gid, and groups. */ 1313/* Set login name, uid, gid, and groups. */
1314void 1314void
1315do_setusercontext(struct passwd *pw) 1315do_setusercontext(struct passwd *pw, const char *role)
1316{ 1316{
1317 char *chroot_path, *tmp; 1317 char *chroot_path, *tmp;
1318 1318
@@ -1340,7 +1340,7 @@ do_setusercontext(struct passwd *pw)
1340 endgrent(); 1340 endgrent();
1341#endif 1341#endif
1342 1342
1343 platform_setusercontext_post_groups(pw); 1343 platform_setusercontext_post_groups(pw, role);
1344 1344
1345 if (!in_chroot && options.chroot_directory != NULL && 1345 if (!in_chroot && options.chroot_directory != NULL &&
1346 strcasecmp(options.chroot_directory, "none") != 0) { 1346 strcasecmp(options.chroot_directory, "none") != 0) {
@@ -1477,7 +1477,7 @@ do_child(struct ssh *ssh, Session *s, const char *command)
1477 1477
1478 /* Force a password change */ 1478 /* Force a password change */
1479 if (s->authctxt->force_pwchange) { 1479 if (s->authctxt->force_pwchange) {
1480 do_setusercontext(pw); 1480 do_setusercontext(pw, s->authctxt->role);
1481 child_close_fds(ssh); 1481 child_close_fds(ssh);
1482 do_pwchange(s); 1482 do_pwchange(s);
1483 exit(1); 1483 exit(1);
@@ -1499,7 +1499,7 @@ do_child(struct ssh *ssh, Session *s, const char *command)
1499 /* When PAM is enabled we rely on it to do the nologin check */ 1499 /* When PAM is enabled we rely on it to do the nologin check */
1500 if (!options.use_pam) 1500 if (!options.use_pam)
1501 do_nologin(pw); 1501 do_nologin(pw);
1502 do_setusercontext(pw); 1502 do_setusercontext(pw, s->authctxt->role);
1503 /* 1503 /*
1504 * PAM session modules in do_setusercontext may have 1504 * PAM session modules in do_setusercontext may have
1505 * generated messages, so if this in an interactive 1505 * generated messages, so if this in an interactive
@@ -1891,7 +1891,7 @@ session_pty_req(struct ssh *ssh, Session *s)
1891 tty_parse_modes(s->ttyfd, &n_bytes); 1891 tty_parse_modes(s->ttyfd, &n_bytes);
1892 1892
1893 if (!use_privsep) 1893 if (!use_privsep)
1894 pty_setowner(s->pw, s->tty); 1894 pty_setowner(s->pw, s->tty, s->authctxt->role);
1895 1895
1896 /* Set window size from the packet. */ 1896 /* Set window size from the packet. */
1897 pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel); 1897 pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel);