diff options
Diffstat (limited to 'auth2-gss.c')
-rw-r--r-- | auth2-gss.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/auth2-gss.c b/auth2-gss.c index 95844a05e..539654ee0 100644 --- a/auth2-gss.c +++ b/auth2-gss.c | |||
@@ -46,6 +46,39 @@ static void input_gssapi_mic(int type, u_int32_t plen, void *ctxt); | |||
46 | static void input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt); | 46 | static void input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt); |
47 | static void input_gssapi_errtok(int, u_int32_t, void *); | 47 | static void input_gssapi_errtok(int, u_int32_t, void *); |
48 | 48 | ||
49 | /* | ||
50 | * The 'gssapi_keyex' userauth mechanism. | ||
51 | */ | ||
52 | static int | ||
53 | userauth_gsskeyex(Authctxt *authctxt) | ||
54 | { | ||
55 | int authenticated = 0; | ||
56 | Buffer b; | ||
57 | gss_buffer_desc mic, gssbuf; | ||
58 | u_int len; | ||
59 | |||
60 | mic.value = packet_get_string(&len); | ||
61 | mic.length = len; | ||
62 | |||
63 | packet_check_eom(); | ||
64 | |||
65 | ssh_gssapi_buildmic(&b, authctxt->user, authctxt->service, | ||
66 | "gssapi-keyex"); | ||
67 | |||
68 | gssbuf.value = buffer_ptr(&b); | ||
69 | gssbuf.length = buffer_len(&b); | ||
70 | |||
71 | /* gss_kex_context is NULL with privsep, so we can't check it here */ | ||
72 | if (!GSS_ERROR(PRIVSEP(ssh_gssapi_checkmic(gss_kex_context, | ||
73 | &gssbuf, &mic)))) | ||
74 | authenticated = PRIVSEP(ssh_gssapi_userok(authctxt->user)); | ||
75 | |||
76 | buffer_free(&b); | ||
77 | xfree(mic.value); | ||
78 | |||
79 | return (authenticated); | ||
80 | } | ||
81 | |||
49 | /* | 82 | /* |
50 | * We only support those mechanisms that we know about (ie ones that we know | 83 | * We only support those mechanisms that we know about (ie ones that we know |
51 | * how to check local user kuserok and the like) | 84 | * how to check local user kuserok and the like) |
@@ -96,11 +129,13 @@ userauth_gssapi(Authctxt *authctxt) | |||
96 | 129 | ||
97 | if (!present) { | 130 | if (!present) { |
98 | xfree(doid); | 131 | xfree(doid); |
132 | authctxt->server_caused_failure = 1; | ||
99 | return (0); | 133 | return (0); |
100 | } | 134 | } |
101 | 135 | ||
102 | if (GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctxt, &goid)))) { | 136 | if (GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctxt, &goid)))) { |
103 | xfree(doid); | 137 | xfree(doid); |
138 | authctxt->server_caused_failure = 1; | ||
104 | return (0); | 139 | return (0); |
105 | } | 140 | } |
106 | 141 | ||
@@ -284,6 +319,12 @@ input_gssapi_mic(int type, u_int32_t plen, void *ctxt) | |||
284 | userauth_finish(authctxt, authenticated, "gssapi-with-mic"); | 319 | userauth_finish(authctxt, authenticated, "gssapi-with-mic"); |
285 | } | 320 | } |
286 | 321 | ||
322 | Authmethod method_gsskeyex = { | ||
323 | "gssapi-keyex", | ||
324 | userauth_gsskeyex, | ||
325 | &options.gss_authentication | ||
326 | }; | ||
327 | |||
287 | Authmethod method_gssapi = { | 328 | Authmethod method_gssapi = { |
288 | "gssapi-with-mic", | 329 | "gssapi-with-mic", |
289 | userauth_gssapi, | 330 | userauth_gssapi, |