diff options
Diffstat (limited to 'auth2.c')
-rw-r--r-- | auth2.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -222,7 +222,7 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt) | |||
222 | { | 222 | { |
223 | Authctxt *authctxt = ctxt; | 223 | Authctxt *authctxt = ctxt; |
224 | Authmethod *m = NULL; | 224 | Authmethod *m = NULL; |
225 | char *user, *service, *method, *style = NULL; | 225 | char *user, *service, *method, *style = NULL, *role = NULL; |
226 | int authenticated = 0; | 226 | int authenticated = 0; |
227 | 227 | ||
228 | if (authctxt == NULL) | 228 | if (authctxt == NULL) |
@@ -234,8 +234,13 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt) | |||
234 | debug("userauth-request for user %s service %s method %s", user, service, method); | 234 | debug("userauth-request for user %s service %s method %s", user, service, method); |
235 | debug("attempt %d failures %d", authctxt->attempt, authctxt->failures); | 235 | debug("attempt %d failures %d", authctxt->attempt, authctxt->failures); |
236 | 236 | ||
237 | if ((role = strchr(user, '/')) != NULL) | ||
238 | *role++ = 0; | ||
239 | |||
237 | if ((style = strchr(user, ':')) != NULL) | 240 | if ((style = strchr(user, ':')) != NULL) |
238 | *style++ = 0; | 241 | *style++ = 0; |
242 | else if (role && (style = strchr(role, ':')) != NULL) | ||
243 | *style++ = '\0'; | ||
239 | 244 | ||
240 | if (authctxt->attempt++ == 0) { | 245 | if (authctxt->attempt++ == 0) { |
241 | /* setup auth context */ | 246 | /* setup auth context */ |
@@ -259,8 +264,9 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt) | |||
259 | use_privsep ? " [net]" : ""); | 264 | use_privsep ? " [net]" : ""); |
260 | authctxt->service = xstrdup(service); | 265 | authctxt->service = xstrdup(service); |
261 | authctxt->style = style ? xstrdup(style) : NULL; | 266 | authctxt->style = style ? xstrdup(style) : NULL; |
267 | authctxt->role = role ? xstrdup(role) : NULL; | ||
262 | if (use_privsep) | 268 | if (use_privsep) |
263 | mm_inform_authserv(service, style); | 269 | mm_inform_authserv(service, style, role); |
264 | userauth_banner(); | 270 | userauth_banner(); |
265 | if (auth2_setup_methods_lists(authctxt) != 0) | 271 | if (auth2_setup_methods_lists(authctxt) != 0) |
266 | packet_disconnect("no authentication methods enabled"); | 272 | packet_disconnect("no authentication methods enabled"); |