GUAC-493: Coding style changes.

This commit is contained in:
Michael Jumper 2014-07-17 11:49:24 -07:00
parent e543d9eeb5
commit 46faa7ab85

View File

@ -95,16 +95,19 @@ static void __kbd_callback(const char *name, int name_len,
int num_prompts,
const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts,
LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses,
void **abstract)
{
void **abstract) {
guac_client* client = (guac_client*) *abstract;
ssh_guac_client_data* client_data = (ssh_guac_client_data*) client->data;
if (num_prompts == 1) {
responses[0].text = strdup(client_data->password);
responses[0].length = strlen(client_data->password);
}
}
else
guac_client_log_info(client, "Unsupported number of keyboard-interactive prompts: %i", num_prompts);
}
static LIBSSH2_SESSION* __guac_ssh_create_session(guac_client* client,
int* socket_fd) {
@ -204,10 +207,11 @@ static LIBSSH2_SESSION* __guac_ssh_create_session(guac_client* client,
/* Get list of suported authentication methods */
user_authlist = libssh2_userauth_list(session, client_data->username, strlen(client_data->username));
guac_client_log_info (client, "Supported authentications: %s", user_authlist);
guac_client_log_info(client, "Supported authentication methods: %s", user_authlist);
/* Authenticate with key if available */
if (client_data->key != NULL) {
/* Check if public key auth is suported on the server */
if (strstr(user_authlist, "publickey") == NULL) {
guac_client_abort(client, GUAC_PROTOCOL_STATUS_CLIENT_UNAUTHORIZED,
@ -233,16 +237,19 @@ static LIBSSH2_SESSION* __guac_ssh_create_session(guac_client* client,
if (strstr(user_authlist, "password") != NULL) {
guac_client_log_info(client, "Using password authentication method");
retval = libssh2_userauth_password(session, client_data->username, client_data->password);
} else if (strstr(user_authlist, "keyboard-interactive") != NULL) {
}
else if (strstr(user_authlist, "keyboard-interactive") != NULL) {
guac_client_log_info(client, "Using keyboard-interactive authentication method");
retval = libssh2_userauth_keyboard_interactive(session, client_data->username, &__kbd_callback);
} else {
}
else {
guac_client_abort(client, GUAC_PROTOCOL_STATUS_CLIENT_BAD_TYPE, "No known authentication methods");
return NULL;
}
if (retval == 0)
return session;
else {
char* error_message;
libssh2_session_last_error(session, &error_message, NULL, 0);