-/* $OpenBSD: sshconnect2.c,v 1.259 2017/05/30 08:52:20 markus Exp $ */
+/* $OpenBSD: sshconnect2.c,v 1.260 2017/05/30 14:19:15 markus Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Damien Miller. All rights reserved.
(r = sshpkt_send(ssh)) != 0)
fatal("%s: %s", __func__, ssh_err(r));
+ ssh->authctxt = &authctxt;
ssh_dispatch_init(ssh, &input_userauth_error);
ssh_dispatch_set(ssh, SSH2_MSG_EXT_INFO, &input_userauth_ext_info);
ssh_dispatch_set(ssh, SSH2_MSG_SERVICE_ACCEPT, &input_userauth_service_accept);
- ssh_dispatch_run(ssh, DISPATCH_BLOCK, &authctxt.success, &authctxt); /* loop until success */
+ ssh_dispatch_run(ssh, DISPATCH_BLOCK, &authctxt.success, ssh); /* loop until success */
+ ssh->authctxt = NULL;
pubkey_cleanup(&authctxt);
ssh_dispatch_range(ssh, SSH2_MSG_USERAUTH_MIN, SSH2_MSG_USERAUTH_MAX, NULL);
int
input_userauth_service_accept(int type, u_int32_t seqnr, void *ctxt)
{
- Authctxt *authctxt = ctxt;
- struct ssh *ssh = active_state;
+ struct ssh *ssh = ctxt;
+ Authctxt *authctxt = ssh->authctxt;
int r;
if (ssh_packet_remaining(ssh) > 0) {
int
input_userauth_ext_info(int type, u_int32_t seqnr, void *ctxt)
{
- return kex_input_ext_info(type, seqnr, active_state);
+ return kex_input_ext_info(type, seqnr, ctxt);
}
void
int
input_userauth_success(int type, u_int32_t seq, void *ctxt)
{
- Authctxt *authctxt = ctxt;
+ struct ssh *ssh = ctxt;
+ Authctxt *authctxt = ssh->authctxt;
if (authctxt == NULL)
fatal("input_userauth_success: no authentication context");
int
input_userauth_success_unexpected(int type, u_int32_t seq, void *ctxt)
{
- Authctxt *authctxt = ctxt;
+ struct ssh *ssh = ctxt;
+ Authctxt *authctxt = ssh->authctxt;
if (authctxt == NULL)
fatal("%s: no authentication context", __func__);
int
input_userauth_failure(int type, u_int32_t seq, void *ctxt)
{
- Authctxt *authctxt = ctxt;
+ struct ssh *ssh = ctxt;
+ Authctxt *authctxt = ssh->authctxt;
char *authlist = NULL;
int partial;
int
input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt)
{
- Authctxt *authctxt = ctxt;
+ struct ssh *ssh = ctxt;
+ Authctxt *authctxt = ssh->authctxt;
struct sshkey *key = NULL;
Identity *id = NULL;
Buffer b;
static OM_uint32
process_gssapi_token(void *ctxt, gss_buffer_t recv_tok)
{
- Authctxt *authctxt = ctxt;
+ struct ssh *ssh = ctxt;
+ Authctxt *authctxt = ssh->authctxt;
Gssctxt *gssctxt = authctxt->methoddata;
gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER;
gss_buffer_desc mic = GSS_C_EMPTY_BUFFER;
int
input_gssapi_response(int type, u_int32_t plen, void *ctxt)
{
- Authctxt *authctxt = ctxt;
+ struct ssh *ssh = ctxt;
+ Authctxt *authctxt = ssh->authctxt;
Gssctxt *gssctxt;
int oidlen;
char *oidv;
int
input_gssapi_token(int type, u_int32_t plen, void *ctxt)
{
- Authctxt *authctxt = ctxt;
+ struct ssh *ssh = ctxt;
+ Authctxt *authctxt = ssh->authctxt;
gss_buffer_desc recv_tok;
OM_uint32 status;
u_int slen;
int
input_gssapi_errtok(int type, u_int32_t plen, void *ctxt)
{
- Authctxt *authctxt = ctxt;
+ struct ssh *ssh = ctxt;
+ Authctxt *authctxt = ssh->authctxt;
Gssctxt *gssctxt;
gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER;
gss_buffer_desc recv_tok;
int
input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt)
{
- Authctxt *authctxt = ctxt;
+ struct ssh *ssh = ctxt;
+ Authctxt *authctxt = ssh->authctxt;
char *info, *lang, *password = NULL, *retype = NULL;
char prompt[150];
const char *host;
int
input_userauth_info_req(int type, u_int32_t seq, void *ctxt)
{
- Authctxt *authctxt = ctxt;
+ struct ssh *ssh = ctxt;
+ Authctxt *authctxt = ssh->authctxt;
char *name, *inst, *lang, *prompt, *response;
u_int num_prompts, i;
int echo = 0;