summaryrefslogtreecommitdiff
path: root/auth2-gss.c
diff options
context:
space:
mode:
Diffstat (limited to 'auth2-gss.c')
-rw-r--r--auth2-gss.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/auth2-gss.c b/auth2-gss.c
index 3289ba18e..0ac405496 100644
--- a/auth2-gss.c
+++ b/auth2-gss.c
@@ -47,6 +47,39 @@ static void input_gssapi_mic(int type, u_int32_t plen, void *ctxt);
47static void input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt); 47static void input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt);
48static void input_gssapi_errtok(int, u_int32_t, void *); 48static void input_gssapi_errtok(int, u_int32_t, void *);
49 49
50/*
51 * The 'gssapi_keyex' userauth mechanism.
52 */
53static int
54userauth_gsskeyex(Authctxt *authctxt)
55{
56 int authenticated = 0;
57 Buffer b;
58 gss_buffer_desc mic, gssbuf;
59 u_int len;
60
61 mic.value = packet_get_string(&len);
62 mic.length = len;
63
64 packet_check_eom();
65
66 ssh_gssapi_buildmic(&b, authctxt->user, authctxt->service,
67 "gssapi-keyex");
68
69 gssbuf.value = buffer_ptr(&b);
70 gssbuf.length = buffer_len(&b);
71
72 /* gss_kex_context is NULL with privsep, so we can't check it here */
73 if (!GSS_ERROR(PRIVSEP(ssh_gssapi_checkmic(gss_kex_context,
74 &gssbuf, &mic))))
75 authenticated = PRIVSEP(ssh_gssapi_userok(authctxt->user));
76
77 buffer_free(&b);
78 xfree(mic.value);
79
80 return (authenticated);
81}
82
50/* 83/*
51 * We only support those mechanisms that we know about (ie ones that we know 84 * We only support those mechanisms that we know about (ie ones that we know
52 * how to check local user kuserok and the like 85 * how to check local user kuserok and the like
@@ -286,6 +319,12 @@ input_gssapi_mic(int type, u_int32_t plen, void *ctxt)
286 userauth_finish(authctxt, authenticated, "gssapi-with-mic"); 319 userauth_finish(authctxt, authenticated, "gssapi-with-mic");
287} 320}
288 321
322Authmethod method_gsskeyex = {
323 "gssapi-keyx",
324 userauth_gsskeyex,
325 &options.gss_authentication
326};
327
289Authmethod method_gssapi = { 328Authmethod method_gssapi = {
290 "gssapi-with-mic", 329 "gssapi-with-mic",
291 userauth_gssapi, 330 userauth_gssapi,