summaryrefslogtreecommitdiff
path: root/auth2.c
diff options
context:
space:
mode:
authorManoj Srivastava <srivasta@debian.org>2014-02-09 16:09:49 +0000
committerColin Watson <cjwatson@debian.org>2019-06-05 13:11:52 +0100
commit21e3ff3ab4791d3c94bd775da66cde29797fcb36 (patch)
treec218b12d60175ae0572c0236f2390d9e26de5bc9 /auth2.c
parent0f9f44654708e4fde2f52c52f717d061b5e458fa (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: 2019-06-05 Patch-Name: selinux-role.patch
Diffstat (limited to 'auth2.c')
-rw-r--r--auth2.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/auth2.c b/auth2.c
index 7417eafa4..d60e7f1f2 100644
--- a/auth2.c
+++ b/auth2.c
@@ -267,7 +267,7 @@ input_userauth_request(int type, u_int32_t seq, struct ssh *ssh)
267{ 267{
268 Authctxt *authctxt = ssh->authctxt; 268 Authctxt *authctxt = ssh->authctxt;
269 Authmethod *m = NULL; 269 Authmethod *m = NULL;
270 char *user = NULL, *service = NULL, *method = NULL, *style = NULL; 270 char *user = NULL, *service = NULL, *method = NULL, *style = NULL, *role = NULL;
271 int r, authenticated = 0; 271 int r, authenticated = 0;
272 double tstart = monotime_double(); 272 double tstart = monotime_double();
273 273
@@ -281,8 +281,13 @@ input_userauth_request(int type, u_int32_t seq, struct ssh *ssh)
281 debug("userauth-request for user %s service %s method %s", user, service, method); 281 debug("userauth-request for user %s service %s method %s", user, service, method);
282 debug("attempt %d failures %d", authctxt->attempt, authctxt->failures); 282 debug("attempt %d failures %d", authctxt->attempt, authctxt->failures);
283 283
284 if ((role = strchr(user, '/')) != NULL)
285 *role++ = 0;
286
284 if ((style = strchr(user, ':')) != NULL) 287 if ((style = strchr(user, ':')) != NULL)
285 *style++ = 0; 288 *style++ = 0;
289 else if (role && (style = strchr(role, ':')) != NULL)
290 *style++ = '\0';
286 291
287 if (authctxt->attempt++ == 0) { 292 if (authctxt->attempt++ == 0) {
288 /* setup auth context */ 293 /* setup auth context */
@@ -309,8 +314,9 @@ input_userauth_request(int type, u_int32_t seq, struct ssh *ssh)
309 use_privsep ? " [net]" : ""); 314 use_privsep ? " [net]" : "");
310 authctxt->service = xstrdup(service); 315 authctxt->service = xstrdup(service);
311 authctxt->style = style ? xstrdup(style) : NULL; 316 authctxt->style = style ? xstrdup(style) : NULL;
317 authctxt->role = role ? xstrdup(role) : NULL;
312 if (use_privsep) 318 if (use_privsep)
313 mm_inform_authserv(service, style); 319 mm_inform_authserv(service, style, role);
314 userauth_banner(ssh); 320 userauth_banner(ssh);
315 if (auth2_setup_methods_lists(authctxt) != 0) 321 if (auth2_setup_methods_lists(authctxt) != 0)
316 ssh_packet_disconnect(ssh, 322 ssh_packet_disconnect(ssh,