GUACAMOLE-221: Remove bad rebase code.

This commit is contained in:
Nick Couchman 2020-08-04 22:29:52 -04:00
parent 98dbf15d0b
commit 26b9850d87
5 changed files with 6 additions and 132 deletions

View File

@ -1,60 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef GUAC_COMMON_SSH_CONSTANTS_H
#define GUAC_COMMON_SSH_CONSTANTS_H
/**
* The name of the parameter that Guacamole uses to collect the username from
* the Guacamole client and send it to the SSH server.
*/
#define GUAC_SSH_PARAMETER_NAME_USERNAME "username"
/**
* The name of the parameter that Guacamole uses to collect the password from
* the Guacamole client and send it to the SSH server.
*/
#define GUAC_SSH_PARAMETER_NAME_PASSWORD "password"
/**
* The name of the parameter that Guacamole uses to collect a SSH key passphrase
* from the Guacamole client in order to unlock a private key.
*/
#define GUAC_SSH_PARAMETER_NAME_PASSPHRASE "passphrase"
/**
* The name of the parameter that Guacamole uses to collect the terminal
* color scheme from the Guacamole client.
*/
#define GUAC_SSH_PARAMETER_NAME_COLOR_SCHEME "color-scheme"
/**
* The name of the parameter that Guacamole uses to collect the font name
* from the Guacamole client.
*/
#define GUAC_SSH_PARAMETER_NAME_FONT_NAME "font-name"
/**
* The name of the parameter that Guacamole uses to collect the font size
* from the Guacamole client
*/
#define GUAC_SSH_PARAMETER_NAME_FONT_SIZE "font-size"
#endif /* GUAC_COMMON_SSH_CONSTANTS_H */

View File

