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>2018-04-03 08:20:56 +0100
commit7da968d97beba5fb80a5488516563ea1376db907 (patch)
tree0e9107c92138281814181acbdd1428a6862ef63b /auth2.c
parent398af3d66bfe8dc7d436570026571e522a0a13a0 (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 'auth2.c')
-rw-r--r--auth2.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/auth2.c b/auth2.c
index c34f58c45..be5e9f15f 100644
--- a/auth2.c
+++ b/auth2.c
@@ -218,7 +218,7 @@ input_userauth_request(int type, u_int32_t seq, struct ssh *ssh)
218{ 218{
219 Authctxt *authctxt = ssh->authctxt; 219 Authctxt *authctxt = ssh->authctxt;
220 Authmethod *m = NULL; 220 Authmethod *m = NULL;
221 char *user, *service, *method, *style = NULL; 221 char *user, *service, *method, *style = NULL, *role = NULL;
222 int authenticated = 0; 222 int authenticated = 0;
223 223
224 if (authctxt == NULL) 224 if (authctxt == NULL)
@@ -230,8 +230,13 @@ input_userauth_request(int type, u_int32_t seq, struct ssh *ssh)
230 debug("userauth-request for user %s service %s method %s", user, service, method); 230 debug("userauth-request for user %s service %s method %s", user, service, method);
231 debug("attempt %d failures %d", authctxt->attempt, authctxt->failures); 231 debug("attempt %d failures %d", authctxt->attempt, authctxt->failures);
232 232
233 if ((role = strchr(user, '/')) != NULL)
234 *role++ = 0;
235
233 if ((style = strchr(user, ':')) != NULL) 236 if ((style = strchr(user, ':')) != NULL)
234 *style++ = 0; 237 *style++ = 0;
238 else if (role && (style = strchr(role, ':')) != NULL)
239 *style++ = '\0';
235 240
236 if (authctxt->attempt++ == 0) { 241 if (authctxt->attempt++ == 0) {
237 /* setup auth context */ 242 /* setup auth context */
@@ -258,8 +263,9 @@ input_userauth_request(int type, u_int32_t seq, struct ssh *ssh)
258 use_privsep ? " [net]" : ""); 263 use_privsep ? " [net]" : "");
259 authctxt->service = xstrdup(service); 264 authctxt->service = xstrdup(service);
260 authctxt->style = style ? xstrdup(style) : NULL; 265 authctxt->style = style ? xstrdup(style) : NULL;
266 authctxt->role = role ? xstrdup(role) : NULL;
261 if (use_privsep) 267 if (use_privsep)
262 mm_inform_authserv(service, style); 268 mm_inform_authserv(service, style, role);
263 userauth_banner(); 269 userauth_banner();
264 if (auth2_setup_methods_lists(authctxt) != 0) 270 if (auth2_setup_methods_lists(authctxt) != 0)
265 packet_disconnect("no authentication methods enabled"); 271 packet_disconnect("no authentication methods enabled");