summaryrefslogtreecommitdiff
path: root/auth1.c
diff options
context:
space:
mode:
authorManoj Srivastava <srivasta@debian.org>2014-02-09 16:09:49 +0000
committerColin Watson <cjwatson@debian.org>2014-03-20 00:24:48 +0000
commitae32d626ed3d15cfd7f432358b63c005961921df (patch)
tree1c46579409f5f692ec7db009bc716d980451095f /auth1.c
parent9dfcd1a0e691c1cad34b168e27b3ed31ab6986cd (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 'auth1.c')
-rw-r--r--auth1.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/auth1.c b/auth1.c
index 0f870b3b6..c70739080 100644
--- a/auth1.c
+++ b/auth1.c
@@ -380,7 +380,7 @@ void
380do_authentication(Authctxt *authctxt) 380do_authentication(Authctxt *authctxt)
381{ 381{
382 u_int ulen; 382 u_int ulen;
383 char *user, *style = NULL; 383 char *user, *style = NULL, *role = NULL;
384 384
385 /* Get the name of the user that we wish to log in as. */ 385 /* Get the name of the user that we wish to log in as. */
386 packet_read_expect(SSH_CMSG_USER); 386 packet_read_expect(SSH_CMSG_USER);
@@ -389,11 +389,17 @@ do_authentication(Authctxt *authctxt)
389 user = packet_get_cstring(&ulen); 389 user = packet_get_cstring(&ulen);
390 packet_check_eom(); 390 packet_check_eom();
391 391
392 if ((role = strchr(user, '/')) != NULL)
393 *role++ = '\0';
394
392 if ((style = strchr(user, ':')) != NULL) 395 if ((style = strchr(user, ':')) != NULL)
393 *style++ = '\0'; 396 *style++ = '\0';
397 else if (role && (style = strchr(role, ':')) != NULL)
398 *style++ = '\0';
394 399
395 authctxt->user = user; 400 authctxt->user = user;
396 authctxt->style = style; 401 authctxt->style = style;
402 authctxt->role = role;
397 403
398 /* Verify that the user is a valid user. */ 404 /* Verify that the user is a valid user. */
399 if ((authctxt->pw = PRIVSEP(getpwnamallow(user))) != NULL) 405 if ((authctxt->pw = PRIVSEP(getpwnamallow(user))) != NULL)