summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--auth.h1
-rw-r--r--auth2.c10
-rw-r--r--monitor.c32
-rw-r--r--monitor.h2
-rw-r--r--monitor_wrap.c22
-rw-r--r--monitor_wrap.h3
-rw-r--r--openbsd-compat/port-linux.c27
-rw-r--r--openbsd-compat/port-linux.h4
-rw-r--r--platform.c4
-rw-r--r--platform.h2
-rw-r--r--session.c10
-rw-r--r--session.h2
-rw-r--r--sshd.c2
-rw-r--r--sshpty.c4
-rw-r--r--sshpty.h2
15 files changed, 97 insertions, 30 deletions
diff --git a/auth.h b/auth.h
index 338a62da7..8c658d16e 100644
--- a/auth.h
+++ b/auth.h
@@ -62,6 +62,7 @@ struct Authctxt {
62 char *service; 62 char *service;
63 struct passwd *pw; /* set if 'valid' */ 63 struct passwd *pw; /* set if 'valid' */
64 char *style; 64 char *style;
65 char *role;
65 void *kbdintctxt; 66 void *kbdintctxt;
66 char *info; /* Extra info for next auth_log */ 67 char *info; /* Extra info for next auth_log */
67#ifdef BSD_AUTH 68#ifdef BSD_AUTH
diff --git a/auth2.c b/auth2.c
index 946e92355..2f51be232 100644
--- a/auth2.c
+++ b/auth2.c
@@ -217,7 +217,7 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt)
217 struct ssh *ssh = active_state; /* XXX */ 217 struct ssh *ssh = active_state; /* XXX */
218 Authctxt *authctxt = ctxt; 218 Authctxt *authctxt = ctxt;
219 Authmethod *m = NULL; 219 Authmethod *m = NULL;
220 char *user, *service, *method, *style = NULL; 220 char *user, *service, *method, *style = NULL, *role = NULL;
221 int authenticated = 0; 221 int authenticated = 0;
222 222
223 if (authctxt == NULL) 223 if (authctxt == NULL)
@@ -229,8 +229,13 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt)
229 debug("userauth-request for user %s service %s method %s", user, service, method); 229 debug("userauth-request for user %s service %s method %s", user, service, method);
230 debug("attempt %d failures %d", authctxt->attempt, authctxt->failures); 230 debug("attempt %d failures %d", authctxt->attempt, authctxt->failures);
231 231
232 if ((role = strchr(user, '/')) != NULL)
233 *role++ = 0;
234
232 if ((style = strchr(user, ':')) != NULL) 235 if ((style = strchr(user, ':')) != NULL)
233 *style++ = 0; 236 *style++ = 0;
237 else if (role && (style = strchr(role, ':')) != NULL)
238 *style++ = '\0';
234 239
235 if (authctxt->attempt++ == 0) { 240 if (authctxt->attempt++ == 0) {
236 /* setup auth context */ 241 /* setup auth context */
@@ -257,8 +262,9 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt)
257 use_privsep ? " [net]" : ""); 262 use_privsep ? " [net]" : "");
258 authctxt->service = xstrdup(service); 263 authctxt->service = xstrdup(service);
259 authctxt->style = style ? xstrdup(style) : NULL; 264 authctxt->style = style ? xstrdup(style) : NULL;
265 authctxt->role = role ? xstrdup(role) : NULL;
260 if (use_privsep) 266 if (use_privsep)
261 mm_inform_authserv(service, style); 267 mm_inform_authserv(service, style, role);
262 userauth_banner(); 268 userauth_banner();
263 if (auth2_setup_methods_lists(authctxt) != 0) 269 if (auth2_setup_methods_lists(authctxt) != 0)
264 packet_disconnect("no authentication methods enabled"); 270 packet_disconnect("no authentication methods enabled");
diff --git a/monitor.c b/monitor.c
index 506645c7c..7452e20e2 100644
--- a/monitor.c
+++ b/monitor.c
@@ -127,6 +127,7 @@ int mm_answer_sign(int, Buffer *);
127int mm_answer_pwnamallow(int, Buffer *); 127int mm_answer_pwnamallow(int, Buffer *);
128int mm_answer_auth2_read_banner(int, Buffer *); 128int mm_answer_auth2_read_banner(int, Buffer *);
129int mm_answer_authserv(int, Buffer *); 129int mm_answer_authserv(int, Buffer *);
130int mm_answer_authrole(int, Buffer *);
130int mm_answer_authpassword(int, Buffer *); 131int mm_answer_authpassword(int, Buffer *);
131int mm_answer_bsdauthquery(int, Buffer *); 132int mm_answer_bsdauthquery(int, Buffer *);
132int mm_answer_bsdauthrespond(int, Buffer *); 133int mm_answer_bsdauthrespond(int, Buffer *);
@@ -204,6 +205,7 @@ struct mon_table mon_dispatch_proto20[] = {
204 {MONITOR_REQ_SIGN, MON_ONCE, mm_answer_sign}, 205 {MONITOR_REQ_SIGN, MON_ONCE, mm_answer_sign},
205 {MONITOR_REQ_PWNAM, MON_ONCE, mm_answer_pwnamallow}, 206 {MONITOR_REQ_PWNAM, MON_ONCE, mm_answer_pwnamallow},
206 {MONITOR_REQ_AUTHSERV, MON_ONCE, mm_answer_authserv}, 207 {MONITOR_REQ_AUTHSERV, MON_ONCE, mm_answer_authserv},
208 {MONITOR_REQ_AUTHROLE, MON_ONCE, mm_answer_authrole},
207 {MONITOR_REQ_AUTH2_READ_BANNER, MON_ONCE, mm_answer_auth2_read_banner}, 209 {MONITOR_REQ_AUTH2_READ_BANNER, MON_ONCE, mm_answer_auth2_read_banner},
208 {MONITOR_REQ_AUTHPASSWORD, MON_AUTH, mm_answer_authpassword}, 210 {MONITOR_REQ_AUTHPASSWORD, MON_AUTH, mm_answer_authpassword},
209#ifdef USE_PAM 211#ifdef USE_PAM
@@ -791,6 +793,7 @@ mm_answer_pwnamallow(int sock, Buffer *m)
791 793
792 /* Allow service/style information on the auth context */ 794 /* Allow service/style information on the auth context */
793 monitor_permit(mon_dispatch, MONITOR_REQ_AUTHSERV, 1); 795 monitor_permit(mon_dispatch, MONITOR_REQ_AUTHSERV, 1);
796 monitor_permit(mon_dispatch, MONITOR_REQ_AUTHROLE, 1);
794 monitor_permit(mon_dispatch, MONITOR_REQ_AUTH2_READ_BANNER, 1); 797 monitor_permit(mon_dispatch, MONITOR_REQ_AUTH2_READ_BANNER, 1);
795 798
796#ifdef USE_PAM 799#ifdef USE_PAM
@@ -821,14 +824,37 @@ mm_answer_authserv(int sock, Buffer *m)
821 824
822 authctxt->service = buffer_get_string(m, NULL); 825 authctxt->service = buffer_get_string(m, NULL);
823 authctxt->style = buffer_get_string(m, NULL); 826 authctxt->style = buffer_get_string(m, NULL);
824 debug3("%s: service=%s, style=%s", 827 authctxt->role = buffer_get_string(m, NULL);
825 __func__, authctxt->service, authctxt->style); 828 debug3("%s: service=%s, style=%s, role=%s",
829 __func__, authctxt->service, authctxt->style, authctxt->role);
826 830
827 if (strlen(authctxt->style) == 0) { 831 if (strlen(authctxt->style) == 0) {
828 free(authctxt->style); 832 free(authctxt->style);
829 authctxt->style = NULL; 833 authctxt->style = NULL;
830 } 834 }
831 835
836 if (strlen(authctxt->role) == 0) {
837 free(authctxt->role);
838 authctxt->role = NULL;
839 }
840
841 return (0);
842}
843
844int
845mm_answer_authrole(int sock, Buffer *m)
846{
847 monitor_permit_authentications(1);
848
849 authctxt->role = buffer_get_string(m, NULL);
850 debug3("%s: role=%s",
851 __func__, authctxt->role);
852
853 if (strlen(authctxt->role) == 0) {
854 free(authctxt->role);
855 authctxt->role = NULL;
856 }
857
832 return (0); 858 return (0);
833} 859}
834 860
@@ -1463,7 +1489,7 @@ mm_answer_pty(int sock, Buffer *m)
1463 res = pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty)); 1489 res = pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty));
1464 if (res == 0) 1490 if (res == 0)
1465 goto error; 1491 goto error;
1466 pty_setowner(authctxt->pw, s->tty); 1492 pty_setowner(authctxt->pw, s->tty, authctxt->role);
1467 1493
1468 buffer_put_int(m, 1); 1494 buffer_put_int(m, 1);
1469 buffer_put_cstring(m, s->tty); 1495 buffer_put_cstring(m, s->tty);
diff --git a/monitor.h b/monitor.h
index ec41404c7..4c7955d7a 100644
--- a/monitor.h
+++ b/monitor.h
@@ -68,6 +68,8 @@ enum monitor_reqtype {
68 MONITOR_REQ_GSSSIGN = 150, MONITOR_ANS_GSSSIGN = 151, 68 MONITOR_REQ_GSSSIGN = 150, MONITOR_ANS_GSSSIGN = 151,
69 MONITOR_REQ_GSSUPCREDS = 152, MONITOR_ANS_GSSUPCREDS = 153, 69 MONITOR_REQ_GSSUPCREDS = 152, MONITOR_ANS_GSSUPCREDS = 153,
70 70
71 MONITOR_REQ_AUTHROLE = 154,
72
71}; 73};
72 74
73struct monitor { 75struct monitor {
diff --git a/monitor_wrap.c b/monitor_wrap.c
index d5cb640af..2ff8064a0 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -327,10 +327,10 @@ mm_auth2_read_banner(void)
327 return (banner); 327 return (banner);
328} 328}
329 329
330/* Inform the privileged process about service and style */ 330/* Inform the privileged process about service, style, and role */
331 331
332void 332void
333mm_inform_authserv(char *service, char *style) 333mm_inform_authserv(char *service, char *style, char *role)
334{ 334{
335 Buffer m; 335 Buffer m;
336 336
@@ -339,12 +339,30 @@ mm_inform_authserv(char *service, char *style)
339 buffer_init(&m); 339 buffer_init(&m);
340 buffer_put_cstring(&m, service); 340 buffer_put_cstring(&m, service);
341 buffer_put_cstring(&m, style ? style : ""); 341 buffer_put_cstring(&m, style ? style : "");
342 buffer_put_cstring(&m, role ? role : "");
342 343
343 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTHSERV, &m); 344 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTHSERV, &m);
344 345
345 buffer_free(&m); 346 buffer_free(&m);
346} 347}
347 348
349/* Inform the privileged process about role */
350
351void
352mm_inform_authrole(char *role)
353{
354 Buffer m;
355
356 debug3("%s entering", __func__);
357
358 buffer_init(&m);
359 buffer_put_cstring(&m, role ? role : "");
360
361 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTHROLE, &m);
362
363 buffer_free(&m);
364}
365
348/* Do the password authentication */ 366/* Do the password authentication */
349int 367int
350mm_auth_password(Authctxt *authctxt, char *password) 368mm_auth_password(Authctxt *authctxt, char *password)
diff --git a/monitor_wrap.h b/monitor_wrap.h
index 8f9dd8961..3e75867cd 100644
--- a/monitor_wrap.h
+++ b/monitor_wrap.h
@@ -41,7 +41,8 @@ void mm_log_handler(LogLevel, const char *, void *);
41int mm_is_monitor(void); 41int mm_is_monitor(void);
42DH *mm_choose_dh(int, int, int); 42DH *mm_choose_dh(int, int, int);
43int mm_key_sign(Key *, u_char **, u_int *, const u_char *, u_int, const char *); 43int mm_key_sign(Key *, u_char **, u_int *, const u_char *, u_int, const char *);
44void mm_inform_authserv(char *, char *); 44void mm_inform_authserv(char *, char *, char *);
45void mm_inform_authrole(char *);
45struct passwd *mm_getpwnamallow(const char *); 46struct passwd *mm_getpwnamallow(const char *);
46char *mm_auth2_read_banner(void); 47char *mm_auth2_read_banner(void);
47int mm_auth_password(struct Authctxt *, char *); 48int mm_auth_password(struct Authctxt *, char *);
diff --git a/openbsd-compat/port-linux.c b/openbsd-compat/port-linux.c
index e4c5d1b7c..e26faf08c 100644
--- a/openbsd-compat/port-linux.c
+++ b/openbsd-compat/port-linux.c
@@ -27,6 +27,12 @@
27#include <string.h> 27#include <string.h>
28#include <stdio.h> 28#include <stdio.h>
29 29
30#ifdef WITH_SELINUX
31#include "key.h"
32#include "hostfile.h"
33#include "auth.h"
34#endif
35
30#include "log.h" 36#include "log.h"
31#include "xmalloc.h" 37#include "xmalloc.h"
32#include "port-linux.h" 38#include "port-linux.h"
@@ -56,7 +62,7 @@ ssh_selinux_enabled(void)
56 62
57/* Return the default security context for the given username */ 63/* Return the default security context for the given username */
58static security_context_t 64static security_context_t
59ssh_selinux_getctxbyname(char *pwname) 65ssh_selinux_getctxbyname(char *pwname, const char *role)
60{ 66{
61 security_context_t sc = NULL; 67 security_context_t sc = NULL;
62 char *sename = NULL, *lvl = NULL; 68 char *sename = NULL, *lvl = NULL;
@@ -71,9 +77,16 @@ ssh_selinux_getctxbyname(char *pwname)
71#endif 77#endif
72 78
73#ifdef HAVE_GET_DEFAULT_CONTEXT_WITH_LEVEL 79#ifdef HAVE_GET_DEFAULT_CONTEXT_WITH_LEVEL
74 r = get_default_context_with_level(sename, lvl, NULL, &sc); 80 if (role != NULL && role[0])
81 r = get_default_context_with_rolelevel(sename, role, lvl, NULL,
82 &sc);
83 else
84 r = get_default_context_with_level(sename, lvl, NULL, &sc);
75#else 85#else
76 r = get_default_context(sename, NULL, &sc); 86 if (role != NULL && role[0])
87 r = get_default_context_with_role(sename, role, NULL, &sc);
88 else
89 r = get_default_context(sename, NULL, &sc);
77#endif 90#endif
78 91
79 if (r != 0) { 92 if (r != 0) {
@@ -103,7 +116,7 @@ ssh_selinux_getctxbyname(char *pwname)
103 116
104/* Set the execution context to the default for the specified user */ 117/* Set the execution context to the default for the specified user */
105void 118void
106ssh_selinux_setup_exec_context(char *pwname) 119ssh_selinux_setup_exec_context(char *pwname, const char *role)
107{ 120{
108 security_context_t user_ctx = NULL; 121 security_context_t user_ctx = NULL;
109 122
@@ -112,7 +125,7 @@ ssh_selinux_setup_exec_context(char *pwname)
112 125
113 debug3("%s: setting execution context", __func__); 126 debug3("%s: setting execution context", __func__);
114 127
115 user_ctx = ssh_selinux_getctxbyname(pwname); 128 user_ctx = ssh_selinux_getctxbyname(pwname, role);
116 if (setexeccon(user_ctx) != 0) { 129 if (setexeccon(user_ctx) != 0) {
117 switch (security_getenforce()) { 130 switch (security_getenforce()) {
118 case -1: 131 case -1:
@@ -134,7 +147,7 @@ ssh_selinux_setup_exec_context(char *pwname)
134 147
135/* Set the TTY context for the specified user */ 148/* Set the TTY context for the specified user */
136void 149void
137ssh_selinux_setup_pty(char *pwname, const char *tty) 150ssh_selinux_setup_pty(char *pwname, const char *tty, const char *role)
138{ 151{
139 security_context_t new_tty_ctx = NULL; 152 security_context_t new_tty_ctx = NULL;
140 security_context_t user_ctx = NULL; 153 security_context_t user_ctx = NULL;
@@ -145,7 +158,7 @@ ssh_selinux_setup_pty(char *pwname, const char *tty)
145 158
146 debug3("%s: setting TTY context on %s", __func__, tty); 159 debug3("%s: setting TTY context on %s", __func__, tty);
147 160
148 user_ctx = ssh_selinux_getctxbyname(pwname); 161 user_ctx = ssh_selinux_getctxbyname(pwname, role);
149 162
150 /* XXX: should these calls fatal() upon failure in enforcing mode? */ 163 /* XXX: should these calls fatal() upon failure in enforcing mode? */
151 164
diff --git a/openbsd-compat/port-linux.h b/openbsd-compat/port-linux.h
index 3c22a854d..c88129428 100644
--- a/openbsd-compat/port-linux.h
+++ b/openbsd-compat/port-linux.h
@@ -19,8 +19,8 @@
19 19
20#ifdef WITH_SELINUX 20#ifdef WITH_SELINUX
21int ssh_selinux_enabled(void); 21int ssh_selinux_enabled(void);
22void ssh_selinux_setup_pty(char *, const char *); 22void ssh_selinux_setup_pty(char *, const char *, const char *);
23void ssh_selinux_setup_exec_context(char *); 23void ssh_selinux_setup_exec_context(char *, const char *);
24void ssh_selinux_change_context(const char *); 24void ssh_selinux_change_context(const char *);
25void ssh_selinux_setfscreatecon(const char *); 25void ssh_selinux_setfscreatecon(const char *);
26#endif 26#endif
diff --git a/platform.c b/platform.c
index 973a63e40..cd7bf5665 100644
--- a/platform.c
+++ b/platform.c
@@ -143,7 +143,7 @@ platform_setusercontext(struct passwd *pw)
143 * called if sshd is running as root. 143 * called if sshd is running as root.
144 */ 144 */
145void 145void
146platform_setusercontext_post_groups(struct passwd *pw) 146platform_setusercontext_post_groups(struct passwd *pw, const char *role)
147{ 147{
148#if !defined(HAVE_LOGIN_CAP) && defined(USE_PAM) 148#if !defined(HAVE_LOGIN_CAP) && defined(USE_PAM)
149 /* 149 /*
@@ -184,7 +184,7 @@ platform_setusercontext_post_groups(struct passwd *pw)
184 } 184 }
185#endif /* HAVE_SETPCRED */ 185#endif /* HAVE_SETPCRED */
186#ifdef WITH_SELINUX 186#ifdef WITH_SELINUX
187 ssh_selinux_setup_exec_context(pw->pw_name); 187 ssh_selinux_setup_exec_context(pw->pw_name, role);
188#endif 188#endif
189} 189}
190 190
diff --git a/platform.h b/platform.h
index ea4f9c584..60d72ffe7 100644
--- a/platform.h
+++ b/platform.h
@@ -25,7 +25,7 @@ void platform_post_fork_parent(pid_t child_pid);
25void platform_post_fork_child(void); 25void platform_post_fork_child(void);
26int platform_privileged_uidswap(void); 26int platform_privileged_uidswap(void);
27void platform_setusercontext(struct passwd *); 27void platform_setusercontext(struct passwd *);
28void platform_setusercontext_post_groups(struct passwd *); 28void platform_setusercontext_post_groups(struct passwd *, const char *);
29char *platform_get_krb5_client(const char *); 29char *platform_get_krb5_client(const char *);
30char *platform_krb5_get_principal_name(const char *); 30char *platform_krb5_get_principal_name(const char *);
31int platform_sys_dir_uid(uid_t); 31int platform_sys_dir_uid(uid_t);
diff --git a/session.c b/session.c
index a08aa69d1..ea3871eb8 100644
--- a/session.c
+++ b/session.c
@@ -1325,7 +1325,7 @@ safely_chroot(const char *path, uid_t uid)
1325 1325
1326/* Set login name, uid, gid, and groups. */ 1326/* Set login name, uid, gid, and groups. */
1327void 1327void
1328do_setusercontext(struct passwd *pw) 1328do_setusercontext(struct passwd *pw, const char *role)
1329{ 1329{
1330 char *chroot_path, *tmp; 1330 char *chroot_path, *tmp;
1331 1331
@@ -1353,7 +1353,7 @@ do_setusercontext(struct passwd *pw)
1353 endgrent(); 1353 endgrent();
1354#endif 1354#endif
1355 1355
1356 platform_setusercontext_post_groups(pw); 1356 platform_setusercontext_post_groups(pw, role);
1357 1357
1358 if (!in_chroot && options.chroot_directory != NULL && 1358 if (!in_chroot && options.chroot_directory != NULL &&
1359 strcasecmp(options.chroot_directory, "none") != 0) { 1359 strcasecmp(options.chroot_directory, "none") != 0) {
@@ -1489,7 +1489,7 @@ do_child(Session *s, const char *command)
1489 1489
1490 /* Force a password change */ 1490 /* Force a password change */
1491 if (s->authctxt->force_pwchange) { 1491 if (s->authctxt->force_pwchange) {
1492 do_setusercontext(pw); 1492 do_setusercontext(pw, s->authctxt->role);
1493 child_close_fds(); 1493 child_close_fds();
1494 do_pwchange(s); 1494 do_pwchange(s);
1495 exit(1); 1495 exit(1);
@@ -1511,7 +1511,7 @@ do_child(Session *s, const char *command)
1511 /* When PAM is enabled we rely on it to do the nologin check */ 1511 /* When PAM is enabled we rely on it to do the nologin check */
1512 if (!options.use_pam) 1512 if (!options.use_pam)
1513 do_nologin(pw); 1513 do_nologin(pw);
1514 do_setusercontext(pw); 1514 do_setusercontext(pw, s->authctxt->role);
1515 /* 1515 /*
1516 * PAM session modules in do_setusercontext may have 1516 * PAM session modules in do_setusercontext may have
1517 * generated messages, so if this in an interactive 1517 * generated messages, so if this in an interactive
@@ -1903,7 +1903,7 @@ session_pty_req(Session *s)
1903 tty_parse_modes(s->ttyfd, &n_bytes); 1903 tty_parse_modes(s->ttyfd, &n_bytes);
1904 1904
1905 if (!use_privsep) 1905 if (!use_privsep)
1906 pty_setowner(s->pw, s->tty); 1906 pty_setowner(s->pw, s->tty, s->authctxt->role);
1907 1907
1908 /* Set window size from the packet. */ 1908 /* Set window size from the packet. */
1909 pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel); 1909 pty_change_window_size(s->ptyfd, s->row, s->col, s->xpixel, s->ypixel);
diff --git a/session.h b/session.h
index 98e1dafee..0a31dce4d 100644
--- a/session.h
+++ b/session.h
@@ -76,7 +76,7 @@ void session_pty_cleanup2(Session *);
76Session *session_new(void); 76Session *session_new(void);
77Session *session_by_tty(char *); 77Session *session_by_tty(char *);
78void session_close(Session *); 78void session_close(Session *);
79void do_setusercontext(struct passwd *); 79void do_setusercontext(struct passwd *, const char *);
80void child_set_env(char ***envp, u_int *envsizep, const char *name, 80void child_set_env(char ***envp, u_int *envsizep, const char *name,
81 const char *value); 81 const char *value);
82 82
diff --git a/sshd.c b/sshd.c
index 38cf9b493..9221632e9 100644
--- a/sshd.c
+++ b/sshd.c
@@ -678,7 +678,7 @@ privsep_postauth(Authctxt *authctxt)
678 reseed_prngs(); 678 reseed_prngs();
679 679
680 /* Drop privileges */ 680 /* Drop privileges */
681 do_setusercontext(authctxt->pw); 681 do_setusercontext(authctxt->pw, authctxt->role);
682 682
683 skip: 683 skip:
684 /* It is safe now to apply the key state */ 684 /* It is safe now to apply the key state */
diff --git a/sshpty.c b/sshpty.c
index fe2fb5aa2..feb22b06b 100644
--- a/sshpty.c
+++ b/sshpty.c
@@ -187,7 +187,7 @@ pty_change_window_size(int ptyfd, u_int row, u_int col,
187} 187}
188 188
189void 189void
190pty_setowner(struct passwd *pw, const char *tty) 190pty_setowner(struct passwd *pw, const char *tty, const char *role)
191{ 191{
192 struct group *grp; 192 struct group *grp;
193 gid_t gid; 193 gid_t gid;
@@ -209,7 +209,7 @@ pty_setowner(struct passwd *pw, const char *tty)
209 strerror(errno)); 209 strerror(errno));
210 210
211#ifdef WITH_SELINUX 211#ifdef WITH_SELINUX
212 ssh_selinux_setup_pty(pw->pw_name, tty); 212 ssh_selinux_setup_pty(pw->pw_name, tty, role);
213#endif 213#endif
214 214
215 if (st.st_uid != pw->pw_uid || st.st_gid != gid) { 215 if (st.st_uid != pw->pw_uid || st.st_gid != gid) {
diff --git a/sshpty.h b/sshpty.h
index 9ec7e9a15..de7e000ae 100644
--- a/sshpty.h
+++ b/sshpty.h
@@ -24,5 +24,5 @@ int pty_allocate(int *, int *, char *, size_t);
24void pty_release(const char *); 24void pty_release(const char *);
25void pty_make_controlling_tty(int *, const char *); 25void pty_make_controlling_tty(int *, const char *);
26void pty_change_window_size(int, u_int, u_int, u_int, u_int); 26void pty_change_window_size(int, u_int, u_int, u_int, u_int);
27void pty_setowner(struct passwd *, const char *); 27void pty_setowner(struct passwd *, const char *, const char *);
28void disconnect_controlling_tty(void); 28void disconnect_controlling_tty(void);