version 1.217, 2015/01/19 19:52:16 |
version 1.218, 2015/01/19 20:07:45 |
|
|
int *batch_flag; /* flag in option struct that disables method */ |
int *batch_flag; /* flag in option struct that disables method */ |
}; |
}; |
|
|
void input_userauth_success(int, u_int32_t, void *); |
int input_userauth_success(int, u_int32_t, void *); |
void input_userauth_success_unexpected(int, u_int32_t, void *); |
int input_userauth_success_unexpected(int, u_int32_t, void *); |
void input_userauth_failure(int, u_int32_t, void *); |
int input_userauth_failure(int, u_int32_t, void *); |
void input_userauth_banner(int, u_int32_t, void *); |
int input_userauth_banner(int, u_int32_t, void *); |
void input_userauth_error(int, u_int32_t, void *); |
int input_userauth_error(int, u_int32_t, void *); |
void input_userauth_info_req(int, u_int32_t, void *); |
int input_userauth_info_req(int, u_int32_t, void *); |
void input_userauth_pk_ok(int, u_int32_t, void *); |
int input_userauth_pk_ok(int, u_int32_t, void *); |
void input_userauth_passwd_changereq(int, u_int32_t, void *); |
int input_userauth_passwd_changereq(int, u_int32_t, void *); |
|
|
int userauth_none(Authctxt *); |
int userauth_none(Authctxt *); |
int userauth_pubkey(Authctxt *); |
int userauth_pubkey(Authctxt *); |
|
|
|
|
#ifdef GSSAPI |
#ifdef GSSAPI |
int userauth_gssapi(Authctxt *authctxt); |
int userauth_gssapi(Authctxt *authctxt); |
void input_gssapi_response(int type, u_int32_t, void *); |
int input_gssapi_response(int type, u_int32_t, void *); |
void input_gssapi_token(int type, u_int32_t, void *); |
int input_gssapi_token(int type, u_int32_t, void *); |
void input_gssapi_hash(int type, u_int32_t, void *); |
int input_gssapi_hash(int type, u_int32_t, void *); |
void input_gssapi_error(int, u_int32_t, void *); |
int input_gssapi_error(int, u_int32_t, void *); |
void input_gssapi_errtok(int, u_int32_t, void *); |
int input_gssapi_errtok(int, u_int32_t, void *); |
#endif |
#endif |
|
|
void userauth(Authctxt *, char *); |
void userauth(Authctxt *, char *); |
|
|
} |
} |
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
void |
int |
input_userauth_error(int type, u_int32_t seq, void *ctxt) |
input_userauth_error(int type, u_int32_t seq, void *ctxt) |
{ |
{ |
fatal("input_userauth_error: bad message during authentication: " |
fatal("input_userauth_error: bad message during authentication: " |
"type %d", type); |
"type %d", type); |
|
return 0; |
} |
} |
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
void |
int |
input_userauth_banner(int type, u_int32_t seq, void *ctxt) |
input_userauth_banner(int type, u_int32_t seq, void *ctxt) |
{ |
{ |
char *msg, *raw, *lang; |
char *msg, *raw, *lang; |
|
|
} |
} |
free(raw); |
free(raw); |
free(lang); |
free(lang); |
|
return 0; |
} |
} |
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
void |
int |
input_userauth_success(int type, u_int32_t seq, void *ctxt) |
input_userauth_success(int type, u_int32_t seq, void *ctxt) |
{ |
{ |
Authctxt *authctxt = ctxt; |
Authctxt *authctxt = ctxt; |
|
|
free(authctxt->methoddata); |
free(authctxt->methoddata); |
authctxt->methoddata = NULL; |
authctxt->methoddata = NULL; |
authctxt->success = 1; /* break out */ |
authctxt->success = 1; /* break out */ |
|
return 0; |
} |
} |
|
|
void |
int |
input_userauth_success_unexpected(int type, u_int32_t seq, void *ctxt) |
input_userauth_success_unexpected(int type, u_int32_t seq, void *ctxt) |
{ |
{ |
Authctxt *authctxt = ctxt; |
Authctxt *authctxt = ctxt; |
|
|
|
|
fatal("Unexpected authentication success during %s.", |
fatal("Unexpected authentication success during %s.", |
authctxt->method->name); |
authctxt->method->name); |
|
return 0; |
} |
} |
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
void |
int |
input_userauth_failure(int type, u_int32_t seq, void *ctxt) |
input_userauth_failure(int type, u_int32_t seq, void *ctxt) |
{ |
{ |
Authctxt *authctxt = ctxt; |
Authctxt *authctxt = ctxt; |
|
|
debug("Authentications that can continue: %s", authlist); |
debug("Authentications that can continue: %s", authlist); |
|
|
userauth(authctxt, authlist); |
userauth(authctxt, authlist); |
|
return 0; |
} |
} |
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
void |
int |
input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt) |
input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt) |
{ |
{ |
Authctxt *authctxt = ctxt; |
Authctxt *authctxt = ctxt; |
|
|
/* try another method if we did not send a packet */ |
/* try another method if we did not send a packet */ |
if (sent == 0) |
if (sent == 0) |
userauth(authctxt, NULL); |
userauth(authctxt, NULL); |
|
return 0; |
} |
} |
|
|
#ifdef GSSAPI |
#ifdef GSSAPI |
|
|
* parse PASSWD_CHANGEREQ, prompt user and send SSH2_MSG_USERAUTH_REQUEST |
* parse PASSWD_CHANGEREQ, prompt user and send SSH2_MSG_USERAUTH_REQUEST |
*/ |
*/ |
/* ARGSUSED */ |
/* ARGSUSED */ |
void |
int |
input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) |
input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) |
{ |
{ |
Authctxt *authctxt = ctxt; |
Authctxt *authctxt = ctxt; |
|
|
password = read_passphrase(prompt, RP_ALLOW_EOF); |
password = read_passphrase(prompt, RP_ALLOW_EOF); |
if (password == NULL) { |
if (password == NULL) { |
/* bail out */ |
/* bail out */ |
return; |
return 0; |
} |
} |
snprintf(prompt, sizeof(prompt), |
snprintf(prompt, sizeof(prompt), |
"Retype %.30s@%.128s's new password: ", |
"Retype %.30s@%.128s's new password: ", |
|
|
|
|
dispatch_set(SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ, |
dispatch_set(SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ, |
&input_userauth_passwd_changereq); |
&input_userauth_passwd_changereq); |
|
return 0; |
} |
} |
|
|
static int |
static int |
|
|
/* |
/* |
* parse INFO_REQUEST, prompt user and send INFO_RESPONSE |
* parse INFO_REQUEST, prompt user and send INFO_RESPONSE |
*/ |
*/ |
void |
int |
input_userauth_info_req(int type, u_int32_t seq, void *ctxt) |
input_userauth_info_req(int type, u_int32_t seq, void *ctxt) |
{ |
{ |
Authctxt *authctxt = ctxt; |
Authctxt *authctxt = ctxt; |
|
|
|
|
packet_add_padding(64); |
packet_add_padding(64); |
packet_send(); |
packet_send(); |
|
return 0; |
} |
} |
|
|
static int |
static int |