@ -19,7 +19,6 @@
#include "common-ssh/key.h"
#include "common-ssh/ssh.h"
#include "common-ssh/ssh-constants.h"
#include "common-ssh/user.h"
#include <guacamole/client.h>
@ -362,7 +361,7 @@ static int guac_common_ssh_authenticate(guac_common_ssh_session* common_session)
/* Attempt authentication with username + password. */
if (user->password == NULL && common_session->credential_handler) {
char* password = common_session->credential_handler(client, GUAC_SSH_PARAMETER_NAME_PASSWORD);
char* password = common_session->credential_handler(client, "password");
if (password != NULL)
user->password = password;

View File

@ -20,7 +20,6 @@
#include "config.h"
#include "argv.h"
#include "ssh.h"
#include "common-ssh/ssh-constants.h"
#include "terminal/terminal.h"
#include <guacamole/protocol.h>
@ -37,76 +36,14 @@ int guac_ssh_argv_callback(guac_user* user, const char* mimetype,
guac_client* client = user->client;
guac_ssh_client* ssh_client = (guac_ssh_client*) client->data;
guac_terminal* terminal = ssh_client->term;
guac_ssh_settings* settings = ssh_client->settings;
/* Update color scheme */
if (strcmp(name, GUAC_SSH_ARGV_COLOR_SCHEME) == 0)
guac_terminal_apply_color_scheme(terminal, value);
<<<<<<< HEAD
/* Update font name */
else if (strcmp(name, GUAC_SSH_ARGV_FONT_NAME) == 0)
guac_terminal_apply_font(terminal, value, -1, 0);
=======
/* Update username */
case GUAC_SSH_ARGV_SETTING_USERNAME:
free(settings->username);
settings->username = strndup(argv->buffer, argv->length);
pthread_cond_broadcast(&(ssh_client->ssh_credential_cond));
break;
/* Update password */
case GUAC_SSH_ARGV_SETTING_PASSWORD:
/* Update password in settings */
free(settings->password);
settings->password = strndup(argv->buffer, argv->length);
/* Update password in ssh user */
guac_common_ssh_user* ssh_user = (guac_common_ssh_user*) ssh_client->user;
if (ssh_user != NULL)
guac_common_ssh_user_set_password(ssh_user, argv->buffer);
pthread_cond_broadcast(&(ssh_client->ssh_credential_cond));
break;
/* Update private key passphrase */
case GUAC_SSH_ARGV_SETTING_PASSPHRASE:
free(settings->key_passphrase);
settings->key_passphrase = strndup(argv->buffer, argv->length);
pthread_cond_broadcast(&(ssh_client->ssh_credential_cond));
break;
/* Update color scheme */
case GUAC_SSH_ARGV_SETTING_COLOR_SCHEME:
guac_terminal_apply_color_scheme(terminal, argv->buffer);
guac_client_stream_argv(client, client->socket, "text/plain",
GUAC_SSH_PARAMETER_NAME_COLOR_SCHEME, argv->buffer);
break;
/* Update font name */
case GUAC_SSH_ARGV_SETTING_FONT_NAME:
guac_terminal_apply_font(terminal, argv->buffer, -1, 0);
guac_client_stream_argv(client, client->socket, "text/plain",
GUAC_SSH_PARAMETER_NAME_FONT_NAME, argv->buffer);
break;
/* Update font size */
case GUAC_SSH_ARGV_SETTING_FONT_SIZE:
/* Update only if font size is sane */
size = atoi(argv->buffer);
if (size > 0) {
guac_terminal_apply_font(terminal, NULL, size,
ssh_client->settings->resolution);
guac_client_stream_argv(client, client->socket, "text/plain",
GUAC_SSH_PARAMETER_NAME_FONT_SIZE, argv->buffer);
}
break;
>>>>>>> GUACAMOLE-221: Use constants for parameters updated via argv or required instructions.
/* Update only if font size is sane */
else if (strcmp(name, GUAC_SSH_ARGV_FONT_SIZE) == 0) {

View File

@ -22,7 +22,6 @@
#include "argv.h"
#include "client.h"
#include "common/defaults.h"
#include "common-ssh/ssh-constants.h"
#include "settings.h"
#include <guacamole/user.h>

View File

@ -23,7 +23,6 @@
#include "common/recording.h"
#include "common-ssh/sftp.h"
#include "common-ssh/ssh.h"
#include "common-ssh/ssh-constants.h"
#include "settings.h"
#include "sftp.h"
#include "ssh.h"
@ -81,9 +80,9 @@ typedef struct guac_ssh_credential_prompt_map {
* on the screen.
*/
guac_ssh_credential_prompt_map ssh_credential_prompt_map[] = {
{ GUAC_SSH_PARAMETER_NAME_USERNAME, "Login as: " },
{ GUAC_SSH_PARAMETER_NAME_PASSWORD, "Password: " },
{ GUAC_SSH_PARAMETER_NAME_PASSPHRASE, "Key passphrase: " },
{ GUAC_SSH_ARGV_USERNAME, "Login as: " },
{ GUAC_SSH_ARGV_PASSWORD, "Password: " },
{ GUAC_SSH_ARGV_PASSPHRASE, "Key passphrase: " },
{ NULL, NULL}
};
@ -155,7 +154,7 @@ static guac_common_ssh_user* guac_ssh_get_user(guac_client* client) {
/* Get username */
while (settings->username == NULL) {
char* username = guac_ssh_get_credential(client, GUAC_SSH_PARAMETER_NAME_USERNAME);
char* username = guac_ssh_get_credential(client, GUAC_SSH_ARGV_USERNAME);
if (username != NULL)
settings->username = username;
@ -185,7 +184,7 @@ static guac_common_ssh_user* guac_ssh_get_user(guac_client* client) {
/* Prompt for passphrase if missing */
while (settings->key_passphrase == NULL) {
char* passphrase = guac_ssh_get_credential(client, GUAC_SSH_PARAMETER_NAME_PASSPHRASE);
char* passphrase = guac_ssh_get_credential(client, GUAC_SSH_ARGV_PASSPHRASE);
if (passphrase != NULL)
settings->key_passphrase = passphrase;