Merge 1.6.0 changes back to patch.
This commit is contained in:
commit
d59e5d7f67
10
configure.ac
10
configure.ac
@ -731,7 +731,7 @@ fi
|
||||
#
|
||||
|
||||
freerdp_version=
|
||||
have_freerdp=
|
||||
have_freerdp=disabled
|
||||
FREERDP_PLUGIN_DIR=
|
||||
|
||||
AC_ARG_WITH([rdp],
|
||||
@ -752,7 +752,7 @@ OLDCPPFLAGS="$CPPFLAGS"
|
||||
|
||||
if test "x$with_rdp" != "xno"
|
||||
then
|
||||
freerdp_version=3
|
||||
freerdp_version="(3.x)"
|
||||
have_freerdp=yes
|
||||
PKG_CHECK_MODULES([RDP], [freerdp3 freerdp-client3 winpr3],
|
||||
[CPPFLAGS="${RDP_CFLAGS} -Werror $CPPFLAGS"]
|
||||
@ -768,7 +768,7 @@ fi
|
||||
|
||||
if test "x$with_rdp" != "xno" -a "x${have_freerdp}" = "xno"
|
||||
then
|
||||
freerdp_version=2
|
||||
freerdp_version="(2.x)"
|
||||
have_freerdp=yes
|
||||
PKG_CHECK_MODULES([RDP], [freerdp2 freerdp-client2 winpr2],
|
||||
[CPPFLAGS="${RDP_CFLAGS} -Werror $CPPFLAGS"]
|
||||
@ -1494,7 +1494,7 @@ $PACKAGE_NAME version $PACKAGE_VERSION
|
||||
|
||||
Library status:
|
||||
|
||||
freerdp${freerdp_version} ............ ${have_freerdp}
|
||||
freerdp ............. ${have_freerdp} ${freerdp_version}
|
||||
pango ............... ${have_pango}
|
||||
libavcodec .......... ${have_libavcodec}
|
||||
libavformat ......... ${have_libavformat}
|
||||
@ -1524,7 +1524,7 @@ $PACKAGE_NAME version $PACKAGE_VERSION
|
||||
guacenc .... ${build_guacenc}
|
||||
guaclog .... ${build_guaclog}
|
||||
|
||||
FreeRDP${freerdp_version} plugins: ${build_rdp_plugins}
|
||||
FreeRDP plugins: ${build_rdp_plugins}
|
||||
Init scripts: ${build_init}
|
||||
Systemd units: ${build_systemd}
|
||||
|
||||
|
||||
@ -24,8 +24,8 @@
|
||||
#include <guacamole/client.h>
|
||||
#include <guacamole/fips.h>
|
||||
#include <guacamole/mem.h>
|
||||
#include <guacamole/socket-tcp.h>
|
||||
#include <guacamole/string.h>
|
||||
#include <guacamole/tcp.h>
|
||||
#include <libssh2.h>
|
||||
|
||||
#ifdef LIBSSH2_USES_GCRYPT
|
||||
@ -417,7 +417,7 @@ guac_common_ssh_session* guac_common_ssh_create_session(guac_client* client,
|
||||
int timeout, int keepalive, const char* host_key,
|
||||
guac_ssh_credential_handler* credential_handler) {
|
||||
|
||||
int fd = guac_socket_tcp_connect(hostname, port, timeout);
|
||||
int fd = guac_tcp_connect(hostname, port, timeout);
|
||||
if (fd < 0) {
|
||||
guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
|
||||
"Failed to open TCP connection to %s on %s.", hostname, port);
|
||||
|
||||
@ -70,11 +70,11 @@ libguacinc_HEADERS = \
|
||||
guacamole/socket-constants.h \
|
||||
guacamole/socket.h \
|
||||
guacamole/socket-fntypes.h \
|
||||
guacamole/socket-tcp.h \
|
||||
guacamole/socket-types.h \
|
||||
guacamole/stream.h \
|
||||
guacamole/stream-types.h \
|
||||
guacamole/string.h \
|
||||
guacamole/tcp.h \
|
||||
guacamole/timestamp.h \
|
||||
guacamole/timestamp-types.h \
|
||||
guacamole/unicode.h \
|
||||
@ -129,9 +129,9 @@ libguac_la_SOURCES = \
|
||||
socket-broadcast.c \
|
||||
socket-fd.c \
|
||||
socket-nest.c \
|
||||
socket-tcp.c \
|
||||
socket-tee.c \
|
||||
string.c \
|
||||
tcp.c \
|
||||
timestamp.c \
|
||||
unicode.c \
|
||||
user.c \
|
||||
|
||||
@ -17,17 +17,25 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
#ifndef __GUAC_SOCKET_TCP_H
|
||||
#define __GUAC_SOCKET_TCP_H
|
||||
#ifndef GUAC_TCP_H
|
||||
#define GUAC_TCP_H
|
||||
|
||||
/**
|
||||
* Provides convenience functions for establishing low-level TCP connections.
|
||||
*
|
||||
* @file tcp.h
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/**
|
||||
* Given a hostname or IP address and port, attempt to connect to that
|
||||
* system, returning an open socket if the connection succeeds, or a negative
|
||||
* value if it fails. If it fails the errno variable will be set.
|
||||
* Given a hostname or IP address and port, attempt to connect to that system,
|
||||
* returning the file descriptor of an open socket if the connection succeeds,
|
||||
* or a negative value if it fails. The returned file descriptor must
|
||||
* eventually be freed with a call to close(). If this function fails,
|
||||
* guac_error will be set appropriately.
|
||||
*
|
||||
* @param hostname
|
||||
* The hostname or IP address to which to attempt connections.
|
||||
@ -42,6 +50,6 @@
|
||||
* A valid socket if the connection succeeds, or a negative integer if it
|
||||
* fails.
|
||||
*/
|
||||
int guac_socket_tcp_connect(const char* hostname, const char* port, const int timeout);
|
||||
int guac_tcp_connect(const char* hostname, const char* port, const int timeout);
|
||||
|
||||
#endif // __GUAC_SOCKET_TCP_H
|
||||
#endif // GUAC_TCP_H
|
||||
@ -19,7 +19,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "guacamole/error.h"
|
||||
#include "guacamole/socket.h"
|
||||
#include "guacamole/tcp.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@ -27,8 +27,9 @@
|
||||
#include <netinet/in.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int guac_socket_tcp_connect(const char* hostname, const char* port, const int timeout) {
|
||||
int guac_tcp_connect(const char* hostname, const char* port, const int timeout) {
|
||||
|
||||
int retval;
|
||||
|
||||
@ -117,4 +118,4 @@ int guac_socket_tcp_connect(const char* hostname, const char* port, const int ti
|
||||
/* Return the fd, or the error message if the socket connection failed. */
|
||||
return fd;
|
||||
|
||||
}
|
||||
}
|
||||
@ -20,7 +20,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "guacamole/error.h"
|
||||
#include "guacamole/socket-tcp.h"
|
||||
#include "guacamole/tcp.h"
|
||||
#include "guacamole/timestamp.h"
|
||||
#include "guacamole/wol.h"
|
||||
|
||||
@ -204,7 +204,7 @@ int guac_wol_wake_and_wait(const char* mac_addr, const char* broadcast_addr,
|
||||
const char* hostname, const char* port, const int timeout) {
|
||||
|
||||
/* Attempt to connect, first. */
|
||||
int sockfd = guac_socket_tcp_connect(hostname, port, timeout);
|
||||
int sockfd = guac_tcp_connect(hostname, port, timeout);
|
||||
|
||||
/* If connection succeeds, no need to wake the system. */
|
||||
if (sockfd > 0) {
|
||||
@ -225,7 +225,7 @@ int guac_wol_wake_and_wait(const char* mac_addr, const char* broadcast_addr,
|
||||
/* Try to connect on the specified TCP port and hostname or IP. */
|
||||
for (int i = 0; i < retries; i++) {
|
||||
|
||||
sockfd = guac_socket_tcp_connect(hostname, port, timeout);
|
||||
sockfd = guac_tcp_connect(hostname, port, timeout);
|
||||
|
||||
/* Connection succeeded - close socket and exit. */
|
||||
if (sockfd > 0) {
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
#include <guacamole/mem.h>
|
||||
#include <guacamole/protocol.h>
|
||||
#include <guacamole/recording.h>
|
||||
#include <guacamole/socket-tcp.h>
|
||||
#include <guacamole/tcp.h>
|
||||
#include <guacamole/timestamp.h>
|
||||
#include <guacamole/wol-constants.h>
|
||||
#include <guacamole/wol.h>
|
||||
@ -386,7 +386,7 @@ static telnet_t* __guac_telnet_create_session(guac_client* client) {
|
||||
guac_telnet_client* telnet_client = (guac_telnet_client*) client->data;
|
||||
guac_telnet_settings* settings = telnet_client->settings;
|
||||
|
||||
int fd = guac_socket_tcp_connect(settings->hostname, settings->port, settings->timeout);
|
||||
int fd = guac_tcp_connect(settings->hostname, settings->port, settings->timeout);
|
||||
|
||||
/* Open telnet session */
|
||||
telnet_t* telnet = telnet_init(__telnet_options, __guac_telnet_event_handler, 0, client);
|
||||
|
||||
@ -48,6 +48,7 @@ guac_terminal_buffer* guac_terminal_buffer_alloc(int rows, guac_terminal_char* d
|
||||
/* Allocate row */
|
||||
row->available = 256;
|
||||
row->length = 0;
|
||||
row->wrapped_row = false;
|
||||
row->characters = guac_mem_alloc(sizeof(guac_terminal_char), row->available);
|
||||
|
||||
/* Next row */
|
||||
@ -166,6 +167,10 @@ void guac_terminal_buffer_copy_rows(guac_terminal_buffer* buffer,
|
||||
/* Copy data */
|
||||
memcpy(dst_row->characters, src_row->characters, sizeof(guac_terminal_char) * src_row->length);
|
||||
dst_row->length = src_row->length;
|
||||
dst_row->wrapped_row = src_row->wrapped_row;
|
||||
|
||||
/* Reset src wrapped_row */
|
||||
src_row->wrapped_row = false;
|
||||
|
||||
/* Next current_row */
|
||||
current_row += step;
|
||||
|
||||
@ -371,17 +371,31 @@ void guac_terminal_select_end(guac_terminal* terminal) {
|
||||
/* Otherwise, copy multiple rows */
|
||||
else {
|
||||
|
||||
/* Store first row */
|
||||
/* Get the first selected row */
|
||||
guac_terminal_buffer_row* buffer_row = guac_terminal_buffer_get_row(terminal->buffer, start_row, 0);
|
||||
|
||||
/* Store first row from start_col to last available col */
|
||||
guac_terminal_clipboard_append_row(terminal, start_row, start_col, -1);
|
||||
|
||||
/* Store all middle rows */
|
||||
for (int row = start_row + 1; row < end_row; row++) {
|
||||
guac_common_clipboard_append(terminal->clipboard, "\n", 1);
|
||||
|
||||
/* Add a new line only if the line was not wrapped */
|
||||
if (buffer_row->wrapped_row == false)
|
||||
guac_common_clipboard_append(terminal->clipboard, "\n", 1);
|
||||
|
||||
/* Store middle row */
|
||||
guac_terminal_clipboard_append_row(terminal, row, 0, -1);
|
||||
|
||||
/* Get next buffer row */
|
||||
buffer_row = guac_terminal_buffer_get_row(terminal->buffer, row, 0);
|
||||
}
|
||||
|
||||
/* Store last row */
|
||||
guac_common_clipboard_append(terminal->clipboard, "\n", 1);
|
||||
/* Add a new line only if the line was not wrapped */
|
||||
if (buffer_row->wrapped_row == false)
|
||||
guac_common_clipboard_append(terminal->clipboard, "\n", 1);
|
||||
|
||||
/* Store last row from col 0 to end_col */
|
||||
guac_terminal_clipboard_append_row(terminal, end_row, 0, end_col);
|
||||
|
||||
}
|
||||
|
||||
@ -62,8 +62,16 @@
|
||||
*
|
||||
* @param term
|
||||
* The guac_terminal whose cursor should be advanced to the next row.
|
||||
*
|
||||
* @param force_wrap
|
||||
* True if the line wrap was forced, false otherwise
|
||||
*/
|
||||
static void guac_terminal_linefeed(guac_terminal* term) {
|
||||
static void guac_terminal_linefeed(guac_terminal* term, bool force_wrap) {
|
||||
|
||||
/* Assign in wrapped_row: 1 to avoid \n in clipboard or 0 to add \n */
|
||||
guac_terminal_buffer_row* buffer_row =
|
||||
guac_terminal_buffer_get_row(term->buffer, term->cursor_row, 0);
|
||||
buffer_row->wrapped_row = force_wrap;
|
||||
|
||||
/* Scroll up if necessary */
|
||||
if (term->cursor_row == term->scroll_end)
|
||||
@ -226,7 +234,7 @@ int guac_terminal_echo(guac_terminal* term, unsigned char c) {
|
||||
case 0x0C: /* FF */
|
||||
|
||||
/* Advance to next row */
|
||||
guac_terminal_linefeed(term);
|
||||
guac_terminal_linefeed(term, false);
|
||||
|
||||
/* If automatic carriage return, fall through to CR handler */
|
||||
if (!term->automatic_carriage_return)
|
||||
@ -274,8 +282,10 @@ int guac_terminal_echo(guac_terminal* term, unsigned char c) {
|
||||
|
||||
/* Wrap if necessary */
|
||||
if (term->cursor_col >= term->term_width) {
|
||||
|
||||
/* New line */
|
||||
term->cursor_col = 0;
|
||||
guac_terminal_linefeed(term);
|
||||
guac_terminal_linefeed(term, true);
|
||||
}
|
||||
|
||||
/* If insert mode, shift other characters right by 1 */
|
||||
@ -345,14 +355,14 @@ int guac_terminal_escape(guac_terminal* term, unsigned char c) {
|
||||
|
||||
/* Index (IND) */
|
||||
case 'D':
|
||||
guac_terminal_linefeed(term);
|
||||
guac_terminal_linefeed(term, false);
|
||||
term->char_handler = guac_terminal_echo;
|
||||
break;
|
||||
|
||||
/* Next Line (NEL) */
|
||||
case 'E':
|
||||
guac_terminal_move_cursor(term, term->cursor_row, 0);
|
||||
guac_terminal_linefeed(term);
|
||||
guac_terminal_linefeed(term, false);
|
||||
term->char_handler = guac_terminal_echo;
|
||||
break;
|
||||
|
||||
|
||||
@ -242,9 +242,10 @@ void guac_terminal_reset(guac_terminal* term) {
|
||||
/* Reset display palette */
|
||||
guac_terminal_display_reset_palette(term->display);
|
||||
|
||||
/* Clear terminal */
|
||||
/* Clear terminal with a row length of term_width-1
|
||||
* to avoid exceed the size of the display layer */
|
||||
for (row=0; row<term->term_height; row++)
|
||||
guac_terminal_set_columns(term, row, 0, term->term_width, &(term->default_char));
|
||||
guac_terminal_set_columns(term, row, 0, term->term_width-1, &(term->default_char));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -51,6 +51,12 @@ typedef struct guac_terminal_buffer_row {
|
||||
*/
|
||||
int available;
|
||||
|
||||
/**
|
||||
* True if the current row has been wrapped to avoid going off the screen.
|
||||
* False otherwise.
|
||||
*/
|
||||
bool wrapped_row;
|
||||
|
||||
} guac_terminal_buffer_row;
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user