indent changes and removed libssh2_ prefix from static function
This commit is contained in:
@@ -572,7 +572,7 @@ file_read_publickey(LIBSSH2_SESSION * session, unsigned char **method,
|
|||||||
* Read a PEM encoded private key from an id_??? style file
|
* Read a PEM encoded private key from an id_??? style file
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
libssh2_file_read_privatekey(LIBSSH2_SESSION * session,
|
file_read_privatekey(LIBSSH2_SESSION * session,
|
||||||
const LIBSSH2_HOSTKEY_METHOD ** hostkey_method,
|
const LIBSSH2_HOSTKEY_METHOD ** hostkey_method,
|
||||||
void **hostkey_abstract,
|
void **hostkey_abstract,
|
||||||
const unsigned char *method, int method_len,
|
const unsigned char *method, int method_len,
|
||||||
@@ -713,9 +713,10 @@ userauth_hostbased_fromfile(LIBSSH2_SESSION *session,
|
|||||||
memcpy(session->userauth_host_s, local_username, local_username_len);
|
memcpy(session->userauth_host_s, local_username, local_username_len);
|
||||||
session->userauth_host_s += local_username_len;
|
session->userauth_host_s += local_username_len;
|
||||||
|
|
||||||
if (libssh2_file_read_privatekey
|
if (file_read_privatekey(session, &privkeyobj, &abstract,
|
||||||
(session, &privkeyobj, &abstract, session->userauth_host_method,
|
session->userauth_host_method,
|
||||||
session->userauth_host_method_len, privatekey, passphrase)) {
|
session->userauth_host_method_len,
|
||||||
|
privatekey, passphrase)) {
|
||||||
LIBSSH2_FREE(session, session->userauth_host_method);
|
LIBSSH2_FREE(session, session->userauth_host_method);
|
||||||
session->userauth_host_method = NULL;
|
session->userauth_host_method = NULL;
|
||||||
LIBSSH2_FREE(session, session->userauth_host_packet);
|
LIBSSH2_FREE(session, session->userauth_host_packet);
|
||||||
@@ -825,11 +826,12 @@ userauth_hostbased_fromfile(LIBSSH2_SESSION *session,
|
|||||||
userauth_host_packet_requirev_state);
|
userauth_host_packet_requirev_state);
|
||||||
if (rc == PACKET_EAGAIN) {
|
if (rc == PACKET_EAGAIN) {
|
||||||
return PACKET_EAGAIN;
|
return PACKET_EAGAIN;
|
||||||
} else if (rc) {
|
|
||||||
session->userauth_host_state = libssh2_NB_state_idle;
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session->userauth_host_state = libssh2_NB_state_idle;
|
||||||
|
if (rc)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (session->userauth_host_data[0] == SSH_MSG_USERAUTH_SUCCESS) {
|
if (session->userauth_host_data[0] == SSH_MSG_USERAUTH_SUCCESS) {
|
||||||
_libssh2_debug(session, LIBSSH2_DBG_AUTH,
|
_libssh2_debug(session, LIBSSH2_DBG_AUTH,
|
||||||
"Hostbased authentication successful");
|
"Hostbased authentication successful");
|
||||||
@@ -837,7 +839,6 @@ userauth_hostbased_fromfile(LIBSSH2_SESSION *session,
|
|||||||
LIBSSH2_FREE(session, session->userauth_host_data);
|
LIBSSH2_FREE(session, session->userauth_host_data);
|
||||||
session->userauth_host_data = NULL;
|
session->userauth_host_data = NULL;
|
||||||
session->state |= LIBSSH2_STATE_AUTHENTICATED;
|
session->state |= LIBSSH2_STATE_AUTHENTICATED;
|
||||||
session->userauth_host_state = libssh2_NB_state_idle;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -849,7 +850,6 @@ userauth_hostbased_fromfile(LIBSSH2_SESSION *session,
|
|||||||
"Invalid signature for supplied public key, or bad "
|
"Invalid signature for supplied public key, or bad "
|
||||||
"username/public key combination",
|
"username/public key combination",
|
||||||
0);
|
0);
|
||||||
session->userauth_host_state = libssh2_NB_state_idle;
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1057,9 +1057,10 @@ userauth_publickey_fromfile(LIBSSH2_SESSION *session,
|
|||||||
LIBSSH2_FREE(session, session->userauth_pblc_data);
|
LIBSSH2_FREE(session, session->userauth_pblc_data);
|
||||||
session->userauth_pblc_data = NULL;
|
session->userauth_pblc_data = NULL;
|
||||||
|
|
||||||
if (libssh2_file_read_privatekey
|
if (file_read_privatekey(session, &privkeyobj, &abstract,
|
||||||
(session, &privkeyobj, &abstract, session->userauth_pblc_method,
|
session->userauth_pblc_method,
|
||||||
session->userauth_pblc_method_len, privatekey, passphrase)) {
|
session->userauth_pblc_method_len,
|
||||||
|
privatekey, passphrase)) {
|
||||||
LIBSSH2_FREE(session, session->userauth_pblc_method);
|
LIBSSH2_FREE(session, session->userauth_pblc_method);
|
||||||
session->userauth_pblc_method = NULL;
|
session->userauth_pblc_method = NULL;
|
||||||
LIBSSH2_FREE(session, session->userauth_pblc_packet);
|
LIBSSH2_FREE(session, session->userauth_pblc_packet);
|
||||||
|
|||||||
Reference in New Issue
Block a user