Compare commits

..

No commits in common. "main" and "patch" have entirely different histories.
main ... patch

31 changed files with 41 additions and 351 deletions

View File

@ -47,7 +47,6 @@ AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/socket.h time.h sys/time.h syslo
AC_DEFINE([_GNU_SOURCE], [1], [Uses GNU-specific APIs (if available)])
AC_DEFINE([_XOPEN_SOURCE], [700], [Uses X/Open and POSIX APIs])
AC_DEFINE([__BSD_VISIBLE], [1], [Uses BSD-specific APIs (if available)])
AC_DEFINE([_GNU_SOURCE], [1], [Use GNU sources (if available)])
# Check for availability of non-portable sched_getaffinity() function (one of
# several possible routes for determining the number of available processors)
@ -77,9 +76,6 @@ AC_CHECK_LIB([pthread], [pthread_create], [PTHREAD_LIBS=-lpthread
AC_DEFINE([HAVE_LIBPTHREAD],,
[Whether libpthread was found])])
# Check for pthread_setattr_default_np
AC_CHECK_DECLS([pthread_setattr_default_np], , , [[#include <pthread.h>]])
# librt
AC_CHECK_FUNC([timer_create], [AC_MSG_RESULT([timer_create was found without librt.])],
[AC_CHECK_LIB([rt], [timer_create],

5
debian/changelog vendored
View File

@ -1,5 +0,0 @@
pxvdi-guacamole (1.6.0) unstable; urgency=medium
* Initial release.
-- Lierfang Support Team <itsupport@lierfang.com> Wed, 09 Jul 2025 10:00:00 +0000

30
debian/control vendored
View File

@ -1,30 +0,0 @@
Source: pxvdi-guacamole
Section: net
Priority: optional
Maintainer: Lierfang Support Team <itsupport@lierfang.com>
Build-Depends: debhelper-compat (= 13),
libssl-dev,
libvorbis-dev,
libwebp-dev,
libpulse-dev,
libwebsockets-dev,
libvncserver-dev,
libtelnet-dev,
libssh2-1-dev,
libpango1.0-dev,
freerdp2-dev,
libssh-dev,
uuid-dev,
libtool-bin,
libpng-dev,
libjpeg62-turbo-dev,
libcairo2-dev,
libuuid1,
libtool
Standards-Version: 4.1.4
Package: pxvdi-guacamole
Section: net
Priority: optional
Architecture: any
Description: PXVDI Guacamole

22
debian/rules vendored
View File

@ -1,22 +0,0 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
%:
dh $@
override_dh_auto_configure:
dh_auto_configure -- --with-systemd-dir=/lib/systemd/system --disable-static
override_dh_install:
find debian -name "*.la" -delete
dh_install

View File

@ -1 +0,0 @@
3.0 (native)

View File

@ -30,14 +30,14 @@
#include <string.h>
#include <stdlib.h>
guac_common_clipboard* guac_common_clipboard_alloc(int buffer_size) {
guac_common_clipboard* guac_common_clipboard_alloc() {
guac_common_clipboard* clipboard = guac_mem_alloc(sizeof(guac_common_clipboard));
/* Init clipboard */
clipboard->mimetype[0] = '\0';
clipboard->buffer = guac_mem_alloc(buffer_size);
clipboard->available = buffer_size;
clipboard->buffer = guac_mem_alloc(GUAC_COMMON_CLIPBOARD_MAX_LENGTH);
clipboard->available = GUAC_COMMON_CLIPBOARD_MAX_LENGTH;
clipboard->length = 0;
pthread_mutex_init(&(clipboard->lock), NULL);

View File

@ -32,16 +32,9 @@
#define GUAC_COMMON_CLIPBOARD_BLOCK_SIZE 4096
/**
* The minimum clipboard buffer size in bytes.
* This is the original hardcoded clipboard buffer size.
* The maximum number of bytes to allow within the clipboard.
*/
#define GUAC_COMMON_CLIPBOARD_MIN_LENGTH 262144
/**
* The maximum clipboard buffer size in bytes.
* This should be enough for a raw 4K picture and even more.
*/
#define GUAC_COMMON_CLIPBOARD_MAX_LENGTH 52428800
#define GUAC_COMMON_CLIPBOARD_MAX_LENGTH 262144
/**
* Generic clipboard structure.
@ -79,17 +72,13 @@ typedef struct guac_common_clipboard {
/**
* Creates a new clipboard.
*
* @param buffer_size
* The buffer size in bytes.
*/
guac_common_clipboard* guac_common_clipboard_alloc(int buffer_size);
guac_common_clipboard* guac_common_clipboard_alloc();
/**
* Frees the given clipboard.
*
* @param clipboard
* The clipboard to free.
* @param clipboard The clipboard to free.
*/
void guac_common_clipboard_free(guac_common_clipboard* clipboard);
@ -97,22 +86,16 @@ void guac_common_clipboard_free(guac_common_clipboard* clipboard);
* Sends the contents of the clipboard along the given client, splitting
* the contents as necessary.
*
* @param clipboard
* The clipboard whose contents should be sent.
*
* @param client
* The client to send the clipboard contents on.
* @param clipboard The clipboard whose contents should be sent.
* @param client The client to send the clipboard contents on.
*/
void guac_common_clipboard_send(guac_common_clipboard* clipboard, guac_client* client);
/**
* Clears the clipboard contents and assigns a new mimetype for future data.
*
* @param clipboard
* The clipboard to reset.
*
* @param mimetype
* The mimetype of future data.
* @param clipboard The clipboard to reset.
* @param mimetype The mimetype of future data.
*/
void guac_common_clipboard_reset(guac_common_clipboard* clipboard, const char* mimetype);
@ -121,14 +104,9 @@ void guac_common_clipboard_reset(guac_common_clipboard* clipboard, const char* m
* match the mimetype chosen for the clipboard data by
* guac_common_clipboard_reset().
*
* @param clipboard
* The clipboard to append data to.
*
* @param data
* The data to append.
*
* @param length
* The number of bytes to append from the data given.
* @param clipboard The clipboard to append data to.
* @param data The data to append.
* @param length The number of bytes to append from the data given.
*/
void guac_common_clipboard_append(guac_common_clipboard* clipboard, const char* data, int length);

View File

@ -37,7 +37,6 @@
#include <libgen.h>
#include <netdb.h>
#include <netinet/in.h>
#include <pthread.h>
#include <netinet/tcp.h>
#include <signal.h>
#include <stdio.h>
@ -322,14 +321,6 @@ int main(int argc, char* argv[]) {
/* General */
int retval;
#ifdef HAVE_DECL_PTHREAD_SETATTR_DEFAULT_NP
/* Set default stack size */
pthread_attr_t default_pthread_attr;
pthread_attr_init(&default_pthread_attr);
pthread_attr_setstacksize(&default_pthread_attr, GUACD_THREAD_STACK_SIZE);
pthread_setattr_default_np(&default_pthread_attr);
#endif // HAVE_DECL_PTHREAD_SETATTR_DEFAULT_NP
/* Load configuration */
guacd_config* config = guacd_conf_load();
if (config == NULL || guacd_conf_parse_args(config, argc, argv))

View File

@ -32,11 +32,6 @@
*/
#define GUACD_CLIENT_MAX_CONNECTIONS 65536
/**
* The pthread stack size for the guacd daemon.
*/
#define GUACD_THREAD_STACK_SIZE 8388608
/**
* The number of hash buckets in each process map.
*/

View File

@ -246,7 +246,6 @@ void* guac_kubernetes_client_thread(void* data) {
settings->width, settings->height, settings->resolution);
/* Set optional parameters */
options->clipboard_buffer_size = settings->clipboard_buffer_size;
options->disable_copy = settings->disable_copy;
options->max_scrollback = settings->max_scrollback;
options->font_name = settings->font_name;

View File

@ -56,7 +56,6 @@ const char* GUAC_KUBERNETES_CLIENT_ARGS[] = {
"read-only",
"backspace",
"scrollback",
"clipboard-buffer-size",
"disable-copy",
"disable-paste",
NULL
@ -242,11 +241,6 @@ enum KUBERNETES_ARGS_IDX {
*/
IDX_SCROLLBACK,
/**
* The maximum number of bytes to allow within the clipboard.
*/
IDX_CLIPBOARD_BUFFER_SIZE,
/**
* Whether outbound clipboard access should be blocked. If set to "true",
* it will not be possible to copy data from the terminal to the client
@ -424,27 +418,6 @@ guac_kubernetes_settings* guac_kubernetes_parse_args(guac_user* user,
guac_user_parse_args_int(user, GUAC_KUBERNETES_CLIENT_ARGS, argv,
IDX_BACKSPACE, GUAC_TERMINAL_DEFAULT_BACKSPACE);
/* Set the maximum number of bytes to allow within the clipboard. */
settings->clipboard_buffer_size =
guac_user_parse_args_int(user, GUAC_KUBERNETES_CLIENT_ARGS, argv,
IDX_CLIPBOARD_BUFFER_SIZE, 0);
/* Use default clipboard buffer size if given one is invalid. */
if (settings->clipboard_buffer_size < GUAC_COMMON_CLIPBOARD_MIN_LENGTH) {
settings->clipboard_buffer_size = GUAC_COMMON_CLIPBOARD_MIN_LENGTH;
guac_user_log(user, GUAC_LOG_INFO, "Unspecified or invalid clipboard buffer "
"size: \"%s\". Using the default minimum size: %i.",
argv[IDX_CLIPBOARD_BUFFER_SIZE],
settings->clipboard_buffer_size);
}
else if (settings->clipboard_buffer_size > GUAC_COMMON_CLIPBOARD_MAX_LENGTH) {
settings->clipboard_buffer_size = GUAC_COMMON_CLIPBOARD_MAX_LENGTH;
guac_user_log(user, GUAC_LOG_WARNING, "Invalid clipboard buffer "
"size: \"%s\". Using the default maximum size: %i.",
argv[IDX_CLIPBOARD_BUFFER_SIZE],
settings->clipboard_buffer_size);
}
/* Parse clipboard copy disable flag */
settings->disable_copy =
guac_user_parse_args_boolean(user, GUAC_KUBERNETES_CLIENT_ARGS, argv,

View File

@ -160,11 +160,6 @@ typedef struct guac_kubernetes_settings {
*/
int resolution;
/**
* The maximum number of bytes to allow within the clipboard.
*/
int clipboard_buffer_size;
/**
* Whether outbound clipboard access should be blocked. If set, it will not
* be possible to copy data from the terminal to the client using the

View File

@ -371,9 +371,7 @@ static UINT guac_rdp_cliprdr_format_data_request(CliprdrClientContext* cliprdr,
guac_iconv_write* remote_writer;
const char* input = clipboard->clipboard->buffer;
int output_buf_size = clipboard->clipboard->available;
char* output = guac_mem_alloc(output_buf_size);
char* output = guac_mem_alloc(GUAC_COMMON_CLIPBOARD_MAX_LENGTH);
/* Map requested clipboard format to a guac_iconv writer */
switch (format_data_request->requestedFormatId) {
@ -404,7 +402,7 @@ static UINT guac_rdp_cliprdr_format_data_request(CliprdrClientContext* cliprdr,
BYTE* start = (BYTE*) output;
guac_iconv_read* local_reader = settings->normalize_clipboard ? GUAC_READ_UTF8_NORMALIZED : GUAC_READ_UTF8;
guac_iconv(local_reader, &input, clipboard->clipboard->length,
remote_writer, &output, output_buf_size);
remote_writer, &output, GUAC_COMMON_CLIPBOARD_MAX_LENGTH);
CLIPRDR_FORMAT_DATA_RESPONSE data_response = {
.requestedFormatData = (BYTE*) start,
@ -472,8 +470,7 @@ static UINT guac_rdp_cliprdr_format_data_response(CliprdrClientContext* cliprdr,
return CHANNEL_RC_OK;
}
int output_buf_size = clipboard->clipboard->available;
char* received_data = guac_mem_alloc(output_buf_size);
char received_data[GUAC_COMMON_CLIPBOARD_MAX_LENGTH];
guac_iconv_read* remote_reader;
const char* input = (char*) format_data_response->requestedFormatData;
@ -501,7 +498,6 @@ static UINT guac_rdp_cliprdr_format_data_response(CliprdrClientContext* cliprdr,
default:
guac_client_log(client, GUAC_LOG_DEBUG, "Requested clipboard data "
"in unsupported format (0x%X).", clipboard->requested_format);
guac_mem_free(received_data);
return CHANNEL_RC_OK;
}
@ -516,15 +512,13 @@ static UINT guac_rdp_cliprdr_format_data_response(CliprdrClientContext* cliprdr,
/* Convert, store, and forward the clipboard data received from RDP
* server */
if (guac_iconv(remote_reader, &input, data_len,
GUAC_WRITE_UTF8, &output, output_buf_size)) {
int length = strnlen(received_data, output_buf_size);
GUAC_WRITE_UTF8, &output, sizeof(received_data))) {
int length = strnlen(received_data, sizeof(received_data));
guac_common_clipboard_reset(clipboard->clipboard, "text/plain");
guac_common_clipboard_append(clipboard->clipboard, received_data, length);
guac_common_clipboard_send(clipboard->clipboard, client);
}
guac_mem_free(received_data);
return CHANNEL_RC_OK;
}
@ -624,12 +618,12 @@ static void guac_rdp_cliprdr_channel_disconnected(rdpContext* context,
}
guac_rdp_clipboard* guac_rdp_clipboard_alloc(guac_client* client, int buffer_size) {
guac_rdp_clipboard* guac_rdp_clipboard_alloc(guac_client* client) {
/* Allocate clipboard and underlying storage */
guac_rdp_clipboard* clipboard = guac_mem_zalloc(sizeof(guac_rdp_clipboard));
clipboard->client = client;
clipboard->clipboard = guac_common_clipboard_alloc(buffer_size);
clipboard->clipboard = guac_common_clipboard_alloc();
clipboard->requested_format = CF_TEXT;
return clipboard;

View File

@ -71,14 +71,11 @@ typedef struct guac_rdp_clipboard {
* The guac_client associated with the Guacamole side of the RDP
* connection.
*
* @param buffer_size
* The buffer size in bytes.
*
* @return
* A newly-allocated instance of guac_rdp_clipboard which has been
* initialized for processing Guacamole clipboard data.
*/
guac_rdp_clipboard* guac_rdp_clipboard_alloc(guac_client* client, int buffer_size);
guac_rdp_clipboard* guac_rdp_clipboard_alloc(guac_client* client);
/**
* Initializes clipboard support for RDP and handling of the CLIPRDR channel.

View File

@ -212,6 +212,9 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
rdp_client->input_event_queued = CreateEvent(NULL, TRUE, FALSE, NULL);
/* Init clipboard */
rdp_client->clipboard = guac_rdp_clipboard_alloc(client);
/* Init display update module */
rdp_client->disp = guac_rdp_disp_alloc(client);

View File

@ -140,7 +140,6 @@ const char* GUAC_RDP_CLIENT_ARGS[] = {
"load-balance-info",
"clipboard-buffer-size",
"disable-copy",
"disable-paste",
@ -659,11 +658,6 @@ enum RDP_ARGS_IDX {
* the connection broker, if a connection broker is being used.
*/
IDX_LOAD_BALANCE_INFO,
/**
* The maximum number of bytes to allow within the clipboard.
*/
IDX_CLIPBOARD_BUFFER_SIZE,
/**
* Whether outbound clipboard access should be blocked. If set to "true",
@ -1290,27 +1284,6 @@ guac_rdp_settings* guac_rdp_parse_args(guac_user* user,
guac_user_parse_args_string(user, GUAC_RDP_CLIENT_ARGS, argv,
IDX_LOAD_BALANCE_INFO, NULL);
/* Set the maximum number of bytes to allow within the clipboard. */
settings->clipboard_buffer_size =
guac_user_parse_args_int(user, GUAC_RDP_CLIENT_ARGS, argv,
IDX_CLIPBOARD_BUFFER_SIZE, 0);
/* Use default clipboard buffer size if given one is invalid. */
if (settings->clipboard_buffer_size < GUAC_COMMON_CLIPBOARD_MIN_LENGTH) {
settings->clipboard_buffer_size = GUAC_COMMON_CLIPBOARD_MIN_LENGTH;
guac_user_log(user, GUAC_LOG_INFO, "Unspecified or invalid clipboard buffer "
"size: \"%s\". Using the default minimum size: %i.",
argv[IDX_CLIPBOARD_BUFFER_SIZE],
settings->clipboard_buffer_size);
}
else if (settings->clipboard_buffer_size > GUAC_COMMON_CLIPBOARD_MAX_LENGTH) {
settings->clipboard_buffer_size = GUAC_COMMON_CLIPBOARD_MAX_LENGTH;
guac_user_log(user, GUAC_LOG_WARNING, "Invalid clipboard buffer "
"size: \"%s\". Using the default maximum size: %i.",
argv[IDX_CLIPBOARD_BUFFER_SIZE],
settings->clipboard_buffer_size);
}
/* Parse clipboard copy disable flag */
settings->disable_copy =
guac_user_parse_args_boolean(user, GUAC_RDP_CLIENT_ARGS, argv,

View File

@ -341,11 +341,6 @@ typedef struct guac_rdp_settings {
*/
char** svc_names;
/**
* The maximum number of bytes to allow within the clipboard.
*/
int clipboard_buffer_size;
/**
* Whether outbound clipboard access should be blocked. If set, it will not
* be possible to copy data from the remote desktop to the client using the

View File

@ -67,10 +67,6 @@ int guac_rdp_user_join_handler(guac_user* user, int argc, char** argv) {
/* Store owner's settings at client level */
rdp_client->settings = settings;
/* Init clipboard */
rdp_client->clipboard =
guac_rdp_clipboard_alloc(user->client, settings->clipboard_buffer_size);
/* Start client thread */
if (pthread_create(&rdp_client->client_thread, NULL,
guac_rdp_client_thread, user->client)) {

View File

@ -22,7 +22,6 @@
#include "argv.h"
#include "client.h"
#include "common/defaults.h"
#include "common/clipboard.h"
#include "settings.h"
#include "terminal/terminal.h"
@ -74,7 +73,6 @@ const char* GUAC_SSH_CLIENT_ARGS[] = {
"scrollback",
"locale",
"timezone",
"clipboard-buffer-size",
"disable-copy",
"disable-paste",
"wol-send-packet",
@ -312,11 +310,6 @@ enum SSH_ARGS_IDX {
*/
IDX_TIMEZONE,
/**
* The maximum number of bytes to allow within the clipboard.
*/
IDX_CLIPBOARD_BUFFER_SIZE,
/**
* Whether outbound clipboard access should be blocked. If set to "true",
* it will not be possible to copy data from the terminal to the client
@ -562,27 +555,6 @@ guac_ssh_settings* guac_ssh_parse_args(guac_user* user,
guac_user_parse_args_string(user, GUAC_SSH_CLIENT_ARGS, argv,
IDX_TIMEZONE, user->info.timezone);
/* Set the maximum number of bytes to allow within the clipboard. */
settings->clipboard_buffer_size =
guac_user_parse_args_int(user, GUAC_SSH_CLIENT_ARGS, argv,
IDX_CLIPBOARD_BUFFER_SIZE, 0);
/* Use default clipboard buffer size if given one is invalid. */
if (settings->clipboard_buffer_size < GUAC_COMMON_CLIPBOARD_MIN_LENGTH) {
settings->clipboard_buffer_size = GUAC_COMMON_CLIPBOARD_MIN_LENGTH;
guac_user_log(user, GUAC_LOG_INFO, "Unspecified or invalid clipboard buffer "
"size: \"%s\". Using the default minimum size: %i.",
argv[IDX_CLIPBOARD_BUFFER_SIZE],
settings->clipboard_buffer_size);
}
else if (settings->clipboard_buffer_size > GUAC_COMMON_CLIPBOARD_MAX_LENGTH) {
settings->clipboard_buffer_size = GUAC_COMMON_CLIPBOARD_MAX_LENGTH;
guac_user_log(user, GUAC_LOG_WARNING, "Invalid clipboard buffer "
"size: \"%s\". Using the default maximum size: %i.",
argv[IDX_CLIPBOARD_BUFFER_SIZE],
settings->clipboard_buffer_size);
}
/* Parse clipboard copy disable flag */
settings->disable_copy =
guac_user_parse_args_boolean(user, GUAC_SSH_CLIENT_ARGS, argv,

View File

@ -157,11 +157,6 @@ typedef struct guac_ssh_settings {
*/
int resolution;
/**
* The maximum number of bytes to allow within the clipboard.
*/
int clipboard_buffer_size;
/**
* Whether outbound clipboard access should be blocked. If set, it will not
* be possible to copy data from the terminal to the client using the

View File

@ -294,7 +294,6 @@ void* ssh_client_thread(void* data) {
settings->width, settings->height, settings->resolution);
/* Set optional parameters */
options->clipboard_buffer_size = settings->clipboard_buffer_size;
options->disable_copy = settings->disable_copy;
options->max_scrollback = settings->max_scrollback;
options->font_name = settings->font_name;

View File

@ -21,7 +21,6 @@
#include "argv.h"
#include "common/defaults.h"
#include "common/clipboard.h"
#include "settings.h"
#include "terminal/terminal.h"
@ -64,7 +63,6 @@ const char* GUAC_TELNET_CLIENT_ARGS[] = {
"scrollback",
"login-success-regex",
"login-failure-regex",
"clipboard-buffer-size",
"disable-copy",
"disable-paste",
"wol-send-packet",
@ -250,11 +248,6 @@ enum TELNET_ARGS_IDX {
*/
IDX_LOGIN_FAILURE_REGEX,
/**
* The maximum number of bytes to allow within the clipboard.
*/
IDX_CLIPBOARD_BUFFER_SIZE,
/**
* Whether outbound clipboard access should be blocked. If set to "true",
* it will not be possible to copy data from the terminal to the client
@ -527,27 +520,6 @@ guac_telnet_settings* guac_telnet_parse_args(guac_user* user,
guac_user_parse_args_string(user, GUAC_TELNET_CLIENT_ARGS, argv,
IDX_TERMINAL_TYPE, "linux");
/* Set the maximum number of bytes to allow within the clipboard. */
settings->clipboard_buffer_size =
guac_user_parse_args_int(user, GUAC_TELNET_CLIENT_ARGS, argv,
IDX_CLIPBOARD_BUFFER_SIZE, 0);
/* Use default clipboard buffer size if given one is invalid. */
if (settings->clipboard_buffer_size < GUAC_COMMON_CLIPBOARD_MIN_LENGTH) {
settings->clipboard_buffer_size = GUAC_COMMON_CLIPBOARD_MIN_LENGTH;
guac_user_log(user, GUAC_LOG_INFO, "Unspecified or invalid clipboard buffer "
"size: \"%s\". Using the default minimum size: %i.",
argv[IDX_CLIPBOARD_BUFFER_SIZE],
settings->clipboard_buffer_size);
}
else if (settings->clipboard_buffer_size > GUAC_COMMON_CLIPBOARD_MAX_LENGTH) {
settings->clipboard_buffer_size = GUAC_COMMON_CLIPBOARD_MAX_LENGTH;
guac_user_log(user, GUAC_LOG_WARNING, "Invalid clipboard buffer "
"size: \"%s\". Using the default maximum size: %i.",
argv[IDX_CLIPBOARD_BUFFER_SIZE],
settings->clipboard_buffer_size);
}
/* Parse clipboard copy disable flag */
settings->disable_copy =
guac_user_parse_args_boolean(user, GUAC_TELNET_CLIENT_ARGS, argv,

View File

@ -165,11 +165,6 @@ typedef struct guac_telnet_settings {
*/
int resolution;
/**
* The maximum number of bytes to allow within the clipboard.
*/
int clipboard_buffer_size;
/**
* Whether outbound clipboard access should be blocked. If set, it will not
* be possible to copy data from the terminal to the client using the

View File

@ -545,7 +545,6 @@ void* guac_telnet_client_thread(void* data) {
settings->width, settings->height, settings->resolution);
/* Set optional parameters */
options->clipboard_buffer_size = settings->clipboard_buffer_size;
options->disable_copy = settings->disable_copy;
options->max_scrollback = settings->max_scrollback;
options->font_name = settings->font_name;

View File

@ -115,6 +115,9 @@ int guac_client_init(guac_client* client) {
/* Initialize the message lock. */
pthread_mutex_init(&(vnc_client->message_lock), NULL);
/* Init clipboard */
vnc_client->clipboard = guac_common_clipboard_alloc();
/* Set handlers */
client->join_handler = guac_vnc_user_join_handler;
client->join_pending_handler = guac_vnc_join_pending_handler;

View File

@ -77,16 +77,9 @@ int guac_vnc_set_clipboard_encoding(guac_client* client,
int guac_vnc_clipboard_handler(guac_user* user, guac_stream* stream,
char* mimetype) {
guac_vnc_client* vnc_client = (guac_vnc_client*) user->client->data;
/* Ignore stream creation if no clipboard structure is available to handle
* received data */
guac_common_clipboard* clipboard = vnc_client->clipboard;
if (clipboard == NULL)
return 0;
/* Clear clipboard and prepare for new data */
guac_common_clipboard_reset(clipboard, mimetype);
guac_vnc_client* vnc_client = (guac_vnc_client*) user->client->data;
guac_common_clipboard_reset(vnc_client->clipboard, mimetype);
/* Set handlers for clipboard stream */
stream->blob_handler = guac_vnc_clipboard_blob_handler;
@ -97,17 +90,10 @@ int guac_vnc_clipboard_handler(guac_user* user, guac_stream* stream,
int guac_vnc_clipboard_blob_handler(guac_user* user, guac_stream* stream,
void* data, int length) {
guac_vnc_client* vnc_client = (guac_vnc_client*) user->client->data;
/* Ignore received data if no clipboard structure is available to handle
* that data */
guac_common_clipboard* clipboard = vnc_client->clipboard;
if (clipboard == NULL)
return 0;
/* Append new data */
guac_common_clipboard_append(clipboard, (char*) data, length);
guac_vnc_client* vnc_client = (guac_vnc_client*) user->client->data;
guac_common_clipboard_append(vnc_client->clipboard, (char*) data, length);
return 0;
}
@ -115,32 +101,22 @@ int guac_vnc_clipboard_blob_handler(guac_user* user, guac_stream* stream,
int guac_vnc_clipboard_end_handler(guac_user* user, guac_stream* stream) {
guac_vnc_client* vnc_client = (guac_vnc_client*) user->client->data;
/* Ignore end of stream if no clipboard structure is available to handle
* the data that was received */
guac_common_clipboard* clipboard = vnc_client->clipboard;
if (clipboard == NULL)
return 0;
rfbClient* rfb_client = vnc_client->rfb_client;
int output_buf_size = clipboard->available;
char* output_data = guac_mem_alloc(output_buf_size);
char output_data[GUAC_COMMON_CLIPBOARD_MAX_LENGTH];
const char* input = clipboard->buffer;
const char* input = vnc_client->clipboard->buffer;
char* output = output_data;
guac_iconv_write* writer = vnc_client->clipboard_writer;
/* Convert clipboard contents */
guac_iconv(GUAC_READ_UTF8, &input, clipboard->length,
writer, &output, output_buf_size);
guac_iconv(GUAC_READ_UTF8, &input, vnc_client->clipboard->length,
writer, &output, sizeof(output_data));
/* Send via VNC only if finished connecting */
if (rfb_client != NULL)
SendClientCutText(rfb_client, output_data, output - output_data);
guac_mem_free(output_data);
return 0;
}
@ -153,8 +129,7 @@ void guac_vnc_cut_text(rfbClient* client, const char* text, int textlen) {
if (vnc_client->settings->disable_copy)
return;
int output_buf_size = vnc_client->clipboard->available;
char* received_data = guac_mem_alloc(output_buf_size);
char received_data[GUAC_COMMON_CLIPBOARD_MAX_LENGTH];
const char* input = text;
char* output = received_data;
@ -162,13 +137,12 @@ void guac_vnc_cut_text(rfbClient* client, const char* text, int textlen) {
/* Convert clipboard contents */
guac_iconv(reader, &input, textlen,
GUAC_WRITE_UTF8, &output, output_buf_size);
GUAC_WRITE_UTF8, &output, sizeof(received_data));
/* Send converted data */
guac_common_clipboard_reset(vnc_client->clipboard, "text/plain");
guac_common_clipboard_append(vnc_client->clipboard, received_data, output - received_data);
guac_common_clipboard_send(vnc_client->clipboard, gc);
guac_mem_free(received_data);
}

View File

@ -22,7 +22,6 @@
#include "argv.h"
#include "client.h"
#include "common/defaults.h"
#include "common/clipboard.h"
#include "settings.h"
#include <guacamole/mem.h>
@ -89,7 +88,6 @@ const char* GUAC_VNC_CLIENT_ARGS[] = {
"recording-include-keys",
"create-recording-path",
"recording-write-existing",
"clipboard-buffer-size",
"disable-copy",
"disable-paste",
"disable-server-input",
@ -365,11 +363,6 @@ enum VNC_ARGS_IDX {
*/
IDX_RECORDING_WRITE_EXISTING,
/**
* The maximum number of bytes to allow within the clipboard.
*/
IDX_CLIPBOARD_BUFFER_SIZE,
/**
* Whether outbound clipboard access should be blocked. If set to "true",
* it will not be possible to copy data from the remote desktop to the
@ -691,27 +684,6 @@ guac_vnc_settings* guac_vnc_parse_args(guac_user* user,
guac_user_parse_args_boolean(user, GUAC_VNC_CLIENT_ARGS, argv,
IDX_DISABLE_COPY, false);
/* Set the maximum number of bytes to allow within the clipboard. */
settings->clipboard_buffer_size =
guac_user_parse_args_int(user, GUAC_VNC_CLIENT_ARGS, argv,
IDX_CLIPBOARD_BUFFER_SIZE, 0);
/* Use default clipboard buffer size if given one is invalid. */
if (settings->clipboard_buffer_size < GUAC_COMMON_CLIPBOARD_MIN_LENGTH) {
settings->clipboard_buffer_size = GUAC_COMMON_CLIPBOARD_MIN_LENGTH;
guac_user_log(user, GUAC_LOG_INFO, "Unspecified or invalid clipboard buffer "
"size: \"%s\". Using the default minimum size: %i.",
argv[IDX_CLIPBOARD_BUFFER_SIZE],
settings->clipboard_buffer_size);
}
else if (settings->clipboard_buffer_size > GUAC_COMMON_CLIPBOARD_MAX_LENGTH) {
settings->clipboard_buffer_size = GUAC_COMMON_CLIPBOARD_MAX_LENGTH;
guac_user_log(user, GUAC_LOG_WARNING, "Invalid clipboard buffer "
"size: \"%s\". Using the default maximum size: %i.",
argv[IDX_CLIPBOARD_BUFFER_SIZE],
settings->clipboard_buffer_size);
}
/* Parse clipboard paste disable flag */
settings->disable_paste =
guac_user_parse_args_boolean(user, GUAC_VNC_CLIENT_ARGS, argv,

View File

@ -157,11 +157,6 @@ typedef struct guac_vnc_settings {
* to use the encoding required by the VNC standard.
*/
char* clipboard_encoding;
/**
* The maximum number of bytes to allow within the clipboard.
*/
int clipboard_buffer_size;
/**
* Whether outbound clipboard access should be blocked. If set, it will not

View File

@ -64,10 +64,6 @@ int guac_vnc_user_join_handler(guac_user* user, int argc, char** argv) {
/* Store owner's settings at client level */
vnc_client->settings = settings;
/* Init clipboard. */
vnc_client->clipboard =
guac_common_clipboard_alloc(settings->clipboard_buffer_size);
/* Start client thread */
if (pthread_create(&vnc_client->client_thread, NULL, guac_vnc_client_thread, user->client)) {
guac_user_log(user, GUAC_LOG_ERROR, "Unable to start VNC client thread.");

View File

@ -242,7 +242,6 @@ guac_terminal_options* guac_terminal_options_create(
options->dpi = dpi;
/* Set default values for all other parameters */
options->clipboard_buffer_size = GUAC_COMMON_CLIPBOARD_MIN_LENGTH;
options->disable_copy = GUAC_TERMINAL_DEFAULT_DISABLE_COPY;
options->max_scrollback = GUAC_TERMINAL_DEFAULT_MAX_SCROLLBACK;
options->font_name = GUAC_TERMINAL_DEFAULT_FONT_NAME;
@ -420,7 +419,7 @@ guac_terminal* guac_terminal_create(guac_client* client,
/* Init terminal state */
term->current_attributes = default_char.attributes;
term->default_char = default_char;
term->clipboard = guac_common_clipboard_alloc(options->clipboard_buffer_size);
term->clipboard = guac_common_clipboard_alloc();
term->disable_copy = options->disable_copy;
/* Calculate available text display area by character size */
@ -2203,17 +2202,14 @@ void guac_terminal_clipboard_append(guac_terminal* terminal,
const char* data, int length) {
/* Allocate and clear space for the converted data */
int output_buf_size = terminal->clipboard->available;
char* output_data = guac_mem_alloc(output_buf_size);
char output_data[GUAC_COMMON_CLIPBOARD_MAX_LENGTH];
char* output = output_data;
/* Convert clipboard contents */
guac_iconv(GUAC_READ_UTF8_NORMALIZED, &data, length,
GUAC_WRITE_UTF8, &output, output_buf_size);
GUAC_WRITE_UTF8, &output, GUAC_COMMON_CLIPBOARD_MAX_LENGTH);
guac_common_clipboard_append(terminal->clipboard, output_data, output - output_data);
guac_mem_free(output_data);
}
void guac_terminal_remove_user(guac_terminal* terminal, guac_user* user) {

View File

@ -180,11 +180,6 @@ typedef guac_stream* guac_terminal_file_download_handler(guac_client* client, ch
*/
typedef struct guac_terminal_options {
/**
* The maximum number of bytes to allow within the clipboard.
*/
int clipboard_buffer_size;
/**
* Whether copying from the terminal clipboard should be blocked. If set,
* the contents of the terminal can still be copied, but will be usable