summaryrefslogtreecommitdiff
path: root/auth2.c
diff options
context:
space:
mode:
authormarkus@openbsd.org <markus@openbsd.org>2017-05-30 14:29:59 +0000
committerDamien Miller <djm@mindrot.org>2017-05-31 10:50:33 +1000
commiteb272ea4099fd6157846f15c129ac5727933aa69 (patch)
tree7c721828dc6504e4adaa6517ce65840eaaba06ef /auth2.c
parent5a146bbd4fdf5c571f9fb438e5210d28cead76d9 (diff)
upstream commit
switch auth2 to ssh_dispatch API; ok djm@ Upstream-ID: a752ca19e2782900dd83060b5c6344008106215f
Diffstat (limited to 'auth2.c')
-rw-r--r--auth2.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/auth2.c b/auth2.c
index cfbf9d250..08ea2a802 100644
--- a/auth2.c
+++ b/auth2.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth2.c,v 1.139 2017/05/30 14:23:52 markus Exp $ */ 1/* $OpenBSD: auth2.c,v 1.140 2017/05/30 14:29:59 markus Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -170,9 +170,9 @@ do_authentication2(Authctxt *authctxt)
170{ 170{
171 struct ssh *ssh = active_state; /* XXX */ 171 struct ssh *ssh = active_state; /* XXX */
172 ssh->authctxt = authctxt; /* XXX move to caller */ 172 ssh->authctxt = authctxt; /* XXX move to caller */
173 dispatch_init(&dispatch_protocol_error); 173 ssh_dispatch_init(ssh, &dispatch_protocol_error);
174 dispatch_set(SSH2_MSG_SERVICE_REQUEST, &input_service_request); 174 ssh_dispatch_set(ssh, SSH2_MSG_SERVICE_REQUEST, &input_service_request);
175 dispatch_run(DISPATCH_BLOCK, &authctxt->success, ssh); 175 ssh_dispatch_run(ssh, DISPATCH_BLOCK, &authctxt->success, ssh);
176 ssh->authctxt = NULL; 176 ssh->authctxt = NULL;
177} 177}
178 178
@@ -193,7 +193,7 @@ input_service_request(int type, u_int32_t seq, struct ssh *ssh)
193 if (!authctxt->success) { 193 if (!authctxt->success) {
194 acceptit = 1; 194 acceptit = 1;
195 /* now we can handle user-auth requests */ 195 /* now we can handle user-auth requests */
196 dispatch_set(SSH2_MSG_USERAUTH_REQUEST, &input_userauth_request); 196 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_REQUEST, &input_userauth_request);
197 } 197 }
198 } 198 }
199 /* XXX all other service requests are denied */ 199 /* XXX all other service requests are denied */
@@ -269,12 +269,12 @@ input_userauth_request(int type, u_int32_t seq, struct ssh *ssh)
269 authctxt->user, authctxt->service, user, service); 269 authctxt->user, authctxt->service, user, service);
270 } 270 }
271 /* reset state */ 271 /* reset state */
272 auth2_challenge_stop(authctxt); 272 auth2_challenge_stop(ssh);
273 273
274#ifdef GSSAPI 274#ifdef GSSAPI
275 /* XXX move to auth2_gssapi_stop() */ 275 /* XXX move to auth2_gssapi_stop() */
276 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL); 276 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL);
277 dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL); 277 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL);
278#endif 278#endif
279 279
280 authctxt->postponed = 0; 280 authctxt->postponed = 0;
@@ -284,9 +284,9 @@ input_userauth_request(int type, u_int32_t seq, struct ssh *ssh)
284 m = authmethod_lookup(authctxt, method); 284 m = authmethod_lookup(authctxt, method);
285 if (m != NULL && authctxt->failures < options.max_authtries) { 285 if (m != NULL && authctxt->failures < options.max_authtries) {
286 debug2("input_userauth_request: try method %s", method); 286 debug2("input_userauth_request: try method %s", method);
287 authenticated = m->userauth(authctxt); 287 authenticated = m->userauth(ssh);
288 } 288 }
289 userauth_finish(authctxt, authenticated, method, NULL); 289 userauth_finish(ssh, authenticated, method, NULL);
290 290
291 free(service); 291 free(service);
292 free(user); 292 free(user);
@@ -295,10 +295,10 @@ input_userauth_request(int type, u_int32_t seq, struct ssh *ssh)
295} 295}
296 296
297void 297void
298userauth_finish(Authctxt *authctxt, int authenticated, const char *method, 298userauth_finish(struct ssh *ssh, int authenticated, const char *method,
299 const char *submethod) 299 const char *submethod)
300{ 300{
301 struct ssh *ssh = active_state; /* XXX */ 301 Authctxt *authctxt = ssh->authctxt;
302 char *methods; 302 char *methods;
303 int partial = 0; 303 int partial = 0;
304 304
@@ -354,7 +354,7 @@ userauth_finish(Authctxt *authctxt, int authenticated, const char *method,
354 354
355 if (authenticated == 1) { 355 if (authenticated == 1) {
356 /* turn off userauth */ 356 /* turn off userauth */
357 dispatch_set(SSH2_MSG_USERAUTH_REQUEST, &dispatch_protocol_ignore); 357 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_REQUEST, &dispatch_protocol_ignore);
358 packet_start(SSH2_MSG_USERAUTH_SUCCESS); 358 packet_start(SSH2_MSG_USERAUTH_SUCCESS);
359 packet_send(); 359 packet_send();
360 packet_write_wait(); 360 packet_write_wait();