You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by mj...@apache.org on 2016/03/20 03:24:31 UTC
[01/50] incubator-guacamole-server git commit: GUAC-236: Document
transfer as currently unimplemented (rarely used).
Repository: incubator-guacamole-server
Updated Branches:
refs/heads/master [created] f97a681f1
GUAC-236: Document transfer as currently unimplemented (rarely used).
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/2798536a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/2798536a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/2798536a
Branch: refs/heads/master
Commit: 2798536a7afe09deac5d92f917cb6391001b6b59
Parents: be0a9e7
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Sat Mar 12 19:56:30 2016 -0800
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Mon Mar 14 20:22:03 2016 -0700
----------------------------------------------------------------------
src/guacenc/instruction-transfer.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/2798536a/src/guacenc/instruction-transfer.c
----------------------------------------------------------------------
diff --git a/src/guacenc/instruction-transfer.c b/src/guacenc/instruction-transfer.c
index 3643404..c2508f6 100644
--- a/src/guacenc/instruction-transfer.c
+++ b/src/guacenc/instruction-transfer.c
@@ -47,10 +47,11 @@ int guacenc_handle_transfer(guacenc_display* display, int argc, char** argv) {
int dst_x = atoi(argv[7]);
int dst_y = atoi(argv[8]);
- /* STUB */
+ /* TODO: Unimplemented for now (rarely used) */
guacenc_log(GUAC_LOG_DEBUG, "transform: src_layer=%i (%i, %i) %ix%i "
"function=0x%X dst_layer=%i (%i, %i)", src_index, src_x, src_y,
src_w, src_h, function, dst_index, dst_x, dst_y);
+
return 0;
}
[19/50] incubator-guacamole-server git commit: GUAC-1164:
Automatically reconnect when display size changes.
Posted by mj...@apache.org.
GUAC-1164: Automatically reconnect when display size changes.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/fc40e9f1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/fc40e9f1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/fc40e9f1
Branch: refs/heads/master
Commit: fc40e9f14cc3fbd89497000fd45d8332a391676f
Parents: f5f77fe
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Tue Mar 15 21:23:19 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Tue Mar 15 21:48:56 2016 -0700
----------------------------------------------------------------------
src/protocols/rdp/client.c | 57 +++------------------
src/protocols/rdp/input.c | 51 ++++++++++---------
src/protocols/rdp/rdp.c | 102 +++++++++++++++++++++++++++++---------
src/protocols/rdp/rdp.h | 11 ++--
src/protocols/rdp/rdp_disp.c | 74 +++++++++++++++++----------
src/protocols/rdp/rdp_disp.h | 84 ++++++++++++++++++++++++-------
6 files changed, 231 insertions(+), 148 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/fc40e9f1/src/protocols/rdp/client.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/client.c b/src/protocols/rdp/client.c
index 940635f..4efb695 100644
--- a/src/protocols/rdp/client.c
+++ b/src/protocols/rdp/client.c
@@ -24,6 +24,7 @@
#include "client.h"
#include "rdp.h"
+#include "rdp_disp.h"
#include "rdp_keymap.h"
#include "user.h"
@@ -33,10 +34,6 @@
#include <guac_ssh_user.h>
#endif
-#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
-#include "rdp_disp.h"
-#endif
-
#include <freerdp/cache/cache.h>
#include <freerdp/channels/channels.h>
#include <freerdp/freerdp.h>
@@ -66,10 +63,11 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
guac_rdp_client* rdp_client = calloc(1, sizeof(guac_rdp_client));
client->data = rdp_client;
- /* Init clipboard and shared mouse */
+ /* Init clipboard */
rdp_client->clipboard = guac_common_clipboard_alloc(GUAC_RDP_CLIPBOARD_MAX_LENGTH);
- rdp_client->requested_clipboard_format = CB_FORMAT_TEXT;
- rdp_client->available_svc = guac_common_list_alloc();
+
+ /* Init display update module */
+ rdp_client->disp = guac_rdp_disp_alloc();
/* Recursive attribute for locks */
pthread_mutexattr_init(&(rdp_client->attributes));
@@ -98,54 +96,15 @@ int guac_rdp_client_free_handler(guac_client* client) {
/* Wait for client thread */
pthread_join(rdp_client->client_thread, NULL);
- freerdp* rdp_inst = rdp_client->rdp_inst;
- if (rdp_inst != NULL) {
- rdpChannels* channels = rdp_inst->context->channels;
-
- /* Clean up RDP client */
- freerdp_channels_close(channels, rdp_inst);
- freerdp_channels_free(channels);
- freerdp_disconnect(rdp_inst);
- freerdp_clrconv_free(((rdp_freerdp_context*) rdp_inst->context)->clrconv);
- cache_free(rdp_inst->context->cache);
- freerdp_free(rdp_inst);
- }
-
- /* Clean up filesystem, if allocated */
- if (rdp_client->filesystem != NULL)
- guac_rdp_fs_free(rdp_client->filesystem);
-
-#ifdef ENABLE_COMMON_SSH
- /* Free SFTP filesystem, if loaded */
- if (rdp_client->sftp_filesystem)
- guac_common_ssh_destroy_sftp_filesystem(rdp_client->sftp_filesystem);
-
- /* Free SFTP session */
- if (rdp_client->sftp_session)
- guac_common_ssh_destroy_session(rdp_client->sftp_session);
-
- /* Free SFTP user */
- if (rdp_client->sftp_user)
- guac_common_ssh_destroy_user(rdp_client->sftp_user);
-
- guac_common_ssh_uninit();
-#endif
-
-#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
- /* Free display update module */
- guac_rdp_disp_free(rdp_client->disp);
-#endif
-
- /* Free SVC list */
- guac_common_list_free(rdp_client->available_svc);
-
/* Free parsed settings */
if (rdp_client->settings != NULL)
guac_rdp_settings_free(rdp_client->settings);
+ /* Free display update module */
+ guac_rdp_disp_free(rdp_client->disp);
+
/* Free client data */
guac_common_clipboard_free(rdp_client->clipboard);
- guac_common_display_free(rdp_client->display);
free(rdp_client);
return 0;
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/fc40e9f1/src/protocols/rdp/input.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/input.c b/src/protocols/rdp/input.c
index e87440a..8a8cbaf 100644
--- a/src/protocols/rdp/input.c
+++ b/src/protocols/rdp/input.c
@@ -25,27 +25,19 @@
#include "client.h"
#include "input.h"
#include "rdp.h"
+#include "rdp_disp.h"
#include "rdp_keymap.h"
#include <freerdp/freerdp.h>
#include <freerdp/input.h>
#include <guacamole/client.h>
-#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
-#include "rdp_disp.h"
-#endif
-
#include <pthread.h>
#include <stdlib.h>
int guac_rdp_send_keysym(guac_client* client, int keysym, int pressed) {
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
- freerdp* rdp_inst = rdp_client->rdp_inst;
-
- /* Skip if not yet connected */
- if (rdp_inst == NULL)
- return 0;
/* If keysym can be in lookup table */
if (GUAC_RDP_KEYSYM_STORABLE(keysym)) {
@@ -75,6 +67,13 @@ int guac_rdp_send_keysym(guac_client* client, int keysym, int pressed) {
else
pressed_flags = KBD_FLAGS_RELEASE;
+ /* Skip if not yet connected */
+ freerdp* rdp_inst = rdp_client->rdp_inst;
+ if (rdp_inst == NULL) {
+ pthread_mutex_unlock(&(rdp_client->rdp_lock));
+ return 0;
+ }
+
/* Send actual key */
rdp_inst->input->KeyboardEvent(rdp_inst->input, keysym_desc->flags | pressed_flags,
keysym_desc->scancode);
@@ -118,6 +117,13 @@ int guac_rdp_send_keysym(guac_client* client, int keysym, int pressed) {
pthread_mutex_lock(&(rdp_client->rdp_lock));
+ /* Skip if not yet connected */
+ freerdp* rdp_inst = rdp_client->rdp_inst;
+ if (rdp_inst == NULL) {
+ pthread_mutex_unlock(&(rdp_client->rdp_lock));
+ return 0;
+ }
+
/* Send Unicode event */
rdp_inst->input->UnicodeKeyboardEvent(
rdp_inst->input,
@@ -156,16 +162,18 @@ int guac_rdp_user_mouse_handler(guac_user* user, int x, int y, int mask) {
guac_client* client = user->client;
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
- freerdp* rdp_inst = rdp_client->rdp_inst;
+
+ pthread_mutex_lock(&(rdp_client->rdp_lock));
/* Store current mouse location */
guac_common_cursor_move(rdp_client->display->cursor, user, x, y);
/* Skip if not yet connected */
- if (rdp_inst == NULL)
+ freerdp* rdp_inst = rdp_client->rdp_inst;
+ if (rdp_inst == NULL) {
+ pthread_mutex_unlock(&(rdp_client->rdp_lock));
return 0;
-
- pthread_mutex_lock(&(rdp_client->rdp_lock));
+ }
/* If button mask unchanged, just send move event */
if (mask == rdp_client->mouse_button_mask)
@@ -251,28 +259,19 @@ int guac_rdp_user_key_handler(guac_user* user, int keysym, int pressed) {
int guac_rdp_user_size_handler(guac_user* user, int width, int height) {
-#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
guac_client* client = user->client;
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
-
+ guac_rdp_settings* settings = rdp_client->settings;
freerdp* rdp_inst = rdp_client->rdp_inst;
- /* Skip if not yet connected */
- if (rdp_inst == NULL)
- return 0;
-
/* Convert client pixels to remote pixels */
- width = width * rdp_client->settings->resolution
- / user->info.optimal_resolution;
-
- height = height * rdp_client->settings->resolution
- / user->info.optimal_resolution;
+ width = width * settings->resolution / user->info.optimal_resolution;
+ height = height * settings->resolution / user->info.optimal_resolution;
/* Send display update */
pthread_mutex_lock(&(rdp_client->rdp_lock));
- guac_rdp_disp_set_size(rdp_client->disp, rdp_inst->context, width, height);
+ guac_rdp_disp_set_size(rdp_client->disp, settings, rdp_inst, width, height);
pthread_mutex_unlock(&(rdp_client->rdp_lock));
-#endif
return 0;
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/fc40e9f1/src/protocols/rdp/rdp.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp.c b/src/protocols/rdp/rdp.c
index 9dea54b..a19e55b 100644
--- a/src/protocols/rdp/rdp.c
+++ b/src/protocols/rdp/rdp.c
@@ -29,6 +29,7 @@
#include "rdp.h"
#include "rdp_bitmap.h"
#include "rdp_cliprdr.h"
+#include "rdp_disp.h"
#include "rdp_gdi.h"
#include "rdp_glyph.h"
#include "rdp_keymap.h"
@@ -43,10 +44,6 @@
#include <guac_ssh_user.h>
#endif
-#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
-#include "rdp_disp.h"
-#endif
-
#include <freerdp/cache/bitmap.h>
#include <freerdp/cache/brush.h>
#include <freerdp/cache/glyph.h>
@@ -183,8 +180,8 @@ static void guac_rdp_channel_connected(rdpContext* context,
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
/* Init module with current display size */
- guac_rdp_disp_set_size(rdp_client->disp, context,
- guac_rdp_get_width(context->instance),
+ guac_rdp_disp_set_size(rdp_client->disp, rdp_client->settings,
+ context->instance, guac_rdp_get_width(context->instance),
guac_rdp_get_height(context->instance));
/* Store connected channel */
@@ -223,17 +220,14 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) {
(pChannelConnectedEventHandler) guac_rdp_channel_connected);
#endif
-#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
/* Load virtual channel management plugin */
if (freerdp_channels_load_plugin(channels, instance->settings,
"drdynvc", instance->settings))
guac_client_log(client, GUAC_LOG_WARNING,
"Failed to load drdynvc plugin.");
- /* Init display update plugin */
- rdp_client->disp = guac_rdp_disp_alloc();
+ /* Init display update plugin (if available) */
guac_rdp_disp_load_plugin(instance->context);
-#endif
/* Load clipboard plugin */
if (freerdp_channels_load_plugin(channels, instance->settings,
@@ -691,9 +685,8 @@ static int rdp_guac_client_wait_for_messages(guac_client* client,
}
-void* guac_rdp_client_thread(void* data) {
+static int guac_rdp_handle_connection(guac_client* client) {
- guac_client* client = (guac_client*) data;
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
guac_rdp_settings* settings = rdp_client->settings;
@@ -715,6 +708,9 @@ void* guac_rdp_client_thread(void* data) {
rdp_client->current_surface = rdp_client->display->default_surface;
+ rdp_client->requested_clipboard_format = CB_FORMAT_TEXT;
+ rdp_client->available_svc = guac_common_list_alloc();
+
#ifdef HAVE_FREERDP_CHANNELS_GLOBAL_INIT
freerdp_channels_global_init();
#endif
@@ -750,7 +746,7 @@ void* guac_rdp_client_thread(void* data) {
/* Abort if username is missing */
if (settings->sftp_username == NULL)
- return NULL;
+ return 1;
guac_client_log(client, GUAC_LOG_DEBUG,
"Connecting via SSH for SFTP filesystem access.");
@@ -769,7 +765,7 @@ void* guac_rdp_client_thread(void* data) {
settings->sftp_private_key,
settings->sftp_passphrase)) {
guac_common_ssh_destroy_user(rdp_client->sftp_user);
- return NULL;
+ return 1;
}
}
@@ -794,7 +790,7 @@ void* guac_rdp_client_thread(void* data) {
if (rdp_client->sftp_session == NULL) {
/* Already aborted within guac_common_ssh_create_session() */
guac_common_ssh_destroy_user(rdp_client->sftp_user);
- return NULL;
+ return 1;
}
/* Load and expose filesystem */
@@ -811,7 +807,7 @@ void* guac_rdp_client_thread(void* data) {
if (rdp_client->sftp_filesystem == NULL) {
guac_common_ssh_destroy_session(rdp_client->sftp_session);
guac_common_ssh_destroy_user(rdp_client->sftp_user);
- return NULL;
+ return 1;
}
guac_client_log(client, GUAC_LOG_DEBUG,
@@ -833,7 +829,7 @@ void* guac_rdp_client_thread(void* data) {
if (!freerdp_connect(rdp_inst)) {
guac_client_abort(client, GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR,
"Error connecting to RDP server");
- return NULL;
+ return 1;
}
/* Connection complete */
@@ -842,15 +838,17 @@ void* guac_rdp_client_thread(void* data) {
guac_timestamp last_frame_end = guac_timestamp_current();
+ /* Signal that reconnect has been completed */
+ guac_rdp_disp_reconnect_complete(rdp_client->disp);
+
/* Handle messages from RDP server while client is running */
- while (client->state == GUAC_CLIENT_RUNNING) {
+ while (client->state == GUAC_CLIENT_RUNNING
+ && !guac_rdp_disp_reconnect_needed(rdp_client->disp)) {
-#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
/* Update remote display size */
pthread_mutex_lock(&(rdp_client->rdp_lock));
- guac_rdp_disp_update_size(rdp_client->disp, rdp_inst->context);
+ guac_rdp_disp_update_size(rdp_client->disp, settings, rdp_inst);
pthread_mutex_unlock(&(rdp_client->rdp_lock));
-#endif
/* Wait for data and construct a reasonable frame */
int wait_result = rdp_guac_client_wait_for_messages(client,
@@ -873,7 +871,7 @@ void* guac_rdp_client_thread(void* data) {
guac_client_log(client, GUAC_LOG_DEBUG,
"Error handling RDP file descriptors");
pthread_mutex_unlock(&(rdp_client->rdp_lock));
- return NULL;
+ return 1;
}
/* Check channel fds */
@@ -881,7 +879,7 @@ void* guac_rdp_client_thread(void* data) {
guac_client_log(client, GUAC_LOG_DEBUG,
"Error handling RDP channel file descriptors");
pthread_mutex_unlock(&(rdp_client->rdp_lock));
- return NULL;
+ return 1;
}
/* Check for channel events */
@@ -910,7 +908,7 @@ void* guac_rdp_client_thread(void* data) {
guac_client_log(client, GUAC_LOG_INFO,
"RDP server closed connection");
pthread_mutex_unlock(&(rdp_client->rdp_lock));
- return NULL;
+ return 1;
}
pthread_mutex_unlock(&(rdp_client->rdp_lock));
@@ -955,6 +953,62 @@ void* guac_rdp_client_thread(void* data) {
}
guac_client_log(client, GUAC_LOG_INFO, "Internal RDP client disconnected");
+
+ pthread_mutex_lock(&(rdp_client->rdp_lock));
+
+ /* Clean up RDP client */
+ freerdp_channels_close(channels, rdp_inst);
+ freerdp_channels_free(channels);
+ freerdp_disconnect(rdp_inst);
+ freerdp_clrconv_free(((rdp_freerdp_context*) rdp_inst->context)->clrconv);
+ cache_free(rdp_inst->context->cache);
+ freerdp_free(rdp_inst);
+
+ /* Clean up filesystem, if allocated */
+ if (rdp_client->filesystem != NULL)
+ guac_rdp_fs_free(rdp_client->filesystem);
+
+#ifdef ENABLE_COMMON_SSH
+ /* Free SFTP filesystem, if loaded */
+ if (rdp_client->sftp_filesystem)
+ guac_common_ssh_destroy_sftp_filesystem(rdp_client->sftp_filesystem);
+
+ /* Free SFTP session */
+ if (rdp_client->sftp_session)
+ guac_common_ssh_destroy_session(rdp_client->sftp_session);
+
+ /* Free SFTP user */
+ if (rdp_client->sftp_user)
+ guac_common_ssh_destroy_user(rdp_client->sftp_user);
+
+ guac_common_ssh_uninit();
+#endif
+
+ /* Free SVC list */
+ guac_common_list_free(rdp_client->available_svc);
+
+ /* Free display */
+ guac_common_display_free(rdp_client->display);
+
+ /* Mark FreeRDP instance as freed */
+ rdp_client->rdp_inst = NULL;
+
+ pthread_mutex_unlock(&(rdp_client->rdp_lock));
+ return 0;
+
+}
+
+void* guac_rdp_client_thread(void* data) {
+
+ guac_client* client = (guac_client*) data;
+
+ while (client->state == GUAC_CLIENT_RUNNING) {
+
+ if (guac_rdp_handle_connection(client))
+ return NULL;
+
+ }
+
return NULL;
}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/fc40e9f1/src/protocols/rdp/rdp.h
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp.h b/src/protocols/rdp/rdp.h
index b648216..fac0435 100644
--- a/src/protocols/rdp/rdp.h
+++ b/src/protocols/rdp/rdp.h
@@ -29,6 +29,7 @@
#include "guac_display.h"
#include "guac_surface.h"
#include "guac_list.h"
+#include "rdp_disp.h"
#include "rdp_fs.h"
#include "rdp_keymap.h"
#include "rdp_settings.h"
@@ -44,10 +45,6 @@
#include "guac_ssh_user.h"
#endif
-#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
-#include "rdp_disp.h"
-#endif
-
#include <pthread.h>
#include <stdint.h>
@@ -148,12 +145,10 @@ typedef struct guac_rdp_client {
guac_common_ssh_sftp_filesystem* sftp_filesystem;
#endif
-#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
/**
* Display size update module.
*/
guac_rdp_disp* disp;
-#endif
/**
* List of all available static virtual channels.
@@ -161,7 +156,9 @@ typedef struct guac_rdp_client {
guac_common_list* available_svc;
/**
- * Lock which is locked and unlocked for each RDP message.
+ * Lock which is locked and unlocked for each RDP message, and for each
+ * part of the RDP client instance which may be dynamically freed and
+ * reallocated during reconnection.
*/
pthread_mutex_t rdp_lock;
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/fc40e9f1/src/protocols/rdp/rdp_disp.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp_disp.c b/src/protocols/rdp/rdp_disp.c
index a94d594..ea65289 100644
--- a/src/protocols/rdp/rdp_disp.c
+++ b/src/protocols/rdp/rdp_disp.c
@@ -24,6 +24,7 @@
#include "client.h"
#include "rdp.h"
#include "rdp_disp.h"
+#include "rdp_settings.h"
#include <freerdp/freerdp.h>
#include <freerdp/client/disp.h>
@@ -41,6 +42,7 @@ guac_rdp_disp* guac_rdp_disp_alloc() {
disp->last_request = 0;
disp->requested_width = 0;
disp->requested_height = 0;
+ disp->reconnect_needed = 0;
return disp;
@@ -52,6 +54,7 @@ void guac_rdp_disp_free(guac_rdp_disp* disp) {
void guac_rdp_disp_load_plugin(rdpContext* context) {
+#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
#ifdef HAVE_RDPSETTINGS_SUPPORTDISPLAYCONTROL
context->settings->SupportDisplayControl = TRUE;
#endif
@@ -62,6 +65,7 @@ void guac_rdp_disp_load_plugin(rdpContext* context) {
args->argv = malloc(sizeof(char**) * 1);
args->argv[0] = strdup("disp");
freerdp_dynamic_channel_collection_add(context->settings, args);
+#endif
}
@@ -111,8 +115,8 @@ static void guac_rdp_disp_fit(int* a, int* b) {
}
-void guac_rdp_disp_set_size(guac_rdp_disp* disp, rdpContext* context,
- int width, int height) {
+void guac_rdp_disp_set_size(guac_rdp_disp* disp, guac_rdp_settings* settings,
+ freerdp* rdp_inst, int width, int height) {
/* Fit width within bounds, adjusting height to maintain aspect ratio */
guac_rdp_disp_fit(&width, &height);
@@ -129,21 +133,47 @@ void guac_rdp_disp_set_size(guac_rdp_disp* disp, rdpContext* context,
disp->requested_height = height;
/* Send display update notification if possible */
- guac_rdp_disp_update_size(disp, context);
+ guac_rdp_disp_update_size(disp, settings, rdp_inst);
}
-void guac_rdp_disp_update_size(guac_rdp_disp* disp, rdpContext* context) {
+void guac_rdp_disp_update_size(guac_rdp_disp* disp,
+ guac_rdp_settings* settings, freerdp* rdp_inst) {
- guac_client* client = ((rdp_freerdp_context*) context)->client;
+ int width = disp->requested_width;
+ int height = disp->requested_height;
- /* Send display update notification if display channel is connected */
- if (disp->disp == NULL)
+ /* Do not update size if no requests have been received */
+ if (width == 0 || height == 0)
return;
- int width = disp->requested_width;
- int height = disp->requested_height;
+ guac_timestamp now = guac_timestamp_current();
+
+ /* Limit display update frequency */
+ if (disp->last_request != 0
+ && now - disp->last_request <= GUAC_RDP_DISP_UPDATE_INTERVAL)
+ return;
+
+ /* Do NOT send requests unless the size will change */
+ if (rdp_inst != NULL
+ && width == guac_rdp_get_width(rdp_inst)
+ && height == guac_rdp_get_height(rdp_inst))
+ return;
+
+ disp->last_request = now;
+
+ if (1) {
+ /* Update settings with new dimensions */
+ settings->width = width;
+ settings->height = height;
+ /* Signal reconnect */
+ disp->reconnect_needed = 1;
+ disp->disp = NULL;
+ return;
+ }
+
+#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
DISPLAY_CONTROL_MONITOR_LAYOUT monitors[1] = {{
.Flags = 0x1, /* DISPLAYCONTROL_MONITOR_PRIMARY */
.Left = 0,
@@ -157,24 +187,18 @@ void guac_rdp_disp_update_size(guac_rdp_disp* disp, rdpContext* context) {
.DeviceScaleFactor = 0
}};
- guac_timestamp now = guac_timestamp_current();
-
- /* Limit display update frequency */
- if (disp->last_request != 0
- && now - disp->last_request <= GUAC_RDP_DISP_UPDATE_INTERVAL)
- return;
-
- /* Do NOT send requests unless the size will change */
- if (width == guac_rdp_get_width(context->instance)
- && height == guac_rdp_get_height(context->instance))
- return;
+ /* Send display update notification if display channel is connected */
+ if (disp->disp != NULL)
+ disp->disp->SendMonitorLayout(disp->disp, 1, monitors);
+#endif
- guac_client_log(client, GUAC_LOG_DEBUG,
- "Resizing remote display to %ix%i",
- width, height);
+}
- disp->last_request = now;
- disp->disp->SendMonitorLayout(disp->disp, 1, monitors);
+int guac_rdp_disp_reconnect_needed(guac_rdp_disp* disp) {
+ return disp->reconnect_needed;
+}
+void guac_rdp_disp_reconnect_complete(guac_rdp_disp* disp) {
+ disp->reconnect_needed = 0;
}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/fc40e9f1/src/protocols/rdp/rdp_disp.h
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp_disp.h b/src/protocols/rdp/rdp_disp.h
index 375f476..eb33047 100644
--- a/src/protocols/rdp/rdp_disp.h
+++ b/src/protocols/rdp/rdp_disp.h
@@ -23,6 +23,8 @@
#ifndef GUAC_RDP_DISP_H
#define GUAC_RDP_DISP_H
+#include "rdp_settings.h"
+
#include <freerdp/client/disp.h>
#include <freerdp/freerdp.h>
@@ -68,6 +70,12 @@ typedef struct guac_rdp_disp {
*/
int requested_height;
+ /**
+ * Whether the size has changed and the RDP connection must be closed and
+ * reestablished.
+ */
+ int reconnect_needed;
+
} guac_rdp_disp;
/**
@@ -113,30 +121,72 @@ void guac_rdp_disp_connect(guac_rdp_disp* guac_disp, DispClientContext* disp);
* be automatically altered to comply with the restrictions imposed by the
* display update channel.
*
- * @param disp The display update module which should maintain the requested
- * size, sending the corresponding display update request when
- * appropriate.
- * @param context The rdpContext associated with the active RDP session.
- * @param width The desired display width, in pixels. Due to the restrictions
- * of the RDP display update channel, this will be contrained to
- * the range of 200 through 8192 inclusive, and rounded down to
- * the nearest even number.
- * @param height The desired display height, in pixels. Due to the restrictions
- * of the RDP display update channel, this will be contrained to
- * the range of 200 through 8192 inclusive.
+ * @param disp
+ * The display update module which should maintain the requested size,
+ * sending the corresponding display update request when appropriate.
+ *
+ * @param settings
+ * The RDP client settings associated with the current or pending RDP
+ * session. These settings will be automatically adjusted to match the new
+ * screen size.
+ *
+ * @param rdp_inst
+ * The FreeRDP instance associated with the current or pending RDP session,
+ * if any. If no RDP session is active, this should be NULL.
+ *
+ * @param width
+ * The desired display width, in pixels. Due to the restrictions of the RDP
+ * display update channel, this will be contrained to the range of 200
+ * through 8192 inclusive, and rounded down to the nearest even number.
+ *
+ * @param height
+ * The desired display height, in pixels. Due to the restrictions of the
+ * RDP display update channel, this will be contrained to the range of 200
+ * through 8192 inclusive.
*/
-void guac_rdp_disp_set_size(guac_rdp_disp* disp, rdpContext* context,
- int width, int height);
+void guac_rdp_disp_set_size(guac_rdp_disp* disp, guac_rdp_settings* settings,
+ freerdp* rdp_inst, int width, int height);
/**
* Sends an actual display update request to the RDP server based on previous
* calls to guac_rdp_disp_set_size(). If an update was recently sent, the
- * update may be delayed until a future call to this function.
+ * update may be delayed until a future call to this function. If the RDP
+ * session has not yet been established, the request will be delayed until the
+ * session exists.
*
- * @param disp The display update module which should track the update request.
- * @param context The rdpContext associated with the active RDP session.
+ * @param disp
+ * The display update module which should track the update request.
+ *
+ * @param settings
+ * The RDP client settings associated with the current or pending RDP
+ * session. These settings will be automatically adjusted to match the new
+ * screen size.
+ *
+ * @param rdp_inst
+ * The FreeRDP instance associated with the current or pending RDP session,
+ * if any. If no RDP session is active, this should be NULL.
+ */
+void guac_rdp_disp_update_size(guac_rdp_disp* disp,
+ guac_rdp_settings* settings, freerdp* rdp_inst);
+
+/**
+ * Signals the given display update module that the requested reconnect has
+ * been performed.
+ *
+ * @param disp
+ * The display update module that should be signaled regarding the state
+ * of reconnection.
+ */
+void guac_rdp_disp_reconnect_complete(guac_rdp_disp* disp);
+
+/**
+ * Returns whether a full RDP reconnect is required for display update changes
+ * to take effect.
+ *
+ * @return
+ * Non-zero if a reconnect is needed, zero otherwise.
*/
-void guac_rdp_disp_update_size(guac_rdp_disp* disp, rdpContext* context);
+int guac_rdp_disp_reconnect_needed(guac_rdp_disp* disp);
#endif
[43/50] incubator-guacamole-server git commit: GUAC-1164: Add missing
free() for client connection ID.
Posted by mj...@apache.org.
GUAC-1164: Add missing free() for client connection ID.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/8c37db8a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/8c37db8a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/8c37db8a
Branch: refs/heads/master
Commit: 8c37db8a078e49993ab4fbba0957b2b6b56d908c
Parents: 176ff96
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Thu Mar 17 16:03:58 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Thu Mar 17 16:03:58 2016 -0700
----------------------------------------------------------------------
src/libguac/client.c | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/8c37db8a/src/libguac/client.c
----------------------------------------------------------------------
diff --git a/src/libguac/client.c b/src/libguac/client.c
index 55efa48..5e23a40 100644
--- a/src/libguac/client.c
+++ b/src/libguac/client.c
@@ -482,6 +482,7 @@ void guac_client_free(guac_client* client) {
}
pthread_rwlock_destroy(&(client->__users_lock));
+ free(client->connection_id);
free(client);
}
[50/50] incubator-guacamole-server git commit: Merge pull request
#133 from glyptodon/rdp-disconnect-leaks
Posted by mj...@apache.org.
Merge pull request #133 from glyptodon/rdp-disconnect-leaks
GUAC-1164: Ensure RDP-related memory is freed between connect/disconnect cycles.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/f97a681f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/f97a681f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/f97a681f
Branch: refs/heads/master
Commit: f97a681f1d521dd8257199e00b0c5c0efa2055b7
Parents: 3614c48 1cb4325
Author: James Muehlner <ja...@guac-dev.org>
Authored: Fri Mar 18 14:40:55 2016 -0700
Committer: James Muehlner <ja...@guac-dev.org>
Committed: Fri Mar 18 14:40:55 2016 -0700
----------------------------------------------------------------------
src/common-ssh/guac_ssh.c | 3 ++
src/common-ssh/guac_ssh_key.c | 1 +
src/libguac/client.c | 1 +
src/protocols/rdp/input.c | 6 ++--
src/protocols/rdp/rdp.c | 32 ++++++++++++-------
src/protocols/rdp/rdp_settings.c | 58 +++++++++++++++++++++++++++--------
src/protocols/rdp/rdp_stream.c | 33 ++++++++++++--------
7 files changed, 95 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
[14/50] incubator-guacamole-server git commit: GUAC-236: Acquire read
lock on input files for guacenc. Refuse to encode in-progress recordings.
Posted by mj...@apache.org.
GUAC-236: Acquire read lock on input files for guacenc. Refuse to encode in-progress recordings.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/9d43e225
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/9d43e225
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/9d43e225
Branch: refs/heads/master
Commit: 9d43e2259281dd8525e8339b6cec5d34bfaf0bcb
Parents: 0361dd2
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Tue Mar 15 17:08:39 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Tue Mar 15 17:08:39 2016 -0700
----------------------------------------------------------------------
src/guacenc/encode.c | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/9d43e225/src/guacenc/encode.c
----------------------------------------------------------------------
diff --git a/src/guacenc/encode.c b/src/guacenc/encode.c
index d7fe8eb..6e5fd02 100644
--- a/src/guacenc/encode.c
+++ b/src/guacenc/encode.c
@@ -30,10 +30,10 @@
#include <guacamole/parser.h>
#include <guacamole/socket.h>
-#include <errno.h>
-#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <errno.h>
+#include <fcntl.h>
#include <string.h>
#include <unistd.h>
@@ -93,6 +93,32 @@ int guacenc_encode(const char* path, const char* out_path, const char* codec,
return 1;
}
+ /* Lock entire input file for reading by the current process */
+ struct flock file_lock = {
+ .l_type = F_RDLCK,
+ .l_whence = SEEK_SET,
+ .l_start = 0,
+ .l_len = 0,
+ .l_pid = getpid()
+ };
+
+ /* Abort if file cannot be locked for reading */
+ if (fcntl(fd, F_SETLK, &file_lock) == -1) {
+
+ /* Warn if lock cannot be acquired */
+ if (errno == EACCES || errno == EAGAIN)
+ guacenc_log(GUAC_LOG_WARNING, "Refusing to encode in-progress "
+ "recording \"%s\".", path);
+
+ /* Log an error if locking fails in an unexpected way */
+ else
+ guacenc_log(GUAC_LOG_ERROR, "Cannot lock \"%s\" for reading: %s",
+ path, strerror(errno));
+
+ close(fd);
+ return 1;
+ }
+
/* Allocate display for encoding process */
guacenc_display* display = guacenc_display_alloc(out_path, codec,
width, height, bitrate);
[40/50] incubator-guacamole-server git commit: Merge pull request
#131 from glyptodon/bad-fd
Posted by mj...@apache.org.
Merge pull request #131 from glyptodon/bad-fd
GUAC-236: Do not attempt to lock/close fd if open fails.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/5a3bc7ab
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/5a3bc7ab
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/5a3bc7ab
Branch: refs/heads/master
Commit: 5a3bc7ab0432a030a9a93f3c798dee1e366aa438
Parents: 55f5d1c 1dfdcec
Author: James Muehlner <ja...@guac-dev.org>
Authored: Wed Mar 16 22:09:34 2016 -0700
Committer: James Muehlner <ja...@guac-dev.org>
Committed: Wed Mar 16 22:09:34 2016 -0700
----------------------------------------------------------------------
src/common/guac_recording.c | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
[15/50] incubator-guacamole-server git commit: GUAC-236: Provide -f
option for overriding locking behavior.
Posted by mj...@apache.org.
GUAC-236: Provide -f option for overriding locking behavior.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/32779ee1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/32779ee1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/32779ee1
Branch: refs/heads/master
Commit: 32779ee15ff4cc87b08074ffa3200458646e09ed
Parents: 9d43e22
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Tue Mar 15 17:24:25 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Tue Mar 15 17:24:25 2016 -0700
----------------------------------------------------------------------
src/guacenc/encode.c | 8 +++++---
src/guacenc/encode.h | 13 +++++++++++--
src/guacenc/guacenc.c | 12 ++++++++++--
src/guacenc/man/guacenc.1 | 20 +++++++++++++++++++-
4 files changed, 45 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/32779ee1/src/guacenc/encode.c
----------------------------------------------------------------------
diff --git a/src/guacenc/encode.c b/src/guacenc/encode.c
index 6e5fd02..115becb 100644
--- a/src/guacenc/encode.c
+++ b/src/guacenc/encode.c
@@ -34,6 +34,7 @@
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
+#include <stdbool.h>
#include <string.h>
#include <unistd.h>
@@ -84,7 +85,7 @@ static int guacenc_read_instructions(guacenc_display* display,
}
int guacenc_encode(const char* path, const char* out_path, const char* codec,
- int width, int height, int bitrate) {
+ int width, int height, int bitrate, bool force) {
/* Open input file */
int fd = open(path, O_RDONLY);
@@ -103,12 +104,13 @@ int guacenc_encode(const char* path, const char* out_path, const char* codec,
};
/* Abort if file cannot be locked for reading */
- if (fcntl(fd, F_SETLK, &file_lock) == -1) {
+ if (!force && fcntl(fd, F_SETLK, &file_lock) == -1) {
/* Warn if lock cannot be acquired */
if (errno == EACCES || errno == EAGAIN)
guacenc_log(GUAC_LOG_WARNING, "Refusing to encode in-progress "
- "recording \"%s\".", path);
+ "recording \"%s\" (specify the -f option to override "
+ "this behavior).", path);
/* Log an error if locking fails in an unexpected way */
else
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/32779ee1/src/guacenc/encode.h
----------------------------------------------------------------------
diff --git a/src/guacenc/encode.h b/src/guacenc/encode.h
index ee6be9a..b80eeb0 100644
--- a/src/guacenc/encode.h
+++ b/src/guacenc/encode.h
@@ -25,8 +25,13 @@
#include "config.h"
+#include <stdbool.h>
+
/**
- * Encodes the given Guacamole protocol dump as video.
+ * Encodes the given Guacamole protocol dump as video. A read lock will be
+ * acquired on the input file to ensure that in-progress recordings are not
+ * encoded. This behavior can be overridden by specifying true for the force
+ * parameter.
*
* @param path
* The path to the file containing the raw Guacamole protocol dump.
@@ -48,12 +53,16 @@
* The desired overall bitrate of the resulting encoded video, in bits per
* second.
*
+ * @param force
+ * Perform the encoding, even if the input file appears to be an
+ * in-progress recording (has an associated lock).
+ *
* @return
* Zero on success, non-zero if an error prevented successful encoding of
* the video.
*/
int guacenc_encode(const char* path, const char* out_path, const char* codec,
- int width, int height, int bitrate);
+ int width, int height, int bitrate, bool force);
#endif
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/32779ee1/src/guacenc/guacenc.c
----------------------------------------------------------------------
diff --git a/src/guacenc/guacenc.c b/src/guacenc/guacenc.c
index c552505..f67b208 100644
--- a/src/guacenc/guacenc.c
+++ b/src/guacenc/guacenc.c
@@ -30,6 +30,7 @@
#include <libavcodec/avcodec.h>
#include <getopt.h>
+#include <stdbool.h>
#include <stdio.h>
int main(int argc, char* argv[]) {
@@ -37,13 +38,14 @@ int main(int argc, char* argv[]) {
int i;
/* Load defaults */
+ bool force = false;
int width = GUACENC_DEFAULT_WIDTH;
int height = GUACENC_DEFAULT_HEIGHT;
int bitrate = GUACENC_DEFAULT_BITRATE;
/* Parse arguments */
int opt;
- while ((opt = getopt(argc, argv, "s:r:")) != -1) {
+ while ((opt = getopt(argc, argv, "s:r:f")) != -1) {
/* -s: Dimensions (WIDTHxHEIGHT) */
if (opt == 's') {
@@ -61,6 +63,10 @@ int main(int argc, char* argv[]) {
}
}
+ /* -f: Force */
+ else if (opt == 'f')
+ force = true;
+
/* Invalid option */
else {
goto invalid_options;
@@ -108,7 +114,8 @@ int main(int argc, char* argv[]) {
}
/* Attempt encoding, log granular success/failure at debug level */
- if (guacenc_encode(path, out_path, "mpeg4", width, height, bitrate)) {
+ if (guacenc_encode(path, out_path, "mpeg4",
+ width, height, bitrate, force)) {
failures++;
guacenc_log(GUAC_LOG_DEBUG,
"%s was NOT successfully encoded.", path);
@@ -136,6 +143,7 @@ invalid_options:
fprintf(stderr, "USAGE: %s"
" [-s WIDTHxHEIGHT]"
" [-r BITRATE]"
+ " [-f]"
" [FILE]...\n", argv[0]);
return 1;
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/32779ee1/src/guacenc/man/guacenc.1
----------------------------------------------------------------------
diff --git a/src/guacenc/man/guacenc.1 b/src/guacenc/man/guacenc.1
index 3f6f179..bbef718 100644
--- a/src/guacenc/man/guacenc.1
+++ b/src/guacenc/man/guacenc.1
@@ -7,6 +7,7 @@ guacenc \- Guacamole video encoder
.B guacenc
[\fB-s\fR \fIWIDTH\fRx\fIHEIGHT\fR]
[\fB-r\fR \fIBITRATE\fR]
+[\fB-f\fR]
[\fIFILE\fR]...
.
.SH DESCRIPTION
@@ -23,7 +24,18 @@ Each \fIFILE\fR specified will be encoded as a raw MPEG-4 video stream to a new
file named \fIFILE\fR.m4v, encoded according to the other options specified. By
default, the output video will be \fI640\fRx\fI480\fR pixels, and will be saved
with a bitrate of \fI2000000\fR bits per second (2 Mbps). These defaults can be
-overridden with the \fB-s\fR and \fB-r\fR options respectively.
+overridden with the \fB-s\fR and \fB-r\fR options respectively. Existing files
+will not be overwritten; the encoding process for any input file will be
+aborted if it would result in overwriting an existing file.
+.P
+Guacamole acquires a write lock on recordings as they are being written. By
+default,
+.B guacenc
+will check whether the each input file is locked and will refuse to read and
+encode an input file if it appears to be an in-progress recording. This
+behavior can be overridden by specifying the \fB-f\fR option. Encoding an
+in-progress recording will still result in a valid video; the video will simply
+cover the user's session only up to the current point in time.
.
.SH OPTIONS
.TP
@@ -39,6 +51,12 @@ will use for the saved video. This is specified in bits per second. By default,
this will be \fI2000000\fR (2 Mbps). Higher values will result in larger but
higher-quality video files. Lower values will result in smaller but
lower-quality video files.
+.TP
+\fB-f\fR
+Overrides the default behavior of
+.B guacenc
+such that input files will be encoded even if they appear to be recordings of
+in-progress Guacamole sessions.
.
.SH AUTHOR
Written by Michael Jumper <mi...@guac-dev.org>
[21/50] incubator-guacamole-server git commit: GUAC-1164:
Conditionally build display update channel support.
Posted by mj...@apache.org.
GUAC-1164: Conditionally build display update channel support.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/4e2b90cc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/4e2b90cc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/4e2b90cc
Branch: refs/heads/master
Commit: 4e2b90cc0a6530134a91cafb82930750d85cc7b0
Parents: 2e73e5e
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Tue Mar 15 21:59:28 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Tue Mar 15 21:59:28 2016 -0700
----------------------------------------------------------------------
src/protocols/rdp/rdp_disp.c | 5 ++++-
src/protocols/rdp/rdp_disp.h | 7 ++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/4e2b90cc/src/protocols/rdp/rdp_disp.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp_disp.c b/src/protocols/rdp/rdp_disp.c
index ea65289..ee2d627 100644
--- a/src/protocols/rdp/rdp_disp.c
+++ b/src/protocols/rdp/rdp_disp.c
@@ -27,10 +27,13 @@
#include "rdp_settings.h"
#include <freerdp/freerdp.h>
-#include <freerdp/client/disp.h>
#include <guacamole/client.h>
#include <guacamole/timestamp.h>
+#ifdef HAVE_FREERDP_CLIENT_DISP_H
+#include <freerdp/client/disp.h>
+#endif
+
guac_rdp_disp* guac_rdp_disp_alloc() {
guac_rdp_disp* disp = malloc(sizeof(guac_rdp_disp));
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/4e2b90cc/src/protocols/rdp/rdp_disp.h
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp_disp.h b/src/protocols/rdp/rdp_disp.h
index eb33047..b2516b5 100644
--- a/src/protocols/rdp/rdp_disp.h
+++ b/src/protocols/rdp/rdp_disp.h
@@ -25,9 +25,12 @@
#include "rdp_settings.h"
-#include <freerdp/client/disp.h>
#include <freerdp/freerdp.h>
+#ifdef HAVE_FREERDP_CLIENT_DISP_H
+#include <freerdp/client/disp.h>
+#endif
+
/**
* The minimum value for width or height, in pixels.
*/
@@ -49,10 +52,12 @@
*/
typedef struct guac_rdp_disp {
+#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
/**
* Display control interface.
*/
DispClientContext* disp;
+#endif
/**
* The timestamp of the last display update request, or 0 if no request
[20/50] incubator-guacamole-server git commit: GUAC-1164: Dispose of
layers/buffers when display/cursor are freed.
Posted by mj...@apache.org.
GUAC-1164: Dispose of layers/buffers when display/cursor are freed.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/2e73e5ee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/2e73e5ee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/2e73e5ee
Branch: refs/heads/master
Commit: 2e73e5eef98965b7b568955e64c510e5d4544447
Parents: fc40e9f
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Tue Mar 15 21:49:26 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Tue Mar 15 21:49:26 2016 -0700
----------------------------------------------------------------------
src/common/guac_cursor.c | 14 +++++++++++---
src/common/guac_display.c | 3 +++
2 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/2e73e5ee/src/common/guac_cursor.c
----------------------------------------------------------------------
diff --git a/src/common/guac_cursor.c b/src/common/guac_cursor.c
index 55a01bf..7c309b9 100644
--- a/src/common/guac_cursor.c
+++ b/src/common/guac_cursor.c
@@ -29,6 +29,7 @@
#include <cairo/cairo.h>
#include <guacamole/client.h>
+#include <guacamole/layer.h>
#include <guacamole/protocol.h>
#include <guacamole/socket.h>
#include <guacamole/user.h>
@@ -70,13 +71,20 @@ guac_common_cursor* guac_common_cursor_alloc(guac_client* client) {
void guac_common_cursor_free(guac_common_cursor* cursor) {
+ guac_client* client = cursor->client;
+ guac_layer* layer = cursor->layer;
+ cairo_surface_t* surface = cursor->surface;
+
/* Free image buffer and surface */
free(cursor->image_buffer);
- if (cursor->surface != NULL)
- cairo_surface_destroy(cursor->surface);
+ if (surface != NULL)
+ cairo_surface_destroy(surface);
+
+ /* Destroy layer within remotely-connected client */
+ guac_protocol_send_dispose(client->socket, layer);
/* Return layer to pool */
- guac_client_free_layer(cursor->client, cursor->layer);
+ guac_client_free_layer(client, layer);
free(cursor);
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/2e73e5ee/src/common/guac_display.c
----------------------------------------------------------------------
diff --git a/src/common/guac_display.c b/src/common/guac_display.c
index 5a918e7..4ea9652 100644
--- a/src/common/guac_display.c
+++ b/src/common/guac_display.c
@@ -84,6 +84,9 @@ static void guac_common_display_free_layers(guac_common_display_layer* layers,
/* Free surface */
guac_common_surface_free(current->surface);
+ /* Destroy layer within remotely-connected client */
+ guac_protocol_send_dispose(client->socket, layer);
+
/* Free layer or buffer depending on index */
if (layer->index < 0)
guac_client_free_buffer(client, layer);
[31/50] incubator-guacamole-server git commit: GUAC-1164: Reset
request throttle after reconnect completed (prevent excessive reconnecting
due to lengthy connects).
Posted by mj...@apache.org.
GUAC-1164: Reset request throttle after reconnect completed (prevent excessive reconnecting due to lengthy connects).
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/de78a6ef
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/de78a6ef
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/de78a6ef
Branch: refs/heads/master
Commit: de78a6efedb445bdc07867377c220c46554b7d90
Parents: 8d14118
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Wed Mar 16 14:56:14 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Wed Mar 16 14:56:14 2016 -0700
----------------------------------------------------------------------
src/protocols/rdp/rdp_disp.c | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/de78a6ef/src/protocols/rdp/rdp_disp.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp_disp.c b/src/protocols/rdp/rdp_disp.c
index 973c301..96c149b 100644
--- a/src/protocols/rdp/rdp_disp.c
+++ b/src/protocols/rdp/rdp_disp.c
@@ -209,5 +209,6 @@ int guac_rdp_disp_reconnect_needed(guac_rdp_disp* disp) {
void guac_rdp_disp_reconnect_complete(guac_rdp_disp* disp) {
disp->reconnect_needed = 0;
+ disp->last_request = guac_timestamp_current();
}
[33/50] incubator-guacamole-server git commit: GUAC-1164: Delay
display resize relative to display manager creation or reconnect.
Posted by mj...@apache.org.
GUAC-1164: Delay display resize relative to display manager creation or reconnect.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/db82c6fa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/db82c6fa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/db82c6fa
Branch: refs/heads/master
Commit: db82c6fa027b297c44501d188d00b0b383c565d0
Parents: 3997e44
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Wed Mar 16 15:27:24 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Wed Mar 16 15:27:24 2016 -0700
----------------------------------------------------------------------
src/protocols/rdp/rdp_disp.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/db82c6fa/src/protocols/rdp/rdp_disp.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp_disp.c b/src/protocols/rdp/rdp_disp.c
index 96c149b..bf31633 100644
--- a/src/protocols/rdp/rdp_disp.c
+++ b/src/protocols/rdp/rdp_disp.c
@@ -44,7 +44,7 @@ guac_rdp_disp* guac_rdp_disp_alloc() {
#endif
/* No requests have been made */
- disp->last_request = 0;
+ disp->last_request = guac_timestamp_current();
disp->requested_width = 0;
disp->requested_height = 0;
disp->reconnect_needed = 0;
@@ -157,8 +157,7 @@ void guac_rdp_disp_update_size(guac_rdp_disp* disp,
guac_timestamp now = guac_timestamp_current();
/* Limit display update frequency */
- if (disp->last_request != 0
- && now - disp->last_request <= GUAC_RDP_DISP_UPDATE_INTERVAL)
+ if (now - disp->last_request <= GUAC_RDP_DISP_UPDATE_INTERVAL)
return;
/* Do NOT send requests unless the size will change */
[35/50] incubator-guacamole-server git commit: Merge pull request
#128 from glyptodon/libavcodec-compat
Posted by mj...@apache.org.
Merge pull request #128 from glyptodon/libavcodec-compat
GUAC-236: Provide support for much older versions of libavcodec.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/b63763cf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/b63763cf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/b63763cf
Branch: refs/heads/master
Commit: b63763cf5348754ef044f17c02e92b727113ce27
Parents: 1fedb71 89f6bd4
Author: James Muehlner <ja...@guac-dev.org>
Authored: Wed Mar 16 20:45:58 2016 -0700
Committer: James Muehlner <ja...@guac-dev.org>
Committed: Wed Mar 16 20:45:58 2016 -0700
----------------------------------------------------------------------
src/guacenc/Makefile.am | 1 +
src/guacenc/ffmpeg-compat.c | 123 +++++++++++++++++++++++++++++++++++++++
src/guacenc/ffmpeg-compat.h | 32 ++++++++++
src/guacenc/video.c | 37 +-----------
4 files changed, 158 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
[29/50] incubator-guacamole-server git commit: Merge pull request
#127 from glyptodon/libjpeg-compat
Posted by mj...@apache.org.
Merge pull request #127 from glyptodon/libjpeg-compat
GUAC-236: Do not use features specific to libjpeg-turbo. Ensure compatibility with libjpeg.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/1fedb71f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/1fedb71f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/1fedb71f
Branch: refs/heads/master
Commit: 1fedb71f768a93ebe36fb3177cd8fb9c1f204a39
Parents: a1822c5 fd430e8
Author: James Muehlner <ja...@guac-dev.org>
Authored: Wed Mar 16 12:08:33 2016 -0700
Committer: James Muehlner <ja...@guac-dev.org>
Committed: Wed Mar 16 12:08:33 2016 -0700
----------------------------------------------------------------------
src/guacenc/jpeg.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 68 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[34/50] incubator-guacamole-server git commit: GUAC-236: Provide
support for much older versions of libavcodec.
Posted by mj...@apache.org.
GUAC-236: Provide support for much older versions of libavcodec.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/89f6bd4f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/89f6bd4f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/89f6bd4f
Branch: refs/heads/master
Commit: 89f6bd4fae30a5a520e88f577ac9748123acb42b
Parents: 1fedb71
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Wed Mar 16 18:48:00 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Wed Mar 16 18:51:15 2016 -0700
----------------------------------------------------------------------
src/guacenc/Makefile.am | 1 +
src/guacenc/ffmpeg-compat.c | 123 +++++++++++++++++++++++++++++++++++++++
src/guacenc/ffmpeg-compat.h | 32 ++++++++++
src/guacenc/video.c | 37 +-----------
4 files changed, 158 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/89f6bd4f/src/guacenc/Makefile.am
----------------------------------------------------------------------
diff --git a/src/guacenc/Makefile.am b/src/guacenc/Makefile.am
index 1230992..45b9f37 100644
--- a/src/guacenc/Makefile.am
+++ b/src/guacenc/Makefile.am
@@ -51,6 +51,7 @@ guacenc_SOURCES = \
display-layers.c \
display-sync.c \
encode.c \
+ ffmpeg-compat.c \
guacenc.c \
image-stream.c \
instructions.c \
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/89f6bd4f/src/guacenc/ffmpeg-compat.c
----------------------------------------------------------------------
diff --git a/src/guacenc/ffmpeg-compat.c b/src/guacenc/ffmpeg-compat.c
new file mode 100644
index 0000000..9cd6820
--- /dev/null
+++ b/src/guacenc/ffmpeg-compat.c
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2016 Glyptodon, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "config.h"
+#include "ffmpeg-compat.h"
+#include "log.h"
+#include "video.h"
+
+#include <libavcodec/avcodec.h>
+#include <libavutil/common.h>
+#include <libavutil/imgutils.h>
+#include <guacamole/client.h>
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+int guacenc_avcodec_encode_video(guacenc_video* video, AVFrame* frame) {
+
+/* For libavcodec < 54.1.0: avcodec_encode_video2() did not exist */
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54,1,0)
+
+ AVCodecContext* context = video->context;
+
+ /* Calculate appropriate buffer size */
+ int length = FF_MIN_BUFFER_SIZE + 12 * context->width * context->height;
+
+ /* Allocate space for output */
+ uint8_t* data = malloc(length);
+ if (data == NULL)
+ return -1;
+
+ /* Encode packet of video data */
+ int used = avcodec_encode_video(context, data, length, frame);
+ if (used < 0) {
+ guacenc_log(GUAC_LOG_WARNING, "Error encoding frame #%" PRId64,
+ video->next_pts);
+ free(data);
+ return -1;
+ }
+
+ /* Report if no data needs to be written */
+ if (used == 0) {
+ free(data);
+ return 0;
+ }
+
+ /* Write data, logging any errors */
+ if (fwrite(data, 1, used, video->output) == 0) {
+ guacenc_log(GUAC_LOG_ERROR, "Unable to write frame "
+ "#%" PRId64 ": %s", video->next_pts, strerror(errno));
+ free(data);
+ return -1;
+ }
+
+ /* Data was written successfully */
+ free(data);
+ return 1;
+
+#else
+
+ /* Init video packet */
+ AVPacket packet;
+ av_init_packet(&packet);
+
+ /* Request that encoder allocate data for packet */
+ packet.data = NULL;
+ packet.size = 0;
+
+ /* Write frame to video */
+ int got_data;
+ if (avcodec_encode_video2(video->context, &packet, frame, &got_data) < 0) {
+ guacenc_log(GUAC_LOG_WARNING, "Error encoding frame #%" PRId64,
+ video->next_pts);
+ return -1;
+ }
+
+ /* Write corresponding data to file */
+ if (got_data) {
+
+ /* Write data, logging any errors */
+ if (fwrite(packet.data, 1, packet.size, video->output) == 0) {
+ guacenc_log(GUAC_LOG_ERROR, "Unable to write frame "
+ "#%" PRId64 ": %s", video->next_pts, strerror(errno));
+ return -1;
+ }
+
+ /* Data was written successfully */
+ guacenc_log(GUAC_LOG_DEBUG, "Frame #%08" PRId64 ": wrote %i bytes",
+ video->next_pts, packet.size);
+ av_packet_unref(&packet);
+
+ }
+
+ /* Frame may have been queued for later writing / reordering */
+ else
+ guacenc_log(GUAC_LOG_DEBUG, "Frame #%08" PRId64 ": queued for later",
+ video->next_pts);
+
+ return got_data;
+
+#endif
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/89f6bd4f/src/guacenc/ffmpeg-compat.h
----------------------------------------------------------------------
diff --git a/src/guacenc/ffmpeg-compat.h b/src/guacenc/ffmpeg-compat.h
index ba3213a..3e5255c 100644
--- a/src/guacenc/ffmpeg-compat.h
+++ b/src/guacenc/ffmpeg-compat.h
@@ -24,6 +24,7 @@
#define GUACENC_FFMPEG_COMPAT_H
#include "config.h"
+#include "video.h"
#include <libavcodec/avcodec.h>
@@ -39,6 +40,11 @@
#define av_frame_free avcodec_free_frame
#endif
+/* For libavcodec < 54.28.0: old avcodec_free_frame() did not exist. */
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54,28,0)
+#define avcodec_free_frame av_freep
+#endif
+
/* For libavcodec < 55.52.0: avcodec_free_context did not exist */
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,52,0)
#define avcodec_free_context av_freep
@@ -49,5 +55,31 @@
#define av_packet_unref av_free_packet
#endif
+/* For libavutil < 51.42.0: AV_PIX_FMT_* was PIX_FMT_* */
+#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51,42,0)
+#define AV_PIX_FMT_RGB32 PIX_FMT_RGB32
+#define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P
+#endif
+
+/**
+ * Writes the specied frame as a new frame of video. If pending frames of the
+ * video are being flushed, the given frame may be NULL (as required by
+ * avcodec_encode_video2()). If avcodec_encode_video2() does not exist, this
+ * function will transparently use avcodec_encode_video().
+ *
+ * @param video
+ * The video to write the given frame to.
+ *
+ * @param frame
+ * The frame to write to the video, or NULL if previously-written frames
+ * are being flushed.
+ *
+ * @return
+ * A positive value if the frame was successfully written, zero if the
+ * frame has been saved for later writing / reordering, negative if an
+ * error occurs.
+ */
+int guacenc_avcodec_encode_video(guacenc_video* video, AVFrame* frame);
+
#endif
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/89f6bd4f/src/guacenc/video.c
----------------------------------------------------------------------
diff --git a/src/guacenc/video.c b/src/guacenc/video.c
index 8c13844..60a9477 100644
--- a/src/guacenc/video.c
+++ b/src/guacenc/video.c
@@ -174,47 +174,14 @@ fail_codec:
*/
static int guacenc_video_write_frame(guacenc_video* video, AVFrame* frame) {
- /* Init video packet */
- AVPacket packet;
- av_init_packet(&packet);
-
- /* Request that encoder allocate data for packet */
- packet.data = NULL;
- packet.size = 0;
-
/* Set timestamp of frame, if frame given */
if (frame != NULL)
frame->pts = video->next_pts;
/* Write frame to video */
- int got_data;
- if (avcodec_encode_video2(video->context, &packet, frame, &got_data) < 0) {
- guacenc_log(GUAC_LOG_WARNING, "Error encoding frame #%" PRId64,
- video->next_pts);
+ int got_data = guacenc_avcodec_encode_video(video, frame);
+ if (got_data < 0)
return -1;
- }
-
- /* Write corresponding data to file */
- if (got_data) {
-
- /* Write data, logging any errors */
- if (fwrite(packet.data, 1, packet.size, video->output) == 0) {
- guacenc_log(GUAC_LOG_ERROR, "Unable to write frame "
- "#%" PRId64 ": %s", video->next_pts, strerror(errno));
- return -1;
- }
-
- /* Data was written successfully */
- guacenc_log(GUAC_LOG_DEBUG, "Frame #%08" PRId64 ": wrote %i bytes",
- video->next_pts, packet.size);
- av_packet_unref(&packet);
-
- }
-
- /* Frame may have been queued for later writing / reordering */
- else
- guacenc_log(GUAC_LOG_DEBUG, "Frame #%08" PRId64 ": queued for later",
- video->next_pts);
/* Update presentation timestamp for next frame */
video->next_pts++;
[42/50] incubator-guacamole-server git commit: GUAC-1164: Ensure
elements of SVC names array are freed.
Posted by mj...@apache.org.
GUAC-1164: Ensure elements of SVC names array are freed.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/176ff96a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/176ff96a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/176ff96a
Branch: refs/heads/master
Commit: 176ff96a26c08c2adc3ee1b3772d9ad11cee736e
Parents: 3614c48
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Thu Mar 17 15:54:15 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Thu Mar 17 15:54:15 2016 -0700
----------------------------------------------------------------------
src/protocols/rdp/rdp_settings.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/176ff96a/src/protocols/rdp/rdp_settings.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp_settings.c b/src/protocols/rdp/rdp_settings.c
index 133da61..dddae74 100644
--- a/src/protocols/rdp/rdp_settings.c
+++ b/src/protocols/rdp/rdp_settings.c
@@ -765,7 +765,19 @@ void guac_rdp_settings_free(guac_rdp_settings* settings) {
free(settings->username);
/* Free channel name array */
- free(settings->svc_names);
+ if (settings->svc_names != NULL) {
+
+ /* Free all elements of array */
+ char** current = &(settings->svc_names[0]);
+ while (*current != NULL) {
+ free(*current);
+ current++;
+ }
+
+ /* Free array itself */
+ free(settings->svc_names);
+
+ }
#ifdef ENABLE_COMMON_SSH
/* Free SFTP settings */
[24/50] incubator-guacamole-server git commit: GUAC-1164: Do not
refer to disp member if it does not exist.
Posted by mj...@apache.org.
GUAC-1164: Do not refer to disp member if it does not exist.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/67a0a1fe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/67a0a1fe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/67a0a1fe
Branch: refs/heads/master
Commit: 67a0a1fe4612f7857da3adb229703b654e20539c
Parents: fc71dca
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Tue Mar 15 22:11:06 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Tue Mar 15 22:11:06 2016 -0700
----------------------------------------------------------------------
src/protocols/rdp/rdp_disp.c | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/67a0a1fe/src/protocols/rdp/rdp_disp.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp_disp.c b/src/protocols/rdp/rdp_disp.c
index cd18cb3..c7ea64a 100644
--- a/src/protocols/rdp/rdp_disp.c
+++ b/src/protocols/rdp/rdp_disp.c
@@ -38,8 +38,10 @@ guac_rdp_disp* guac_rdp_disp_alloc() {
guac_rdp_disp* disp = malloc(sizeof(guac_rdp_disp));
+#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
/* Not yet connected */
disp->disp = NULL;
+#endif
/* No requests have been made */
disp->last_request = 0;
@@ -174,7 +176,9 @@ void guac_rdp_disp_update_size(guac_rdp_disp* disp,
/* Signal reconnect */
disp->reconnect_needed = 1;
+#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
disp->disp = NULL;
+#endif
return;
}
[26/50] incubator-guacamole-server git commit: GUAC-236: Add missing
plurals.
Posted by mj...@apache.org.
GUAC-236: Add missing plurals.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/0a5e5736
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/0a5e5736
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/0a5e5736
Branch: refs/heads/master
Commit: 0a5e57362e7ab5c9918e40eb58cbb84ebe90d4f8
Parents: 534d0e5
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Wed Mar 16 10:45:11 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Wed Mar 16 10:45:11 2016 -0700
----------------------------------------------------------------------
src/protocols/rdp/rdp_settings.c | 2 +-
src/protocols/ssh/settings.c | 2 +-
src/protocols/telnet/settings.c | 2 +-
src/protocols/vnc/settings.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/0a5e5736/src/protocols/rdp/rdp_settings.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp_settings.c b/src/protocols/rdp/rdp_settings.c
index 728c9a6..70902f8 100644
--- a/src/protocols/rdp/rdp_settings.c
+++ b/src/protocols/rdp/rdp_settings.c
@@ -363,7 +363,7 @@ enum RDP_ARGS_IDX {
IDX_RECORDING_PATH,
/**
- * The name that should be given to screen recording which are written in
+ * The name that should be given to screen recordings which are written in
* the given path.
*/
IDX_RECORDING_NAME,
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/0a5e5736/src/protocols/ssh/settings.c
----------------------------------------------------------------------
diff --git a/src/protocols/ssh/settings.c b/src/protocols/ssh/settings.c
index eb00183..3efabfc 100644
--- a/src/protocols/ssh/settings.c
+++ b/src/protocols/ssh/settings.c
@@ -150,7 +150,7 @@ enum SSH_ARGS_IDX {
IDX_RECORDING_PATH,
/**
- * The name that should be given to screen recording which are written in
+ * The name that should be given to screen recordings which are written in
* the given path.
*/
IDX_RECORDING_NAME,
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/0a5e5736/src/protocols/telnet/settings.c
----------------------------------------------------------------------
diff --git a/src/protocols/telnet/settings.c b/src/protocols/telnet/settings.c
index edb74de..85d7353 100644
--- a/src/protocols/telnet/settings.c
+++ b/src/protocols/telnet/settings.c
@@ -130,7 +130,7 @@ enum TELNET_ARGS_IDX {
IDX_RECORDING_PATH,
/**
- * The name that should be given to screen recording which are written in
+ * The name that should be given to screen recordings which are written in
* the given path.
*/
IDX_RECORDING_NAME,
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/0a5e5736/src/protocols/vnc/settings.c
----------------------------------------------------------------------
diff --git a/src/protocols/vnc/settings.c b/src/protocols/vnc/settings.c
index c183906..d521fe9 100644
--- a/src/protocols/vnc/settings.c
+++ b/src/protocols/vnc/settings.c
@@ -239,7 +239,7 @@ enum VNC_ARGS_IDX {
IDX_RECORDING_PATH,
/**
- * The name that should be given to screen recording which are written in
+ * The name that should be given to screen recordings which are written in
* the given path.
*/
IDX_RECORDING_NAME,
[47/50] incubator-guacamole-server git commit: GUAC-1164: Do not send
clipboard notification to RDP server if RDP server is not connected.
Posted by mj...@apache.org.
GUAC-1164: Do not send clipboard notification to RDP server if RDP server is not connected.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/0fb8a49e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/0fb8a49e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/0fb8a49e
Branch: refs/heads/master
Commit: 0fb8a49e62c3d71dab11cc25acf0ef16bf42f972
Parents: 7c3d108
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Thu Mar 17 18:06:23 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Thu Mar 17 18:06:23 2016 -0700
----------------------------------------------------------------------
src/protocols/rdp/rdp_stream.c | 33 ++++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/0fb8a49e/src/protocols/rdp/rdp_stream.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp_stream.c b/src/protocols/rdp/rdp_stream.c
index 2bc39dd..f941529 100644
--- a/src/protocols/rdp/rdp_stream.c
+++ b/src/protocols/rdp/rdp_stream.c
@@ -286,24 +286,31 @@ int guac_rdp_clipboard_end_handler(guac_user* user, guac_stream* stream) {
guac_client* client = user->client;
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
- rdpChannels* channels = rdp_client->rdp_inst->context->channels;
-
- RDP_CB_FORMAT_LIST_EVENT* format_list =
- (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(
- CliprdrChannel_Class,
- CliprdrChannel_FormatList,
- NULL, NULL);
/* Terminate clipboard data with NULL */
guac_common_clipboard_append(rdp_client->clipboard, "", 1);
- /* Notify server that text data is now available */
- format_list->formats = (UINT32*) malloc(sizeof(UINT32) * 2);
- format_list->formats[0] = CB_FORMAT_TEXT;
- format_list->formats[1] = CB_FORMAT_UNICODETEXT;
- format_list->num_formats = 2;
+ /* Notify RDP server of new data, if connected */
+ freerdp* rdp_inst = rdp_client->rdp_inst;
+ if (rdp_inst != NULL) {
+
+ rdpChannels* channels = rdp_inst->context->channels;
+
+ RDP_CB_FORMAT_LIST_EVENT* format_list =
+ (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(
+ CliprdrChannel_Class,
+ CliprdrChannel_FormatList,
+ NULL, NULL);
- freerdp_channels_send_event(channels, (wMessage*) format_list);
+ /* Notify server that text data is now available */
+ format_list->formats = (UINT32*) malloc(sizeof(UINT32) * 2);
+ format_list->formats[0] = CB_FORMAT_TEXT;
+ format_list->formats[1] = CB_FORMAT_UNICODETEXT;
+ format_list->num_formats = 2;
+
+ freerdp_channels_send_event(channels, (wMessage*) format_list);
+
+ }
return 0;
}
[09/50] incubator-guacamole-server git commit: Merge pull request
#124 from glyptodon/screen-sharing-telnet
Posted by mj...@apache.org.
Merge pull request #124 from glyptodon/screen-sharing-telnet
GUAC-1389: Add screen sharing support to telnet.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/399f9754
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/399f9754
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/399f9754
Branch: refs/heads/master
Commit: 399f97542acee48842cff01079595b490c38902e
Parents: 3f51d3d 35746ef
Author: James Muehlner <ja...@guac-dev.org>
Authored: Mon Mar 14 20:33:40 2016 -0700
Committer: James Muehlner <ja...@guac-dev.org>
Committed: Mon Mar 14 20:33:40 2016 -0700
----------------------------------------------------------------------
Makefile.am | 2 +-
src/protocols/telnet/Makefile.am | 20 +-
src/protocols/telnet/client.c | 267 +++------------
src/protocols/telnet/client.h | 86 +----
src/protocols/telnet/clipboard.c | 21 +-
src/protocols/telnet/clipboard.h | 21 +-
src/protocols/telnet/guac_handlers.c | 150 ---------
src/protocols/telnet/guac_handlers.h | 62 ----
src/protocols/telnet/input.c | 132 ++++++++
src/protocols/telnet/input.h | 49 +++
src/protocols/telnet/settings.c | 281 ++++++++++++++++
src/protocols/telnet/settings.h | 199 +++++++++++
src/protocols/telnet/telnet.c | 531 ++++++++++++++++++++++++++++++
src/protocols/telnet/telnet.h | 96 ++++++
src/protocols/telnet/telnet_client.c | 501 ----------------------------
src/protocols/telnet/telnet_client.h | 50 ---
src/protocols/telnet/user.c | 83 +++++
src/protocols/telnet/user.h | 36 ++
18 files changed, 1482 insertions(+), 1105 deletions(-)
----------------------------------------------------------------------
[46/50] incubator-guacamole-server git commit: GUAC-1164: Duplicate
strings which FreeRDP will free when it frees its settings structure.
Posted by mj...@apache.org.
GUAC-1164: Duplicate strings which FreeRDP will free when it frees its settings structure.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/7c3d108e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/7c3d108e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/7c3d108e
Branch: refs/heads/master
Commit: 7c3d108e211779589f2e150a3dc037f1ebb0388d
Parents: e57c9dd
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Thu Mar 17 18:05:16 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Thu Mar 17 18:05:16 2016 -0700
----------------------------------------------------------------------
src/protocols/rdp/rdp_settings.c | 44 ++++++++++++++++++++++++++---------
1 file changed, 33 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/7c3d108e/src/protocols/rdp/rdp_settings.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp_settings.c b/src/protocols/rdp/rdp_settings.c
index dddae74..00d5429 100644
--- a/src/protocols/rdp/rdp_settings.c
+++ b/src/protocols/rdp/rdp_settings.c
@@ -864,6 +864,28 @@ static int guac_rdp_get_performance_flags(guac_rdp_settings* guac_settings) {
}
+/**
+ * Simple wrapper for strdup() which behaves identically to standard strdup(),
+ * execpt that NULL will be returned if the provided string is NULL.
+ *
+ * @param str
+ * The string to duplicate as a newly-allocated string.
+ *
+ * @return
+ * A newly-allocated string containing identically the same content as the
+ * given string, or NULL if the given string was NULL.
+ */
+static char* guac_rdp_strdup(const char* str) {
+
+ /* Return NULL if no string provided */
+ if (str == NULL)
+ return NULL;
+
+ /* Otherwise just invoke strdup() */
+ return strdup(str);
+
+}
+
void guac_rdp_push_settings(guac_rdp_settings* guac_settings, freerdp* rdp) {
BOOL bitmap_cache;
@@ -871,21 +893,21 @@ void guac_rdp_push_settings(guac_rdp_settings* guac_settings, freerdp* rdp) {
/* Authentication */
#ifdef LEGACY_RDPSETTINGS
- rdp_settings->domain = guac_settings->domain;
- rdp_settings->username = guac_settings->username;
- rdp_settings->password = guac_settings->password;
+ rdp_settings->domain = guac_rdp_strdup(guac_settings->domain);
+ rdp_settings->username = guac_rdp_strdup(guac_settings->username);
+ rdp_settings->password = guac_rdp_strdup(guac_settings->password);
#else
- rdp_settings->Domain = guac_settings->domain;
- rdp_settings->Username = guac_settings->username;
- rdp_settings->Password = guac_settings->password;
+ rdp_settings->Domain = guac_rdp_strdup(guac_settings->domain);
+ rdp_settings->Username = guac_rdp_strdup(guac_settings->username);
+ rdp_settings->Password = guac_rdp_strdup(guac_settings->password);
#endif
/* Connection */
#ifdef LEGACY_RDPSETTINGS
- rdp_settings->hostname = guac_settings->hostname;
+ rdp_settings->hostname = guac_rdp_strdup(guac_settings->hostname);
rdp_settings->port = guac_settings->port;
#else
- rdp_settings->ServerHostname = guac_settings->hostname;
+ rdp_settings->ServerHostname = guac_rdp_strdup(guac_settings->hostname);
rdp_settings->ServerPort = guac_settings->port;
#endif
@@ -894,13 +916,13 @@ void guac_rdp_push_settings(guac_rdp_settings* guac_settings, freerdp* rdp) {
rdp_settings->color_depth = guac_settings->color_depth;
rdp_settings->width = guac_settings->width;
rdp_settings->height = guac_settings->height;
- rdp_settings->shell = guac_settings->initial_program;
+ rdp_settings->shell = guac_rdp_strdup(guac_settings->initial_program);
rdp_settings->kbd_layout = guac_settings->server_layout->freerdp_keyboard_layout;
#else
rdp_settings->ColorDepth = guac_settings->color_depth;
rdp_settings->DesktopWidth = guac_settings->width;
rdp_settings->DesktopHeight = guac_settings->height;
- rdp_settings->AlternateShell = guac_settings->initial_program;
+ rdp_settings->AlternateShell = guac_rdp_strdup(guac_settings->initial_program);
rdp_settings->KeyboardLayout = guac_settings->server_layout->freerdp_keyboard_layout;
#endif
@@ -1046,7 +1068,7 @@ void guac_rdp_push_settings(guac_rdp_settings* guac_settings, freerdp* rdp) {
rdp_settings->RemoteApplicationMode = TRUE;
rdp_settings->RemoteAppLanguageBarSupported = TRUE;
rdp_settings->RemoteApplicationProgram = guac_settings->remote_app;
- rdp_settings->ShellWorkingDirectory = guac_settings->remote_app_dir;
+ rdp_settings->ShellWorkingDirectory = guac_rdp_strdup(guac_settings->remote_app_dir);
rdp_settings->RemoteApplicationCmdLine = guac_settings->remote_app_args;
#endif
}
[05/50] incubator-guacamole-server git commit: GUAC-236: Define
av_frame_free() / av_frame_alloc() if not present.
Posted by mj...@apache.org.
GUAC-236: Define av_frame_free() / av_frame_alloc() if not present.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/770fec0d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/770fec0d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/770fec0d
Branch: refs/heads/master
Commit: 770fec0d88b26800b3310e3f0b350600735692da
Parents: 812f8b8
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Sun Mar 13 23:59:09 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Mon Mar 14 20:22:04 2016 -0700
----------------------------------------------------------------------
src/guacenc/video.c | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/770fec0d/src/guacenc/video.c
----------------------------------------------------------------------
diff --git a/src/guacenc/video.c b/src/guacenc/video.c
index fbf02e0..a99cd4e 100644
--- a/src/guacenc/video.c
+++ b/src/guacenc/video.c
@@ -38,6 +38,12 @@
#include <stdio.h>
#include <stdlib.h>
+/* Define av_frame_alloc() / av_frame_free() if libavcodec is old */
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1)
+#define av_frame_alloc avcodec_alloc_frame
+#define av_frame_free avcodec_free_frame
+#endif
+
guacenc_video* guacenc_video_alloc(const char* path, const char* codec_name,
int width, int height, int bitrate) {
[44/50] incubator-guacamole-server git commit: GUAC-1164: Ensure
audio stream and context are freed upon disconnect.
Posted by mj...@apache.org.
GUAC-1164: Ensure audio stream and context are freed upon disconnect.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/0a4bfc95
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/0a4bfc95
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/0a4bfc95
Branch: refs/heads/master
Commit: 0a4bfc95d17338ae12e92bb6d4ef0c06b98a9872
Parents: 8c37db8
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Thu Mar 17 17:11:40 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Thu Mar 17 17:30:32 2016 -0700
----------------------------------------------------------------------
src/protocols/rdp/rdp.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/0a4bfc95/src/protocols/rdp/rdp.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp.c b/src/protocols/rdp/rdp.c
index 083ca0d..80158db 100644
--- a/src/protocols/rdp/rdp.c
+++ b/src/protocols/rdp/rdp.c
@@ -981,18 +981,27 @@ static int guac_rdp_handle_connection(guac_client* client) {
pthread_mutex_lock(&(rdp_client->rdp_lock));
- /* Clean up RDP client */
+ /* Disconnect client and channels */
freerdp_channels_close(channels, rdp_inst);
freerdp_channels_free(channels);
freerdp_disconnect(rdp_inst);
+
+ /* Clean up RDP client context */
freerdp_clrconv_free(((rdp_freerdp_context*) rdp_inst->context)->clrconv);
cache_free(rdp_inst->context->cache);
+ freerdp_context_free(rdp_inst);
+
+ /* Clean up RDP client */
freerdp_free(rdp_inst);
/* Clean up filesystem, if allocated */
if (rdp_client->filesystem != NULL)
guac_rdp_fs_free(rdp_client->filesystem);
+ /* Clean up audio stream, if allocated */
+ if (rdp_client->audio != NULL)
+ guac_audio_stream_free(rdp_client->audio);
+
#ifdef ENABLE_COMMON_SSH
/* Free SFTP filesystem, if loaded */
if (rdp_client->sftp_filesystem)
[28/50] incubator-guacamole-server git commit: GUAC-236: Do not use
features specific to libjpeg-turbo. Ensure compatibility with libjpeg.
Posted by mj...@apache.org.
GUAC-236: Do not use features specific to libjpeg-turbo. Ensure compatibility with libjpeg.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/fd430e8b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/fd430e8b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/fd430e8b
Branch: refs/heads/master
Commit: fd430e8b696a432a93c578930a0a7ab6f9127d5d
Parents: a1822c5
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Wed Mar 16 11:56:04 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Wed Mar 16 11:56:04 2016 -0700
----------------------------------------------------------------------
src/guacenc/jpeg.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 68 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/fd430e8b/src/guacenc/jpeg.c
----------------------------------------------------------------------
diff --git a/src/guacenc/jpeg.c b/src/guacenc/jpeg.c
index dfed2d1..c1b9062 100644
--- a/src/guacenc/jpeg.c
+++ b/src/guacenc/jpeg.c
@@ -32,6 +32,58 @@
#include <stdlib.h>
+/**
+ * Translates libjpeg's 24-bit RGB format into Cairo's 32-bit ARGB32 / RGB24
+ * format. The red, green, and blue components from the libjpeg pixel are
+ * copied verbatim, while the extra high byte used within Cairo is set to 0xFF.
+ *
+ * @param src
+ * A pointer to the first byte of the 24-bit RGB pixel within a libjpeg
+ * scanline buffer.
+ *
+ * @return
+ * A 32-bit Cairo ARGB32 / RGB24 pixel value equivalent to the libjpeg
+ * pixel at the given pointer.
+ */
+static uint32_t guacenc_jpeg_translate_rgb(const unsigned char* src) {
+
+ /* Pull components from source */
+ int r = *(src++);
+ int g = *(src++);
+ int b = *(src++);
+
+ /* Translate to 32-bit integer compatible with Cairo */
+ return 0xFF000000 | (r << 16) | (g << 8) | b;
+
+}
+
+/**
+ * Copies the data from a libjpeg scanline buffer into a row of image data
+ * within a Cairo surface, translating each pixel as necessary.
+ *
+ * @param dst
+ * The destination buffer into which the scanline should be copied.
+ *
+ * @param src
+ * The libjpeg scanline buffer that should be copied into the
+ * destination buffer.
+ *
+ * @param width
+ * The number of pixels available within both the scanline buffer and the
+ * destination buffer.
+ */
+static void guacenc_jpeg_copy_scanline(unsigned char* dst,
+ const unsigned char* src, int width) {
+
+ uint32_t* current = (uint32_t*) dst;
+
+ /* Copy all pixels from source to destination, translating for Cairo */
+ for (; width > 0; width--, src += 3) {
+ *(current++) = guacenc_jpeg_translate_rgb(src);
+ }
+
+}
+
cairo_surface_t* guacenc_jpeg_decoder(unsigned char* data, int length) {
struct jpeg_decompress_struct cinfo;
@@ -52,13 +104,16 @@ cairo_surface_t* guacenc_jpeg_decoder(unsigned char* data, int length) {
}
/* Begin decompression */
- cinfo.out_color_space = JCS_EXT_BGRX;
+ cinfo.out_color_space = JCS_RGB;
jpeg_start_decompress(&cinfo);
/* Pull JPEG dimensions from decompressor */
int width = cinfo.output_width;
int height = cinfo.output_height;
+ /* Allocate sufficient buffer space for one JPEG scanline */
+ unsigned char* jpeg_scanline = malloc(width * 3);
+
/* Create blank Cairo surface (no transparency in JPEG) */
cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24,
width, height);
@@ -69,11 +124,22 @@ cairo_surface_t* guacenc_jpeg_decoder(unsigned char* data, int length) {
/* Read JPEG into surface */
while (cinfo.output_scanline < height) {
- unsigned char* buffers[1] = { row };
+
+ /* Read single scanline */
+ unsigned char* buffers[1] = { jpeg_scanline };
jpeg_read_scanlines(&cinfo, buffers, 1);
+
+ /* Copy scanline to Cairo surface */
+ guacenc_jpeg_copy_scanline(row, jpeg_scanline, width);
+
+ /* Advance to next row of Cairo surface */
row += stride;
+
}
+ /* Scanline buffer is no longer needed */
+ free(jpeg_scanline);
+
/* End decompression */
jpeg_finish_decompress(&cinfo);
[45/50] incubator-guacamole-server git commit: GUAC-1164: Free
private key used for SSH login.
Posted by mj...@apache.org.
GUAC-1164: Free private key used for SSH login.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/e57c9ddd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/e57c9ddd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/e57c9ddd
Branch: refs/heads/master
Commit: e57c9ddd86c1f470752d71f9d9e65658a17c95d5
Parents: 0a4bfc9
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Thu Mar 17 17:15:14 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Thu Mar 17 17:30:32 2016 -0700
----------------------------------------------------------------------
src/common-ssh/guac_ssh_key.c | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/e57c9ddd/src/common-ssh/guac_ssh_key.c
----------------------------------------------------------------------
diff --git a/src/common-ssh/guac_ssh_key.c b/src/common-ssh/guac_ssh_key.c
index adbe041..6c374e3 100644
--- a/src/common-ssh/guac_ssh_key.c
+++ b/src/common-ssh/guac_ssh_key.c
@@ -150,6 +150,7 @@ void guac_common_ssh_key_free(guac_common_ssh_key* key) {
else if (key->type == SSH_KEY_DSA)
DSA_free(key->dsa);
+ free(key->private_key);
free(key->public_key);
free(key);
}
[07/50] incubator-guacamole-server git commit: GUAC-236: Maintain
aspect ratio by adding letterboxes / pillarboxes as necessary.
Posted by mj...@apache.org.
GUAC-236: Maintain aspect ratio by adding letterboxes / pillarboxes as necessary.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/8ed0cd5f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/8ed0cd5f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/8ed0cd5f
Branch: refs/heads/master
Commit: 8ed0cd5f16fdeec3c9d841801ad04c3b45aa7c0d
Parents: 2798536
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Sat Mar 12 21:46:45 2016 -0800
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Mon Mar 14 20:22:04 2016 -0700
----------------------------------------------------------------------
src/guacenc/video.c | 101 +++++++++++++++++++++++++++++++++++++++++------
1 file changed, 88 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/8ed0cd5f/src/guacenc/video.c
----------------------------------------------------------------------
diff --git a/src/guacenc/video.c b/src/guacenc/video.c
index 7c6c0c2..fbf02e0 100644
--- a/src/guacenc/video.c
+++ b/src/guacenc/video.c
@@ -255,18 +255,39 @@ int guacenc_video_advance_timeline(guacenc_video* video,
/**
* Converts the given Guacamole video encoder buffer to a frame in the format
- * required by libavcodec / libswscale. No scaling is performed; the image data
- * is copied verbatim.
+ * required by libavcodec / libswscale. Black margins of the specified sizes
+ * will be added. No scaling is performed; the image data is copied verbatim.
*
* @param buffer
* The guacenc_buffer to copy as a new AVFrame.
*
+ * @param lsize
+ * The size of the letterboxes to add, in pixels. Letterboxes are the
+ * horizontal black boxes added to images which are scaled down to fit the
+ * destination because they are too wide (the width is scaled to exactly
+ * fit the destination, resulting in extra space at the top and bottom).
+ *
+ * @param psize
+ * The size of the pillarboxes to add, in pixels. Pillarboxes are the
+ * vertical black boxes added to images which are scaled down to fit the
+ * destination because they are too tall (the height is scaled to exactly
+ * fit the destination, resulting in extra space on the sides).
+ *
* @return
* A pointer to a newly-allocated AVFrame containing exactly the same image
* data as the given buffer. The image data within the frame and the frame
* itself must be manually freed later.
*/
-static AVFrame* guacenc_video_frame_convert(guacenc_buffer* buffer) {
+static AVFrame* guacenc_video_frame_convert(guacenc_buffer* buffer, int lsize,
+ int psize) {
+
+ /* Init size of left/right pillarboxes */
+ int left = psize;
+ int right = psize;
+
+ /* Init size of top/bottom letterboxes */
+ int top = lsize;
+ int bottom = lsize;
/* Prepare source frame for buffer */
AVFrame* frame = av_frame_alloc();
@@ -275,8 +296,8 @@ static AVFrame* guacenc_video_frame_convert(guacenc_buffer* buffer) {
/* Copy buffer properties to frame */
frame->format = AV_PIX_FMT_RGB32;
- frame->width = buffer->width;
- frame->height = buffer->height;
+ frame->width = buffer->width + left + right;
+ frame->height = buffer->height + top + bottom;
/* Allocate actual backing data for frame */
if (av_image_alloc(frame->data, frame->linesize, frame->width,
@@ -300,16 +321,46 @@ static AVFrame* guacenc_video_frame_convert(guacenc_buffer* buffer) {
int width = buffer->width;
int height = buffer->height;
- /* Source buffer and destination frame dimensions are identical */
- assert(width == frame->width);
- assert(height == frame->height);
+ /* Source buffer is guaranteed to fit within destination buffer */
+ assert(width <= frame->width);
+ assert(height <= frame->height);
+
+ /* Add top margin */
+ while (top > 0) {
+ memset(dst_data, 0, frame->width * 4);
+ dst_data += dst_stride;
+ top--;
+ }
/* Copy all data from source buffer to destination frame */
while (height > 0) {
- memcpy(dst_data, src_data, width * 4);
+
+ /* Calculate size of margin and data regions */
+ int left_size = left * 4;
+ int data_size = width * 4;
+ int right_size = right * 4;
+
+ /* Add left margin */
+ memset(dst_data, 0, left_size);
+
+ /* Copy data */
+ memcpy(dst_data + left_size, src_data, data_size);
+
+ /* Add right margin */
+ memset(dst_data + left_size + data_size, 0, right_size);
+
dst_data += dst_stride;
src_data += src_stride;
+
height--;
+
+ }
+
+ /* Add bottom margin */
+ while (bottom > 0) {
+ memset(dst_data, 0, frame->width * 4);
+ dst_data += dst_stride;
+ bottom--;
}
/* Frame converted */
@@ -319,21 +370,45 @@ static AVFrame* guacenc_video_frame_convert(guacenc_buffer* buffer) {
void guacenc_video_prepare_frame(guacenc_video* video, guacenc_buffer* buffer) {
+ int lsize;
+ int psize;
+
/* Ignore NULL buffers */
if (buffer == NULL || buffer->surface == NULL)
return;
+ /* Obtain destination frame */
+ AVFrame* dst = video->next_frame;
+
+ /* Determine width of image if height is scaled to match destination */
+ int scaled_width = buffer->width * dst->height / buffer->height;
+
+ /* Determine height of image if width is scaled to match destination */
+ int scaled_height = buffer->height * dst->width / buffer->width;
+
+ /* If height-based scaling results in a fit width, add pillarboxes */
+ if (scaled_width <= dst->width) {
+ lsize = 0;
+ psize = (dst->width - scaled_width)
+ * buffer->height / dst->height / 2;
+ }
+
+ /* If width-based scaling results in a fit width, add letterboxes */
+ else {
+ assert(scaled_height <= dst->height);
+ psize = 0;
+ lsize = (dst->height - scaled_height)
+ * buffer->width / dst->width / 2;
+ }
+
/* Prepare source frame for buffer */
- AVFrame* src = guacenc_video_frame_convert(buffer);
+ AVFrame* src = guacenc_video_frame_convert(buffer, lsize, psize);
if (src == NULL) {
guacenc_log(GUAC_LOG_WARNING, "Failed to allocate source frame. "
"Frame dropped.");
return;
}
- /* Obtain destination frame */
- AVFrame* dst = video->next_frame;
-
/* Prepare scaling context */
struct SwsContext* sws = sws_getContext(src->width, src->height,
PIX_FMT_RGB32, dst->width, dst->height, PIX_FMT_YUV420P,
[22/50] incubator-guacamole-server git commit: GUAC-1164:
rdp_disp.[ch] must now be built in all cases.
Posted by mj...@apache.org.
GUAC-1164: rdp_disp.[ch] must now be built in all cases.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/81ebfbb5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/81ebfbb5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/81ebfbb5
Branch: refs/heads/master
Commit: 81ebfbb5ca5beecf9e3eb6799c082d4de4579979
Parents: 4e2b90c
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Tue Mar 15 22:02:35 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Tue Mar 15 22:02:35 2016 -0700
----------------------------------------------------------------------
configure.ac | 5 +----
src/protocols/rdp/Makefile.am | 8 ++------
2 files changed, 3 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/81ebfbb5/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index a818fee..9d36bb8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -437,7 +437,6 @@ if test "x$with_rdp" != "xno"
then
have_winpr=yes
have_freerdp=yes
- have_disp=yes
legacy_freerdp_extensions=no
rdpsettings_interface=unknown
rdpsettings_audioplayback=yes
@@ -554,8 +553,7 @@ then
[AC_DEFINE([HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT],,
[Whether FreeRDP supports the display update channel])]
[AC_CHECK_MEMBERS([rdpSettings.SupportDisplayControl],,,
- [[#include <freerdp/freerdp.h>]])],
- have_disp=no,
+ [[#include <freerdp/freerdp.h>]])],,
[#include <winpr/wtypes.h>
#include <winpr/collections.h>])
fi
@@ -869,7 +867,6 @@ then
fi
AM_CONDITIONAL([LEGACY_FREERDP_EXTENSIONS], [test "x${legacy_freerdp_extensions}" = "xyes"])
-AM_CONDITIONAL([ENABLE_DISPLAY_UPDATE], [test "x${have_disp}" = "xyes"])
AM_CONDITIONAL([ENABLE_WINPR], [test "x${have_winpr}" = "xyes"])
AM_CONDITIONAL([ENABLE_RDP], [test "x${have_freerdp}" = "xyes"])
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/81ebfbb5/src/protocols/rdp/Makefile.am
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/Makefile.am b/src/protocols/rdp/Makefile.am
index 69492a1..3160b57 100644
--- a/src/protocols/rdp/Makefile.am
+++ b/src/protocols/rdp/Makefile.am
@@ -33,6 +33,7 @@ libguac_client_rdp_la_SOURCES = \
rdp_bitmap.c \
rdp_cliprdr.c \
rdp_color.c \
+ rdp_disp.c \
rdp_fs.c \
rdp_gdi.c \
rdp_glyph.c \
@@ -87,6 +88,7 @@ noinst_HEADERS = \
rdp_bitmap.h \
rdp_cliprdr.h \
rdp_color.h \
+ rdp_disp.h \
rdp_fs.h \
rdp_gdi.h \
rdp_glyph.h \
@@ -110,12 +112,6 @@ guacsnd_sources += compat/winpr-stream.c
guacdr_sources += compat/winpr-stream.c
endif
-# Add display update channel support, if supported by FreeRDP
-if ENABLE_DISPLAY_UPDATE
-noinst_HEADERS += rdp_disp.h
-libguac_client_rdp_la_SOURCES += rdp_disp.c
-endif
-
#
# Main RDP client library
#
[32/50] incubator-guacamole-server git commit: GUAC-1164: Do not load
display update channel unless needed.
Posted by mj...@apache.org.
GUAC-1164: Do not load display update channel unless needed.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/3997e448
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/3997e448
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/3997e448
Branch: refs/heads/master
Commit: 3997e44810bd1c81e7c971434fa8a7fd90eafe86
Parents: de78a6e
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Wed Mar 16 15:02:13 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Wed Mar 16 15:02:13 2016 -0700
----------------------------------------------------------------------
src/protocols/rdp/rdp.c | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/3997e448/src/protocols/rdp/rdp.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp.c b/src/protocols/rdp/rdp.c
index ab5734f..494a28d 100644
--- a/src/protocols/rdp/rdp.c
+++ b/src/protocols/rdp/rdp.c
@@ -201,16 +201,18 @@ static void guac_rdp_channel_connected(rdpContext* context,
BOOL rdp_freerdp_pre_connect(freerdp* instance) {
rdpContext* context = instance->context;
- guac_client* client = ((rdp_freerdp_context*) context)->client;
rdpChannels* channels = context->channels;
+
+ guac_client* client = ((rdp_freerdp_context*) context)->client;
+ guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
+ guac_rdp_settings* settings = rdp_client->settings;
+
rdpBitmap* bitmap;
rdpGlyph* glyph;
rdpPointer* pointer;
rdpPrimaryUpdate* primary;
CLRCONV* clrconv;
- guac_rdp_client* rdp_client =
- (guac_rdp_client*) client->data;
#ifdef HAVE_FREERDP_REGISTER_ADDIN_PROVIDER
/* Init FreeRDP add-in provider */
@@ -229,8 +231,9 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) {
guac_client_log(client, GUAC_LOG_WARNING,
"Failed to load drdynvc plugin.");
- /* Init display update plugin (if available) */
- guac_rdp_disp_load_plugin(instance->context);
+ /* Init display update plugin (if available and required) */
+ if (settings->resize_method == GUAC_RESIZE_DISPLAY_UPDATE)
+ guac_rdp_disp_load_plugin(instance->context);
/* Load clipboard plugin */
if (freerdp_channels_load_plugin(channels, instance->settings,
@@ -239,7 +242,7 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) {
"Failed to load cliprdr plugin. Clipboard will not work.");
/* If audio enabled, choose an encoder */
- if (rdp_client->settings->audio_enabled) {
+ if (settings->audio_enabled) {
rdp_client->audio = guac_audio_stream_alloc(client, NULL,
GUAC_RDP_AUDIO_RATE,
@@ -254,15 +257,15 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) {
} /* end if audio enabled */
/* Load filesystem if drive enabled */
- if (rdp_client->settings->drive_enabled)
+ if (settings->drive_enabled)
rdp_client->filesystem =
- guac_rdp_fs_alloc(client, rdp_client->settings->drive_path,
- rdp_client->settings->create_drive_path);
+ guac_rdp_fs_alloc(client, settings->drive_path,
+ settings->create_drive_path);
/* If RDPSND/RDPDR required, load them */
- if (rdp_client->settings->printing_enabled
- || rdp_client->settings->drive_enabled
- || rdp_client->settings->audio_enabled) {
+ if (settings->printing_enabled
+ || settings->drive_enabled
+ || settings->audio_enabled) {
/* Load RDPDR plugin */
if (freerdp_channels_load_plugin(channels, instance->settings,
@@ -282,15 +285,15 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) {
}
/* Load RAIL plugin if RemoteApp in use */
- if (rdp_client->settings->remote_app != NULL) {
+ if (settings->remote_app != NULL) {
#ifdef LEGACY_FREERDP
RDP_PLUGIN_DATA* plugin_data = malloc(sizeof(RDP_PLUGIN_DATA) * 2);
plugin_data[0].size = sizeof(RDP_PLUGIN_DATA);
- plugin_data[0].data[0] = rdp_client->settings->remote_app;
- plugin_data[0].data[1] = rdp_client->settings->remote_app_dir;
- plugin_data[0].data[2] = rdp_client->settings->remote_app_args;
+ plugin_data[0].data[0] = settings->remote_app;
+ plugin_data[0].data[1] = settings->remote_app_dir;
+ plugin_data[0].data[2] = settings->remote_app_args;
plugin_data[0].data[3] = NULL;
plugin_data[1].size = 0;
@@ -311,9 +314,9 @@ BOOL rdp_freerdp_pre_connect(freerdp* instance) {
}
/* Load SVC plugin instances for all static channels */
- if (rdp_client->settings->svc_names != NULL) {
+ if (settings->svc_names != NULL) {
- char** current = rdp_client->settings->svc_names;
+ char** current = settings->svc_names;
do {
guac_rdp_svc* svc = guac_rdp_alloc_svc(client, *current);
[04/50] incubator-guacamole-server git commit: GUAC-236: Add
generalized ffmpeg-compat.h header to cover various API changes.
Posted by mj...@apache.org.
GUAC-236: Add generalized ffmpeg-compat.h header to cover various API changes.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/570bcc38
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/570bcc38
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/570bcc38
Branch: refs/heads/master
Commit: 570bcc3822dc5ee07d0fb0260b36ad32240720ce
Parents: 770fec0
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Mon Mar 14 01:33:27 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Mon Mar 14 20:22:04 2016 -0700
----------------------------------------------------------------------
src/guacenc/Makefile.am | 25 ++++++++++---------
src/guacenc/ffmpeg-compat.h | 53 ++++++++++++++++++++++++++++++++++++++++
src/guacenc/video.c | 7 +-----
3 files changed, 67 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/570bcc38/src/guacenc/Makefile.am
----------------------------------------------------------------------
diff --git a/src/guacenc/Makefile.am b/src/guacenc/Makefile.am
index 7219911..1230992 100644
--- a/src/guacenc/Makefile.am
+++ b/src/guacenc/Makefile.am
@@ -27,18 +27,19 @@ bin_PROGRAMS = guacenc
man_MANS = \
man/guacenc.1
-noinst_HEADERS = \
- buffer.h \
- display.h \
- encode.h \
- guacenc.h \
- image-stream.h \
- instructions.h \
- jpeg.h \
- layer.h \
- log.h \
- parse.h \
- png.h \
+noinst_HEADERS = \
+ buffer.h \
+ display.h \
+ encode.h \
+ ffmpeg-compat.h \
+ guacenc.h \
+ image-stream.h \
+ instructions.h \
+ jpeg.h \
+ layer.h \
+ log.h \
+ parse.h \
+ png.h \
video.h
guacenc_SOURCES = \
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/570bcc38/src/guacenc/ffmpeg-compat.h
----------------------------------------------------------------------
diff --git a/src/guacenc/ffmpeg-compat.h b/src/guacenc/ffmpeg-compat.h
new file mode 100644
index 0000000..ba3213a
--- /dev/null
+++ b/src/guacenc/ffmpeg-compat.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2016 Glyptodon, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef GUACENC_FFMPEG_COMPAT_H
+#define GUACENC_FFMPEG_COMPAT_H
+
+#include "config.h"
+
+#include <libavcodec/avcodec.h>
+
+/*
+ * For a full list of FFmpeg API changes over the years, see:
+ *
+ * https://github.com/FFmpeg/FFmpeg/blob/master/doc/APIchanges
+ */
+
+/* For libavcodec < 55.28.1: av_frame_*() was avcodec_*_frame(). */
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1)
+#define av_frame_alloc avcodec_alloc_frame
+#define av_frame_free avcodec_free_frame
+#endif
+
+/* For libavcodec < 55.52.0: avcodec_free_context did not exist */
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,52,0)
+#define avcodec_free_context av_freep
+#endif
+
+/* For libavcodec < 57.7.0: av_packet_unref() was av_free_packet() */
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57,7,0)
+#define av_packet_unref av_free_packet
+#endif
+
+#endif
+
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/570bcc38/src/guacenc/video.c
----------------------------------------------------------------------
diff --git a/src/guacenc/video.c b/src/guacenc/video.c
index a99cd4e..99d990e 100644
--- a/src/guacenc/video.c
+++ b/src/guacenc/video.c
@@ -22,6 +22,7 @@
#include "config.h"
#include "buffer.h"
+#include "ffmpeg-compat.h"
#include "log.h"
#include "video.h"
@@ -38,12 +39,6 @@
#include <stdio.h>
#include <stdlib.h>
-/* Define av_frame_alloc() / av_frame_free() if libavcodec is old */
-#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1)
-#define av_frame_alloc avcodec_alloc_frame
-#define av_frame_free avcodec_free_frame
-#endif
-
guacenc_video* guacenc_video_alloc(const char* path, const char* codec_name,
int width, int height, int bitrate) {
[16/50] incubator-guacamole-server git commit: GUAC-236: Fix
copypasto in guacenc_display_free_*() - we are freeing, not allocating.
Posted by mj...@apache.org.
GUAC-236: Fix copypasto in guacenc_display_free_*() - we are freeing, not allocating.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/86eb9c4b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/86eb9c4b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/86eb9c4b
Branch: refs/heads/master
Commit: 86eb9c4b8abd75b42ec5f3315cba4ce1c22f2a70
Parents: 32779ee
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Tue Mar 15 19:35:06 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Tue Mar 15 19:35:06 2016 -0700
----------------------------------------------------------------------
src/guacenc/display-buffers.c | 2 +-
src/guacenc/display-layers.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/86eb9c4b/src/guacenc/display-buffers.c
----------------------------------------------------------------------
diff --git a/src/guacenc/display-buffers.c b/src/guacenc/display-buffers.c
index 9fd8663..5bd68d3 100644
--- a/src/guacenc/display-buffers.c
+++ b/src/guacenc/display-buffers.c
@@ -71,7 +71,7 @@ int guacenc_display_free_buffer(guacenc_display* display,
/* Transform index to buffer space */
int internal_index = -index - 1;
- /* Do not lookup / allocate if index is invalid */
+ /* Do not lookup / free if index is invalid */
if (internal_index < 0 || internal_index > GUACENC_DISPLAY_MAX_BUFFERS) {
guacenc_log(GUAC_LOG_WARNING, "Buffer index out of bounds: %i", index);
return 1;
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/86eb9c4b/src/guacenc/display-layers.c
----------------------------------------------------------------------
diff --git a/src/guacenc/display-layers.c b/src/guacenc/display-layers.c
index 23b43e7..e0406f8 100644
--- a/src/guacenc/display-layers.c
+++ b/src/guacenc/display-layers.c
@@ -84,7 +84,7 @@ int guacenc_display_get_depth(guacenc_display* display, guacenc_layer* layer) {
int guacenc_display_free_layer(guacenc_display* display,
int index) {
- /* Do not lookup / allocate if index is invalid */
+ /* Do not lookup / free if index is invalid */
if (index < 0 || index > GUACENC_DISPLAY_MAX_LAYERS) {
guacenc_log(GUAC_LOG_WARNING, "Layer index out of bounds: %i", index);
return 1;
[25/50] incubator-guacamole-server git commit: GUAC-236: Add missing
documentation for screen recording parameters of VNC and RDP.
Posted by mj...@apache.org.
GUAC-236: Add missing documentation for screen recording parameters of VNC and RDP.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/534d0e58
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/534d0e58
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/534d0e58
Branch: refs/heads/master
Commit: 534d0e580e4936def3cf1b5ed729c7fafde9ce7e
Parents: f5f77fe
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Wed Mar 16 10:26:10 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Wed Mar 16 10:26:10 2016 -0700
----------------------------------------------------------------------
src/protocols/rdp/rdp_settings.c | 14 ++++++++++++++
src/protocols/vnc/settings.c | 14 ++++++++++++++
2 files changed, 28 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/534d0e58/src/protocols/rdp/rdp_settings.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp_settings.c b/src/protocols/rdp/rdp_settings.c
index 0e90f4d..728c9a6 100644
--- a/src/protocols/rdp/rdp_settings.c
+++ b/src/protocols/rdp/rdp_settings.c
@@ -356,8 +356,22 @@ enum RDP_ARGS_IDX {
#endif
+ /**
+ * The full absolute path to the directory in which screen recordings
+ * should be written.
+ */
IDX_RECORDING_PATH,
+
+ /**
+ * The name that should be given to screen recording which are written in
+ * the given path.
+ */
IDX_RECORDING_NAME,
+
+ /**
+ * Whether the specified screen recording path should automatically be
+ * created if it does not yet exist.
+ */
IDX_CREATE_RECORDING_PATH,
RDP_ARGS_COUNT
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/534d0e58/src/protocols/vnc/settings.c
----------------------------------------------------------------------
diff --git a/src/protocols/vnc/settings.c b/src/protocols/vnc/settings.c
index ffff562..c183906 100644
--- a/src/protocols/vnc/settings.c
+++ b/src/protocols/vnc/settings.c
@@ -232,8 +232,22 @@ enum VNC_ARGS_IDX {
IDX_SFTP_DIRECTORY,
#endif
+ /**
+ * The full absolute path to the directory in which screen recordings
+ * should be written.
+ */
IDX_RECORDING_PATH,
+
+ /**
+ * The name that should be given to screen recording which are written in
+ * the given path.
+ */
IDX_RECORDING_NAME,
+
+ /**
+ * Whether the specified screen recording path should automatically be
+ * created if it does not yet exist.
+ */
IDX_CREATE_RECORDING_PATH,
VNC_ARGS_COUNT
[39/50] incubator-guacamole-server git commit: GUAC-236: Do not
attempt to lock/close fd if open fails.
Posted by mj...@apache.org.
GUAC-236: Do not attempt to lock/close fd if open fails.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/1dfdcec3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/1dfdcec3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/1dfdcec3
Branch: refs/heads/master
Commit: 1dfdcec34ccf097d5e3a9e16e0bb6b93a3415883
Parents: 55f5d1c
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Wed Mar 16 21:52:30 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Wed Mar 16 21:52:30 2016 -0700
----------------------------------------------------------------------
src/common/guac_recording.c | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/1dfdcec3/src/common/guac_recording.c
----------------------------------------------------------------------
diff --git a/src/common/guac_recording.c b/src/common/guac_recording.c
index 461b80e..709375f 100644
--- a/src/common/guac_recording.c
+++ b/src/common/guac_recording.c
@@ -104,6 +104,10 @@ static int guac_common_recording_open(const char* path,
}
+ /* Abort if we've run out of filenames */
+ if (fd == -1)
+ return -1;
+
} /* end if open succeeded */
/* Lock entire output file for writing by the current process */
[08/50] incubator-guacamole-server git commit: GUAC-236: Add screen
recording support to telnet.
Posted by mj...@apache.org.
GUAC-236: Add screen recording support to telnet.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/e3d1af19
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/e3d1af19
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/e3d1af19
Branch: refs/heads/master
Commit: e3d1af1953c238c6add5e44db317607ea5611df4
Parents: 570bcc3
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Mon Mar 14 20:26:31 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Mon Mar 14 20:26:31 2016 -0700
----------------------------------------------------------------------
src/protocols/telnet/settings.c | 40 ++++++++++++++++++++++++++++++++++++
src/protocols/telnet/settings.h | 22 ++++++++++++++++++++
src/protocols/telnet/telnet.c | 9 ++++++++
3 files changed, 71 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/e3d1af19/src/protocols/telnet/settings.c
----------------------------------------------------------------------
diff --git a/src/protocols/telnet/settings.c b/src/protocols/telnet/settings.c
index 38fbc22..edb74de 100644
--- a/src/protocols/telnet/settings.c
+++ b/src/protocols/telnet/settings.c
@@ -46,6 +46,9 @@ const char* GUAC_TELNET_CLIENT_ARGS[] = {
"typescript-path",
"typescript-name",
"create-typescript-path",
+ "recording-path",
+ "recording-name",
+ "create-recording-path",
NULL
};
@@ -120,6 +123,24 @@ enum TELNET_ARGS_IDX {
*/
IDX_CREATE_TYPESCRIPT_PATH,
+ /**
+ * The full absolute path to the directory in which screen recordings
+ * should be written.
+ */
+ IDX_RECORDING_PATH,
+
+ /**
+ * The name that should be given to screen recording which are written in
+ * the given path.
+ */
+ IDX_RECORDING_NAME,
+
+ /**
+ * Whether the specified screen recording path should automatically be
+ * created if it does not yet exist.
+ */
+ IDX_CREATE_RECORDING_PATH,
+
TELNET_ARGS_COUNT
};
@@ -239,6 +260,21 @@ guac_telnet_settings* guac_telnet_parse_args(guac_user* user,
guac_user_parse_args_boolean(user, GUAC_TELNET_CLIENT_ARGS, argv,
IDX_CREATE_TYPESCRIPT_PATH, false);
+ /* Read recording path */
+ settings->recording_path =
+ guac_user_parse_args_string(user, GUAC_TELNET_CLIENT_ARGS, argv,
+ IDX_RECORDING_PATH, NULL);
+
+ /* Read recording name */
+ settings->recording_name =
+ guac_user_parse_args_string(user, GUAC_TELNET_CLIENT_ARGS, argv,
+ IDX_RECORDING_NAME, GUAC_TELNET_DEFAULT_RECORDING_NAME);
+
+ /* Parse path creation flag */
+ settings->create_recording_path =
+ guac_user_parse_args_boolean(user, GUAC_TELNET_CLIENT_ARGS, argv,
+ IDX_CREATE_RECORDING_PATH, false);
+
/* Parsing was successful */
return settings;
@@ -274,6 +310,10 @@ void guac_telnet_settings_free(guac_telnet_settings* settings) {
free(settings->typescript_name);
free(settings->typescript_path);
+ /* Free screen recording settings */
+ free(settings->recording_name);
+ free(settings->recording_path);
+
/* Free overall structure */
free(settings);
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/e3d1af19/src/protocols/telnet/settings.h
----------------------------------------------------------------------
diff --git a/src/protocols/telnet/settings.h b/src/protocols/telnet/settings.h
index 5406220..3bf388d 100644
--- a/src/protocols/telnet/settings.h
+++ b/src/protocols/telnet/settings.h
@@ -54,6 +54,11 @@
#define GUAC_TELNET_DEFAULT_TYPESCRIPT_NAME "typescript"
/**
+ * The filename to use for the screen recording, if not specified.
+ */
+#define GUAC_TELNET_DEFAULT_RECORDING_NAME "recording"
+
+/**
* The regular expression to use when searching for the username/login prompt
* if no other regular expression is specified.
*/
@@ -157,6 +162,23 @@ typedef struct guac_telnet_settings {
*/
bool create_typescript_path;
+ /**
+ * The path in which the screen recording should be saved, if enabled. If
+ * no screen recording should be saved, this will be NULL.
+ */
+ char* recording_path;
+
+ /**
+ * The filename to use for the screen recording, if enabled.
+ */
+ char* recording_name;
+
+ /**
+ * Whether the screen recording path should be automatically created if it
+ * does not already exist.
+ */
+ bool create_recording_path;
+
} guac_telnet_settings;
/**
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/e3d1af19/src/protocols/telnet/telnet.c
----------------------------------------------------------------------
diff --git a/src/protocols/telnet/telnet.c b/src/protocols/telnet/telnet.c
index 526000d..7ba0720 100644
--- a/src/protocols/telnet/telnet.c
+++ b/src/protocols/telnet/telnet.c
@@ -21,6 +21,7 @@
*/
#include "config.h"
+#include "guac_recording.h"
#include "telnet.h"
#include "terminal.h"
@@ -468,6 +469,14 @@ void* guac_telnet_client_thread(void* data) {
char buffer[8192];
int wait_result;
+ /* Set up screen recording, if requested */
+ if (settings->recording_path != NULL) {
+ guac_common_recording_create(client,
+ settings->recording_path,
+ settings->recording_name,
+ settings->create_recording_path);
+ }
+
/* Create terminal */
telnet_client->term = guac_terminal_create(client,
settings->font_name, settings->font_size,
[27/50] incubator-guacamole-server git commit: Merge pull request
#126 from glyptodon/recording-docs
Posted by mj...@apache.org.
Merge pull request #126 from glyptodon/recording-docs
GUAC-236: Add missing documentation for screen recording parameters of VNC and RDP.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/a1822c5a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/a1822c5a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/a1822c5a
Branch: refs/heads/master
Commit: a1822c5a2cff843a32f1afb7231bdc625aebed07
Parents: f5f77fe 0a5e573
Author: James Muehlner <ja...@guac-dev.org>
Authored: Wed Mar 16 10:55:35 2016 -0700
Committer: James Muehlner <ja...@guac-dev.org>
Committed: Wed Mar 16 10:55:35 2016 -0700
----------------------------------------------------------------------
src/protocols/rdp/rdp_settings.c | 14 ++++++++++++++
src/protocols/ssh/settings.c | 2 +-
src/protocols/telnet/settings.c | 2 +-
src/protocols/vnc/settings.c | 14 ++++++++++++++
4 files changed, 30 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[49/50] incubator-guacamole-server git commit: GUAC-1164: Init/uninit
common SSH client only once. Do not touch display if RDP server is not
connected.
Posted by mj...@apache.org.
GUAC-1164: Init/uninit common SSH client only once. Do not touch display if RDP server is not connected.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/1cb43254
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/1cb43254
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/1cb43254
Branch: refs/heads/master
Commit: 1cb4325422270f6305ad94bd3bce6dfa89cb2c37
Parents: 0a1f01c
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Thu Mar 17 18:29:27 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Thu Mar 17 18:29:27 2016 -0700
----------------------------------------------------------------------
src/protocols/rdp/input.c | 6 +++---
src/protocols/rdp/rdp.c | 21 +++++++++++----------
2 files changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/1cb43254/src/protocols/rdp/input.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/input.c b/src/protocols/rdp/input.c
index 8a8cbaf..6aff96b 100644
--- a/src/protocols/rdp/input.c
+++ b/src/protocols/rdp/input.c
@@ -165,9 +165,6 @@ int guac_rdp_user_mouse_handler(guac_user* user, int x, int y, int mask) {
pthread_mutex_lock(&(rdp_client->rdp_lock));
- /* Store current mouse location */
- guac_common_cursor_move(rdp_client->display->cursor, user, x, y);
-
/* Skip if not yet connected */
freerdp* rdp_inst = rdp_client->rdp_inst;
if (rdp_inst == NULL) {
@@ -175,6 +172,9 @@ int guac_rdp_user_mouse_handler(guac_user* user, int x, int y, int mask) {
return 0;
}
+ /* Store current mouse location */
+ guac_common_cursor_move(rdp_client->display->cursor, user, x, y);
+
/* If button mask unchanged, just send move event */
if (mask == rdp_client->mouse_button_mask)
rdp_inst->input->MouseEvent(rdp_inst->input, PTR_FLAGS_MOVE, x, y);
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/1cb43254/src/protocols/rdp/rdp.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp.c b/src/protocols/rdp/rdp.c
index 80158db..4654fc8 100644
--- a/src/protocols/rdp/rdp.c
+++ b/src/protocols/rdp/rdp.c
@@ -764,8 +764,6 @@ static int guac_rdp_handle_connection(guac_client* client) {
__guac_rdp_client_load_keymap(client, settings->server_layout);
#ifdef ENABLE_COMMON_SSH
- guac_common_ssh_init(client);
-
/* Connect via SSH if SFTP is enabled */
if (settings->enable_sftp) {
@@ -993,6 +991,7 @@ static int guac_rdp_handle_connection(guac_client* client) {
/* Clean up RDP client */
freerdp_free(rdp_inst);
+ rdp_client->rdp_inst = NULL;
/* Clean up filesystem, if allocated */
if (rdp_client->filesystem != NULL)
@@ -1014,8 +1013,6 @@ static int guac_rdp_handle_connection(guac_client* client) {
/* Free SFTP user */
if (rdp_client->sftp_user)
guac_common_ssh_destroy_user(rdp_client->sftp_user);
-
- guac_common_ssh_uninit();
#endif
/* Free SVC list */
@@ -1024,9 +1021,6 @@ static int guac_rdp_handle_connection(guac_client* client) {
/* Free display */
guac_common_display_free(rdp_client->display);
- /* Mark FreeRDP instance as freed */
- rdp_client->rdp_inst = NULL;
-
pthread_mutex_unlock(&(rdp_client->rdp_lock));
return 0;
@@ -1036,13 +1030,20 @@ void* guac_rdp_client_thread(void* data) {
guac_client* client = (guac_client*) data;
- while (client->state == GUAC_CLIENT_RUNNING) {
+#ifdef ENABLE_COMMON_SSH
+ guac_common_ssh_init(client);
+#endif
+ /* Continue handling connections until error or client disconnect */
+ while (client->state == GUAC_CLIENT_RUNNING) {
if (guac_rdp_handle_connection(client))
- return NULL;
-
+ break;
}
+#ifdef ENABLE_COMMON_SSH
+ guac_common_ssh_uninit();
+#endif
+
return NULL;
}
[37/50] incubator-guacamole-server git commit: Merge pull request
#129 from glyptodon/rdp-resize
Posted by mj...@apache.org.
Merge pull request #129 from glyptodon/rdp-resize
GUAC-1164: Add parameter for automatically reconnecting when display changes
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/55f5d1cc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/55f5d1cc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/55f5d1cc
Branch: refs/heads/master
Commit: 55f5d1cca331a3dfdbffbf25a923c173cf352d2c
Parents: b63763c c336ce3
Author: James Muehlner <ja...@guac-dev.org>
Authored: Wed Mar 16 21:37:06 2016 -0700
Committer: James Muehlner <ja...@guac-dev.org>
Committed: Wed Mar 16 21:37:06 2016 -0700
----------------------------------------------------------------------
configure.ac | 5 +-
src/common/guac_cursor.c | 14 ++-
src/common/guac_display.c | 3 +
src/protocols/rdp/Makefile.am | 8 +-
src/protocols/rdp/client.c | 57 ++---------
src/protocols/rdp/input.c | 51 +++++-----
src/protocols/rdp/rdp.c | 187 ++++++++++++++++++++++++----------
src/protocols/rdp/rdp.h | 11 +-
src/protocols/rdp/rdp_disp.c | 99 ++++++++++++------
src/protocols/rdp/rdp_disp.h | 93 +++++++++++++----
src/protocols/rdp/rdp_settings.c | 32 ++++++
src/protocols/rdp/rdp_settings.h | 31 ++++++
12 files changed, 391 insertions(+), 200 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/55f5d1cc/src/protocols/rdp/rdp_settings.c
----------------------------------------------------------------------
diff --cc src/protocols/rdp/rdp_settings.c
index 70902f8,7cedb7c..133da61
--- a/src/protocols/rdp/rdp_settings.c
+++ b/src/protocols/rdp/rdp_settings.c
@@@ -356,24 -357,16 +357,30 @@@ enum RDP_ARGS_IDX
#endif
+ /**
+ * The full absolute path to the directory in which screen recordings
+ * should be written.
+ */
IDX_RECORDING_PATH,
+
+ /**
+ * The name that should be given to screen recordings which are written in
+ * the given path.
+ */
IDX_RECORDING_NAME,
+
+ /**
+ * Whether the specified screen recording path should automatically be
+ * created if it does not yet exist.
+ */
IDX_CREATE_RECORDING_PATH,
+ /**
+ * The method to use to apply screen size changes requested by the user.
+ * Valid values are blank, "display-update", and "reconnect".
+ */
+ IDX_RESIZE_METHOD,
+
RDP_ARGS_COUNT
};
[17/50] incubator-guacamole-server git commit: GUAC-236: They're
buffers, not buggers.
Posted by mj...@apache.org.
GUAC-236: They're buffers, not buggers.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/e2030c03
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/e2030c03
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/e2030c03
Branch: refs/heads/master
Commit: e2030c03d020612881029e8df9c385eedea14e0a
Parents: 86eb9c4
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Tue Mar 15 20:34:22 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Tue Mar 15 20:34:22 2016 -0700
----------------------------------------------------------------------
src/guacenc/display.h | 2 +-
src/guacenc/image-stream.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/e2030c03/src/guacenc/display.h
----------------------------------------------------------------------
diff --git a/src/guacenc/display.h b/src/guacenc/display.h
index b8956d7..266c213 100644
--- a/src/guacenc/display.h
+++ b/src/guacenc/display.h
@@ -293,7 +293,7 @@ guacenc_buffer* guacenc_display_get_related_buffer(guacenc_display* display,
* when drawing the image.
*
* @param layer_index
- * The index of the layer or bugger that the image should be drawn to.
+ * The index of the layer or buffer that the image should be drawn to.
*
* @param mimetype
* The mimetype of the image data that will be received along this stream.
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/e2030c03/src/guacenc/image-stream.h
----------------------------------------------------------------------
diff --git a/src/guacenc/image-stream.h b/src/guacenc/image-stream.h
index ff36ee1..888b15c 100644
--- a/src/guacenc/image-stream.h
+++ b/src/guacenc/image-stream.h
@@ -154,7 +154,7 @@ guacenc_decoder* guacenc_get_decoder(const char* mimetype);
* when drawing the image.
*
* @param index
- * The index of the layer or bugger that the image should be drawn to.
+ * The index of the layer or buffer that the image should be drawn to.
*
* @param mimetype
* The mimetype of the image data that will be received along this stream.
[41/50] incubator-guacamole-server git commit: Merge pull request
#130 from glyptodon/out-of-bounds
Posted by mj...@apache.org.
Merge pull request #130 from glyptodon/out-of-bounds
GUAC-236: Do not exceed available buffers/layers/streams.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/3614c482
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/3614c482
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/3614c482
Branch: refs/heads/master
Commit: 3614c48240c027940a27f7bb031be168a62d421e
Parents: 5a3bc7a ec2524e
Author: James Muehlner <ja...@guac-dev.org>
Authored: Wed Mar 16 22:10:37 2016 -0700
Committer: James Muehlner <ja...@guac-dev.org>
Committed: Wed Mar 16 22:10:37 2016 -0700
----------------------------------------------------------------------
src/guacenc/display-buffers.c | 4 ++--
src/guacenc/display-image-streams.c | 6 +++---
src/guacenc/display-layers.c | 4 ++--
3 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
[23/50] incubator-guacamole-server git commit: GUAC-1164: Do not
include disply update channel functionsn unless display update channel
support is present.
Posted by mj...@apache.org.
GUAC-1164: Do not include disply update channel functionsn unless display update channel support is present.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/fc71dcad
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/fc71dcad
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/fc71dcad
Branch: refs/heads/master
Commit: fc71dcadb00fe892400ed8ea0290aad88102f6f8
Parents: 81ebfbb
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Tue Mar 15 22:07:38 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Tue Mar 15 22:07:38 2016 -0700
----------------------------------------------------------------------
src/protocols/rdp/rdp_disp.c | 2 ++
src/protocols/rdp/rdp_disp.h | 2 ++
2 files changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/fc71dcad/src/protocols/rdp/rdp_disp.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp_disp.c b/src/protocols/rdp/rdp_disp.c
index ee2d627..cd18cb3 100644
--- a/src/protocols/rdp/rdp_disp.c
+++ b/src/protocols/rdp/rdp_disp.c
@@ -72,9 +72,11 @@ void guac_rdp_disp_load_plugin(rdpContext* context) {
}
+#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
void guac_rdp_disp_connect(guac_rdp_disp* guac_disp, DispClientContext* disp) {
guac_disp->disp = disp;
}
+#endif
/**
* Fits a given dimension within the allowed bounds for Display Update
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/fc71dcad/src/protocols/rdp/rdp_disp.h
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp_disp.h b/src/protocols/rdp/rdp_disp.h
index b2516b5..d246271 100644
--- a/src/protocols/rdp/rdp_disp.h
+++ b/src/protocols/rdp/rdp_disp.h
@@ -107,6 +107,7 @@ void guac_rdp_disp_free(guac_rdp_disp* disp);
*/
void guac_rdp_disp_load_plugin(rdpContext* context);
+#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
/**
* Stores the given DispClientContext within the given guac_rdp_disp, such that
* display updates can be properly sent. Until this is called, changes to the
@@ -118,6 +119,7 @@ void guac_rdp_disp_load_plugin(rdpContext* context);
* display update channel.
*/
void guac_rdp_disp_connect(guac_rdp_disp* guac_disp, DispClientContext* disp);
+#endif
/**
* Requests a display size update, which may then be sent immediately to the
[10/50] incubator-guacamole-server git commit: GUAC-236: Correct
typos in comments.
Posted by mj...@apache.org.
GUAC-236: Correct typos in comments.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/acf2d2b0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/acf2d2b0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/acf2d2b0
Branch: refs/heads/master
Commit: acf2d2b0044980ad2f5a3d29053351c73df281e7
Parents: e3d1af1
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Tue Mar 15 12:26:13 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Tue Mar 15 12:26:13 2016 -0700
----------------------------------------------------------------------
src/guacenc/guacenc.c | 2 +-
src/guacenc/image-stream.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/acf2d2b0/src/guacenc/guacenc.c
----------------------------------------------------------------------
diff --git a/src/guacenc/guacenc.c b/src/guacenc/guacenc.c
index 1c825bb..c552505 100644
--- a/src/guacenc/guacenc.c
+++ b/src/guacenc/guacenc.c
@@ -45,7 +45,7 @@ int main(int argc, char* argv[]) {
int opt;
while ((opt = getopt(argc, argv, "s:r:")) != -1) {
- /* -d: Dimensions */
+ /* -s: Dimensions (WIDTHxHEIGHT) */
if (opt == 's') {
if (guacenc_parse_dimensions(optarg, &width, &height)) {
guacenc_log(GUAC_LOG_ERROR, "Invalid dimensions.");
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/acf2d2b0/src/guacenc/image-stream.h
----------------------------------------------------------------------
diff --git a/src/guacenc/image-stream.h b/src/guacenc/image-stream.h
index 26660eb..ff36ee1 100644
--- a/src/guacenc/image-stream.h
+++ b/src/guacenc/image-stream.h
@@ -30,7 +30,7 @@
/**
* The initial number of bytes to allocate for the image data buffer. If this
- * buffer is not sufficiently larged, it will be dynamically reallocated as it
+ * buffer is not sufficiently large, it will be dynamically reallocated as it
* grows.
*/
#define GUACENC_IMAGE_STREAM_INITIAL_LENGTH 4096
[02/50] incubator-guacamole-server git commit: GUAC-236: Implement
JPEG.
Posted by mj...@apache.org.
GUAC-236: Implement JPEG.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/be0a9e72
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/be0a9e72
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/be0a9e72
Branch: refs/heads/master
Commit: be0a9e728f5f06aa8b4277e13e053140627e0b54
Parents: c16832f
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Sat Mar 12 19:55:17 2016 -0800
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Mon Mar 14 20:22:03 2016 -0700
----------------------------------------------------------------------
src/guacenc/jpeg.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 55 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/be0a9e72/src/guacenc/jpeg.c
----------------------------------------------------------------------
diff --git a/src/guacenc/jpeg.c b/src/guacenc/jpeg.c
index 706e21c..dfed2d1 100644
--- a/src/guacenc/jpeg.c
+++ b/src/guacenc/jpeg.c
@@ -22,13 +22,66 @@
#include "config.h"
#include "jpeg.h"
+#include "log.h"
+
+#include <stdio.h>
+#include <unistd.h>
#include <cairo/cairo.h>
+#include <jpeglib.h>
#include <stdlib.h>
cairo_surface_t* guacenc_jpeg_decoder(unsigned char* data, int length) {
- /* STUB */
- return NULL;
+
+ struct jpeg_decompress_struct cinfo;
+ struct jpeg_error_mgr jerr;
+
+ /* Create decompressor with standard error handling */
+ jpeg_create_decompress(&cinfo);
+ cinfo.err = jpeg_std_error(&jerr);
+
+ /* Read JPEG directly from memory buffer */
+ jpeg_mem_src(&cinfo, data, length);
+
+ /* Read and validate JPEG header */
+ if (!jpeg_read_header(&cinfo, TRUE)) {
+ guacenc_log(GUAC_LOG_WARNING, "Invalid JPEG data");
+ jpeg_destroy_decompress(&cinfo);
+ return NULL;
+ }
+
+ /* Begin decompression */
+ cinfo.out_color_space = JCS_EXT_BGRX;
+ jpeg_start_decompress(&cinfo);
+
+ /* Pull JPEG dimensions from decompressor */
+ int width = cinfo.output_width;
+ int height = cinfo.output_height;
+
+ /* Create blank Cairo surface (no transparency in JPEG) */
+ cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24,
+ width, height);
+
+ /* Pull underlying buffer and its stride */
+ int stride = cairo_image_surface_get_stride(surface);
+ unsigned char* row = cairo_image_surface_get_data(surface);
+
+ /* Read JPEG into surface */
+ while (cinfo.output_scanline < height) {
+ unsigned char* buffers[1] = { row };
+ jpeg_read_scanlines(&cinfo, buffers, 1);
+ row += stride;
+ }
+
+ /* End decompression */
+ jpeg_finish_decompress(&cinfo);
+
+ /* Free decompressor */
+ jpeg_destroy_decompress(&cinfo);
+
+ /* JPEG was read successfully */
+ return surface;
+
}
[06/50] incubator-guacamole-server git commit: GUAC-236: Include
guacenc.1 in EXTRA_DIST.
Posted by mj...@apache.org.
GUAC-236: Include guacenc.1 in EXTRA_DIST.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/812f8b8c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/812f8b8c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/812f8b8c
Branch: refs/heads/master
Commit: 812f8b8cbf0d42f1c4f943480b43327115c93ee4
Parents: 8ed0cd5
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Sun Mar 13 23:52:38 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Mon Mar 14 20:22:04 2016 -0700
----------------------------------------------------------------------
src/guacenc/Makefile.am | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/812f8b8c/src/guacenc/Makefile.am
----------------------------------------------------------------------
diff --git a/src/guacenc/Makefile.am b/src/guacenc/Makefile.am
index bdc760d..7219911 100644
--- a/src/guacenc/Makefile.am
+++ b/src/guacenc/Makefile.am
@@ -97,3 +97,6 @@ guacenc_LDFLAGS = \
@SWSCALE_LIBS@ \
@WEBP_LIBS@
+EXTRA_DIST = \
+ man/guacenc.1
+
[48/50] incubator-guacamole-server git commit: GUAC-1164: Ensure
locks used by OpenSSL are always freed.
Posted by mj...@apache.org.
GUAC-1164: Ensure locks used by OpenSSL are always freed.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/0a1f01ce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/0a1f01ce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/0a1f01ce
Branch: refs/heads/master
Commit: 0a1f01ce3f049c181c305ced643d8da7dad16757
Parents: 0fb8a49
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Thu Mar 17 18:10:42 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Thu Mar 17 18:10:42 2016 -0700
----------------------------------------------------------------------
src/common-ssh/guac_ssh.c | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/0a1f01ce/src/common-ssh/guac_ssh.c
----------------------------------------------------------------------
diff --git a/src/common-ssh/guac_ssh.c b/src/common-ssh/guac_ssh.c
index 12156de..79682f7 100644
--- a/src/common-ssh/guac_ssh.c
+++ b/src/common-ssh/guac_ssh.c
@@ -128,6 +128,9 @@ static void guac_common_ssh_openssl_free_locks(int count) {
for (i=0; i < count; i++)
pthread_mutex_destroy(&(guac_common_ssh_openssl_locks[i]));
+ /* Free lock array */
+ free(guac_common_ssh_openssl_locks);
+
}
int guac_common_ssh_init(guac_client* client) {
[18/50] incubator-guacamole-server git commit: Merge pull request
#125 from glyptodon/screen-recording
Posted by mj...@apache.org.
Merge pull request #125 from glyptodon/screen-recording
GUAC-246: Implement screen recording
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/f5f77fea
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/f5f77fea
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/f5f77fea
Branch: refs/heads/master
Commit: f5f77fea356db73b8e365c7fc509f0653b44980b
Parents: 399f975 e2030c0
Author: James Muehlner <ja...@guac-dev.org>
Authored: Tue Mar 15 20:41:28 2016 -0700
Committer: James Muehlner <ja...@guac-dev.org>
Committed: Tue Mar 15 20:41:28 2016 -0700
----------------------------------------------------------------------
Makefile.am | 10 +-
configure.ac | 115 ++++++++
src/common/Makefile.am | 2 +
src/common/guac_recording.c | 159 ++++++++++
src/common/guac_recording.h | 81 +++++
src/guacenc/.gitignore | 5 +
src/guacenc/Makefile.am | 103 +++++++
src/guacenc/buffer.c | 174 +++++++++++
src/guacenc/buffer.h | 157 ++++++++++
src/guacenc/display-buffers.c | 110 +++++++
src/guacenc/display-flatten.c | 160 ++++++++++
src/guacenc/display-image-streams.c | 84 ++++++
src/guacenc/display-layers.c | 102 +++++++
src/guacenc/display-sync.c | 63 ++++
src/guacenc/display.c | 134 +++++++++
src/guacenc/display.h | 367 +++++++++++++++++++++++
src/guacenc/encode.c | 156 ++++++++++
src/guacenc/encode.h | 68 +++++
src/guacenc/ffmpeg-compat.h | 53 ++++
src/guacenc/guacenc.c | 152 ++++++++++
src/guacenc/guacenc.h | 56 ++++
src/guacenc/image-stream.c | 169 +++++++++++
src/guacenc/image-stream.h | 235 +++++++++++++++
src/guacenc/instruction-blob.c | 55 ++++
src/guacenc/instruction-cfill.c | 62 ++++
src/guacenc/instruction-copy.c | 106 +++++++
src/guacenc/instruction-cursor.c | 56 ++++
src/guacenc/instruction-dispose.c | 50 ++++
src/guacenc/instruction-end.c | 59 ++++
src/guacenc/instruction-img.c | 52 ++++
src/guacenc/instruction-move.c | 64 ++++
src/guacenc/instruction-rect.c | 64 ++++
src/guacenc/instruction-shade.c | 54 ++++
src/guacenc/instruction-size.c | 53 ++++
src/guacenc/instruction-sync.c | 82 ++++++
src/guacenc/instruction-transfer.c | 58 ++++
src/guacenc/instructions.c | 79 +++++
src/guacenc/instructions.h | 171 +++++++++++
src/guacenc/jpeg.c | 87 ++++++
src/guacenc/jpeg.h | 35 +++
src/guacenc/layer.c | 76 +++++
src/guacenc/layer.h | 106 +++++++
src/guacenc/log.c | 88 ++++++
src/guacenc/log.h | 76 +++++
src/guacenc/man/guacenc.1 | 62 ++++
src/guacenc/parse.c | 72 +++++
src/guacenc/parse.h | 71 +++++
src/guacenc/png.c | 112 +++++++
src/guacenc/png.h | 35 +++
src/guacenc/video.c | 489 +++++++++++++++++++++++++++++++
src/guacenc/video.h | 181 ++++++++++++
src/guacenc/webp.c | 77 +++++
src/guacenc/webp.h | 35 +++
src/libguac/Makefile.am | 1 +
src/libguac/client.c | 3 +
src/libguac/guacamole/socket.h | 32 ++
src/libguac/socket-tee.c | 234 +++++++++++++++
src/protocols/rdp/rdp.c | 9 +
src/protocols/rdp/rdp_settings.c | 25 ++
src/protocols/rdp/rdp_settings.h | 22 ++
src/protocols/ssh/settings.c | 40 +++
src/protocols/ssh/settings.h | 22 ++
src/protocols/ssh/ssh.c | 9 +
src/protocols/telnet/settings.c | 40 +++
src/protocols/telnet/settings.h | 22 ++
src/protocols/telnet/telnet.c | 9 +
src/protocols/vnc/settings.c | 24 ++
src/protocols/vnc/settings.h | 22 ++
src/protocols/vnc/vnc.c | 9 +
69 files changed, 5904 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[03/50] incubator-guacamole-server git commit: GUAC-236: Fix manual
section number.
Posted by mj...@apache.org.
GUAC-236: Fix manual section number.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/c16832f1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/c16832f1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/c16832f1
Branch: refs/heads/master
Commit: c16832f11a28421277406bb7e012a485db2d5b43
Parents: e298975
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Sat Mar 12 18:05:24 2016 -0800
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Mon Mar 14 20:22:03 2016 -0700
----------------------------------------------------------------------
src/guacenc/man/guacenc.1 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/c16832f1/src/guacenc/man/guacenc.1
----------------------------------------------------------------------
diff --git a/src/guacenc/man/guacenc.1 b/src/guacenc/man/guacenc.1
index adc76dd..3f6f179 100644
--- a/src/guacenc/man/guacenc.1
+++ b/src/guacenc/man/guacenc.1
@@ -1,4 +1,4 @@
-.TH guacenc 8 "12 Mar 2016" "version 0.9.9" "Guacamole"
+.TH guacenc 1 "12 Mar 2016" "version 0.9.9" "Guacamole"
.
.SH NAME
guacenc \- Guacamole video encoder
[30/50] incubator-guacamole-server git commit: GUAC-1164: Add setting
for specifying the resize method, if any.
Posted by mj...@apache.org.
GUAC-1164: Add setting for specifying the resize method, if any.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/8d141184
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/8d141184
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/8d141184
Branch: refs/heads/master
Commit: 8d14118469107153dc0d4e19e0544fcf64a72261
Parents: 67a0a1f
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Wed Mar 16 10:23:21 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Wed Mar 16 14:44:16 2016 -0700
----------------------------------------------------------------------
src/protocols/rdp/rdp.c | 33 ++++++++++++++-------------
src/protocols/rdp/rdp_disp.c | 42 +++++++++++++++++------------------
src/protocols/rdp/rdp_settings.c | 32 ++++++++++++++++++++++++++
src/protocols/rdp/rdp_settings.h | 31 ++++++++++++++++++++++++++
4 files changed, 102 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/8d141184/src/protocols/rdp/rdp.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp.c b/src/protocols/rdp/rdp.c
index a19e55b..ab5734f 100644
--- a/src/protocols/rdp/rdp.c
+++ b/src/protocols/rdp/rdp.c
@@ -170,27 +170,30 @@ static int __guac_receive_channel_data(freerdp* rdp_inst, int channelId,
static void guac_rdp_channel_connected(rdpContext* context,
ChannelConnectedEventArgs* e) {
-#ifdef HAVE_RDPSETTINGS_SUPPORTDISPLAYCONTROL
- /* Store reference to the display update plugin once it's connected */
- if (strcmp(e->name, DISP_DVC_CHANNEL_NAME) == 0) {
+ guac_client* client = ((rdp_freerdp_context*) context)->client;
+ guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
+ guac_rdp_settings* settings = rdp_client->settings;
- DispClientContext* disp = (DispClientContext*) e->pInterface;
+ if (settings->resize_method == GUAC_RESIZE_DISPLAY_UPDATE) {
+#ifdef HAVE_RDPSETTINGS_SUPPORTDISPLAYCONTROL
+ /* Store reference to the display update plugin once it's connected */
+ if (strcmp(e->name, DISP_DVC_CHANNEL_NAME) == 0) {
- guac_client* client = ((rdp_freerdp_context*) context)->client;
- guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
+ DispClientContext* disp = (DispClientContext*) e->pInterface;
- /* Init module with current display size */
- guac_rdp_disp_set_size(rdp_client->disp, rdp_client->settings,
- context->instance, guac_rdp_get_width(context->instance),
- guac_rdp_get_height(context->instance));
+ /* Init module with current display size */
+ guac_rdp_disp_set_size(rdp_client->disp, rdp_client->settings,
+ context->instance, guac_rdp_get_width(context->instance),
+ guac_rdp_get_height(context->instance));
- /* Store connected channel */
- guac_rdp_disp_connect(rdp_client->disp, disp);
- guac_client_log(client, GUAC_LOG_DEBUG,
- "Display update channel connected.");
+ /* Store connected channel */
+ guac_rdp_disp_connect(rdp_client->disp, disp);
+ guac_client_log(client, GUAC_LOG_DEBUG,
+ "Display update channel connected.");
- }
+ }
#endif
+ }
}
#endif
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/8d141184/src/protocols/rdp/rdp_disp.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp_disp.c b/src/protocols/rdp/rdp_disp.c
index c7ea64a..973c301 100644
--- a/src/protocols/rdp/rdp_disp.c
+++ b/src/protocols/rdp/rdp_disp.c
@@ -169,37 +169,37 @@ void guac_rdp_disp_update_size(guac_rdp_disp* disp,
disp->last_request = now;
- if (1) {
+ if (settings->resize_method == GUAC_RESIZE_RECONNECT) {
+
/* Update settings with new dimensions */
settings->width = width;
settings->height = height;
/* Signal reconnect */
disp->reconnect_needed = 1;
-#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
- disp->disp = NULL;
-#endif
- return;
+
}
+ else if (settings->resize_method == GUAC_RESIZE_DISPLAY_UPDATE) {
#ifdef HAVE_FREERDP_DISPLAY_UPDATE_SUPPORT
- DISPLAY_CONTROL_MONITOR_LAYOUT monitors[1] = {{
- .Flags = 0x1, /* DISPLAYCONTROL_MONITOR_PRIMARY */
- .Left = 0,
- .Top = 0,
- .Width = width,
- .Height = height,
- .PhysicalWidth = 0,
- .PhysicalHeight = 0,
- .Orientation = 0,
- .DesktopScaleFactor = 0,
- .DeviceScaleFactor = 0
- }};
-
- /* Send display update notification if display channel is connected */
- if (disp->disp != NULL)
- disp->disp->SendMonitorLayout(disp->disp, 1, monitors);
+ DISPLAY_CONTROL_MONITOR_LAYOUT monitors[1] = {{
+ .Flags = 0x1, /* DISPLAYCONTROL_MONITOR_PRIMARY */
+ .Left = 0,
+ .Top = 0,
+ .Width = width,
+ .Height = height,
+ .PhysicalWidth = 0,
+ .PhysicalHeight = 0,
+ .Orientation = 0,
+ .DesktopScaleFactor = 0,
+ .DeviceScaleFactor = 0
+ }};
+
+ /* Send display update notification if display channel is connected */
+ if (disp->disp != NULL)
+ disp->disp->SendMonitorLayout(disp->disp, 1, monitors);
#endif
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/8d141184/src/protocols/rdp/rdp_settings.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp_settings.c b/src/protocols/rdp/rdp_settings.c
index 0e90f4d..7cedb7c 100644
--- a/src/protocols/rdp/rdp_settings.c
+++ b/src/protocols/rdp/rdp_settings.c
@@ -92,6 +92,7 @@ const char* GUAC_RDP_CLIENT_ARGS[] = {
"recording-path",
"recording-name",
"create-recording-path",
+ "resize-method",
NULL
};
@@ -360,6 +361,12 @@ enum RDP_ARGS_IDX {
IDX_RECORDING_NAME,
IDX_CREATE_RECORDING_PATH,
+ /**
+ * The method to use to apply screen size changes requested by the user.
+ * Valid values are blank, "display-update", and "reconnect".
+ */
+ IDX_RESIZE_METHOD,
+
RDP_ARGS_COUNT
};
@@ -696,6 +703,31 @@ guac_rdp_settings* guac_rdp_parse_args(guac_user* user,
guac_user_parse_args_boolean(user, GUAC_RDP_CLIENT_ARGS, argv,
IDX_CREATE_RECORDING_PATH, 0);
+ /* No resize method */
+ if (strcmp(argv[IDX_RESIZE_METHOD], "") == 0) {
+ guac_user_log(user, GUAC_LOG_INFO, "Resize method: none");
+ settings->resize_method = GUAC_RESIZE_NONE;
+ }
+
+ /* Resize method: "reconnect" */
+ else if (strcmp(argv[IDX_RESIZE_METHOD], "reconnect") == 0) {
+ guac_user_log(user, GUAC_LOG_INFO, "Resize method: reconnect");
+ settings->resize_method = GUAC_RESIZE_RECONNECT;
+ }
+
+ /* Resize method: "display-update" */
+ else if (strcmp(argv[IDX_RESIZE_METHOD], "display-update") == 0) {
+ guac_user_log(user, GUAC_LOG_INFO, "Resize method: display-update");
+ settings->resize_method = GUAC_RESIZE_DISPLAY_UPDATE;
+ }
+
+ /* Default to no resize method if invalid */
+ else {
+ guac_user_log(user, GUAC_LOG_INFO, "Resize method \"%s\" invalid. ",
+ "Defaulting to no resize method.", argv[IDX_RESIZE_METHOD]);
+ settings->resize_method = GUAC_RESIZE_NONE;
+ }
+
/* Success */
return settings;
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/8d141184/src/protocols/rdp/rdp_settings.h
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp_settings.h b/src/protocols/rdp/rdp_settings.h
index f4c979a..80c15b9 100644
--- a/src/protocols/rdp/rdp_settings.h
+++ b/src/protocols/rdp/rdp_settings.h
@@ -89,6 +89,32 @@ typedef enum guac_rdp_security {
} guac_rdp_security;
/**
+ * All supported combinations screen resize methods.
+ */
+typedef enum guac_rdp_resize_method {
+
+ /**
+ * Dynamic resizing of the display will not be attempted.
+ */
+ GUAC_RESIZE_NONE,
+
+ /**
+ * Dynamic resizing will be attempted through sending requests along the
+ * Display Update channel. This will only work with recent versions of
+ * Windows and relatively-recent versions of FreeRDP.
+ */
+ GUAC_RESIZE_DISPLAY_UPDATE,
+
+ /**
+ * Guacamole will automatically disconnect and reconnect to the RDP server
+ * whenever the screen size changes, requesting the new size during
+ * reconnect.
+ */
+ GUAC_RESIZE_RECONNECT
+
+} guac_rdp_resize_method;
+
+/**
* All settings supported by the Guacamole RDP client.
*/
typedef struct guac_rdp_settings {
@@ -350,6 +376,11 @@ typedef struct guac_rdp_settings {
*/
int create_recording_path;
+ /**
+ * The method to apply when the user's display changes size.
+ */
+ guac_rdp_resize_method resize_method;
+
} guac_rdp_settings;
/**
[38/50] incubator-guacamole-server git commit: GUAC-236: Do not
exceed available buffers/layers/streams.
Posted by mj...@apache.org.
GUAC-236: Do not exceed available buffers/layers/streams.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/ec2524eb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/ec2524eb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/ec2524eb
Branch: refs/heads/master
Commit: ec2524eb971039a617794bf32e89751a2339c647
Parents: 55f5d1c
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Wed Mar 16 21:48:21 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Wed Mar 16 21:48:25 2016 -0700
----------------------------------------------------------------------
src/guacenc/display-buffers.c | 4 ++--
src/guacenc/display-image-streams.c | 6 +++---
src/guacenc/display-layers.c | 4 ++--
3 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/ec2524eb/src/guacenc/display-buffers.c
----------------------------------------------------------------------
diff --git a/src/guacenc/display-buffers.c b/src/guacenc/display-buffers.c
index 5bd68d3..8d230dd 100644
--- a/src/guacenc/display-buffers.c
+++ b/src/guacenc/display-buffers.c
@@ -37,7 +37,7 @@ guacenc_buffer* guacenc_display_get_buffer(guacenc_display* display,
int internal_index = -index - 1;
/* Do not lookup / allocate if index is invalid */
- if (internal_index < 0 || internal_index > GUACENC_DISPLAY_MAX_BUFFERS) {
+ if (internal_index < 0 || internal_index >= GUACENC_DISPLAY_MAX_BUFFERS) {
guacenc_log(GUAC_LOG_WARNING, "Buffer index out of bounds: %i", index);
return NULL;
}
@@ -72,7 +72,7 @@ int guacenc_display_free_buffer(guacenc_display* display,
int internal_index = -index - 1;
/* Do not lookup / free if index is invalid */
- if (internal_index < 0 || internal_index > GUACENC_DISPLAY_MAX_BUFFERS) {
+ if (internal_index < 0 || internal_index >= GUACENC_DISPLAY_MAX_BUFFERS) {
guacenc_log(GUAC_LOG_WARNING, "Buffer index out of bounds: %i", index);
return 1;
}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/ec2524eb/src/guacenc/display-image-streams.c
----------------------------------------------------------------------
diff --git a/src/guacenc/display-image-streams.c b/src/guacenc/display-image-streams.c
index 46e4b86..e992512 100644
--- a/src/guacenc/display-image-streams.c
+++ b/src/guacenc/display-image-streams.c
@@ -33,7 +33,7 @@ int guacenc_display_create_image_stream(guacenc_display* display, int index,
int mask, int layer_index, const char* mimetype, int x, int y) {
/* Do not lookup / allocate if index is invalid */
- if (index < 0 || index > GUACENC_DISPLAY_MAX_STREAMS) {
+ if (index < 0 || index >= GUACENC_DISPLAY_MAX_STREAMS) {
guacenc_log(GUAC_LOG_WARNING, "Stream index out of bounds: %i", index);
return 1;
}
@@ -54,7 +54,7 @@ guacenc_image_stream* guacenc_display_get_image_stream(
guacenc_display* display, int index) {
/* Do not lookup / allocate if index is invalid */
- if (index < 0 || index > GUACENC_DISPLAY_MAX_STREAMS) {
+ if (index < 0 || index >= GUACENC_DISPLAY_MAX_STREAMS) {
guacenc_log(GUAC_LOG_WARNING, "Stream index out of bounds: %i", index);
return NULL;
}
@@ -67,7 +67,7 @@ guacenc_image_stream* guacenc_display_get_image_stream(
int guacenc_display_free_image_stream(guacenc_display* display, int index) {
/* Do not lookup / allocate if index is invalid */
- if (index < 0 || index > GUACENC_DISPLAY_MAX_STREAMS) {
+ if (index < 0 || index >= GUACENC_DISPLAY_MAX_STREAMS) {
guacenc_log(GUAC_LOG_WARNING, "Stream index out of bounds: %i", index);
return 1;
}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/ec2524eb/src/guacenc/display-layers.c
----------------------------------------------------------------------
diff --git a/src/guacenc/display-layers.c b/src/guacenc/display-layers.c
index e0406f8..51b9058 100644
--- a/src/guacenc/display-layers.c
+++ b/src/guacenc/display-layers.c
@@ -33,7 +33,7 @@ guacenc_layer* guacenc_display_get_layer(guacenc_display* display,
int index) {
/* Do not lookup / allocate if index is invalid */
- if (index < 0 || index > GUACENC_DISPLAY_MAX_LAYERS) {
+ if (index < 0 || index >= GUACENC_DISPLAY_MAX_LAYERS) {
guacenc_log(GUAC_LOG_WARNING, "Layer index out of bounds: %i", index);
return NULL;
}
@@ -85,7 +85,7 @@ int guacenc_display_free_layer(guacenc_display* display,
int index) {
/* Do not lookup / free if index is invalid */
- if (index < 0 || index > GUACENC_DISPLAY_MAX_LAYERS) {
+ if (index < 0 || index >= GUACENC_DISPLAY_MAX_LAYERS) {
guacenc_log(GUAC_LOG_WARNING, "Layer index out of bounds: %i", index);
return 1;
}
[11/50] incubator-guacamole-server git commit: GUAC-236: Remove
unused macros.
Posted by mj...@apache.org.
GUAC-236: Remove unused macros.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/73bf5ce6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/73bf5ce6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/73bf5ce6
Branch: refs/heads/master
Commit: 73bf5ce6f4ea16c0030b02d9801d9046a13a4058
Parents: acf2d2b
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Tue Mar 15 12:26:35 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Tue Mar 15 12:26:35 2016 -0700
----------------------------------------------------------------------
src/guacenc/guacenc.h | 13 -------------
1 file changed, 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/73bf5ce6/src/guacenc/guacenc.h
----------------------------------------------------------------------
diff --git a/src/guacenc/guacenc.h b/src/guacenc/guacenc.h
index a462f91..e269cfd 100644
--- a/src/guacenc/guacenc.h
+++ b/src/guacenc/guacenc.h
@@ -28,19 +28,6 @@
#include <guacamole/client.h>
/**
- * The name of the codec to use by default, if no other codec is specified on
- * the command line. This name is dictated by ffmpeg / libavcodec.
- */
-#define GUACENC_DEFAULT_CODEC "mpeg4"
-
-/**
- * The extension to append to the end of the input file to produce the output
- * file name, excluding the separating period, if no other suffix is specified
- * on the command line.
- */
-#define GUACENC_DEFAULT_SUFFIX "mpg"
-
-/**
* The width of the output video, in pixels, if no other width is given on the
* command line. Note that different codecs will have different restrictions
* regarding legal widths.
[36/50] incubator-guacamole-server git commit: GUAC-1164: Document
guac_rdp_handle_connection().
Posted by mj...@apache.org.
GUAC-1164: Document guac_rdp_handle_connection().
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/c336ce39
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/c336ce39
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/c336ce39
Branch: refs/heads/master
Commit: c336ce39e289c226b78c1d19cfc0cd7c0d014c50
Parents: db82c6f
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Wed Mar 16 21:30:46 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Wed Mar 16 21:30:46 2016 -0700
----------------------------------------------------------------------
src/protocols/rdp/rdp.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/c336ce39/src/protocols/rdp/rdp.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp.c b/src/protocols/rdp/rdp.c
index 494a28d..083ca0d 100644
--- a/src/protocols/rdp/rdp.c
+++ b/src/protocols/rdp/rdp.c
@@ -691,6 +691,25 @@ static int rdp_guac_client_wait_for_messages(guac_client* client,
}
+/**
+ * Connects to an RDP server as described by the guac_rdp_settings structure
+ * associated with the given client, allocating and freeing all objects
+ * directly related to the RDP connection. It is expected that all objects
+ * which are independent of FreeRDP's state (the clipboard, display update
+ * management, etc.) will already be allocated and associated with the
+ * guac_rdp_client associated with the given guac_client. This function blocks
+ * for the duration of the RDP session, returning only after the session has
+ * completely disconnected.
+ *
+ * @param client
+ * The guac_client associated with the RDP settings describing the
+ * connection that should be established.
+ *
+ * @return
+ * Zero if the connection successfully terminated and a reconnect is
+ * desired, non-zero if an error occurs or the connection was disconnected
+ * and a reconnect is NOT desired.
+ */
static int guac_rdp_handle_connection(guac_client* client) {
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
[13/50] incubator-guacamole-server git commit: GUAC-236: Acquire
write lock on output file for in-progress screen recordings.
Posted by mj...@apache.org.
GUAC-236: Acquire write lock on output file for in-progress screen recordings.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/0361dd23
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/0361dd23
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/0361dd23
Branch: refs/heads/master
Commit: 0361dd23921f36b961a8d01b0e033463efc1cdb3
Parents: c50561e
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Tue Mar 15 17:06:52 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Tue Mar 15 17:06:52 2016 -0700
----------------------------------------------------------------------
src/common/guac_recording.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/0361dd23/src/common/guac_recording.c
----------------------------------------------------------------------
diff --git a/src/common/guac_recording.c b/src/common/guac_recording.c
index 1b8d513..461b80e 100644
--- a/src/common/guac_recording.c
+++ b/src/common/guac_recording.c
@@ -25,13 +25,14 @@
#include <guacamole/client.h>
#include <guacamole/socket.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
+#include <unistd.h>
/**
* Attempts to open a new recording within the given path and having the given
@@ -105,6 +106,21 @@ static int guac_common_recording_open(const char* path,
} /* end if open succeeded */
+ /* Lock entire output file for writing by the current process */
+ struct flock file_lock = {
+ .l_type = F_WRLCK,
+ .l_whence = SEEK_SET,
+ .l_start = 0,
+ .l_len = 0,
+ .l_pid = getpid()
+ };
+
+ /* Abort if file cannot be locked for reading */
+ if (fcntl(fd, F_SETLK, &file_lock) == -1) {
+ close(fd);
+ return -1;
+ }
+
return fd;
}
[12/50] incubator-guacamole-server git commit: GUAC-236: Open output
stream using file descriptor. Only write output file if it does not yet
exist.
Posted by mj...@apache.org.
GUAC-236: Open output stream using file descriptor. Only write output file if it does not yet exist.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/c50561ef
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/c50561ef
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/c50561ef
Branch: refs/heads/master
Commit: c50561ef10af1d40e7aa3bf1388ba79c2904567d
Parents: 73bf5ce
Author: Michael Jumper <mi...@guac-dev.org>
Authored: Tue Mar 15 16:41:47 2016 -0700
Committer: Michael Jumper <mi...@guac-dev.org>
Committed: Tue Mar 15 16:43:13 2016 -0700
----------------------------------------------------------------------
src/guacenc/video.c | 19 +++++++++++++++++--
src/guacenc/video.h | 7 ++++---
2 files changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/c50561ef/src/guacenc/video.c
----------------------------------------------------------------------
diff --git a/src/guacenc/video.c b/src/guacenc/video.c
index 99d990e..8c13844 100644
--- a/src/guacenc/video.c
+++ b/src/guacenc/video.c
@@ -34,10 +34,14 @@
#include <guacamole/client.h>
#include <guacamole/timestamp.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <assert.h>
+#include <fcntl.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
guacenc_video* guacenc_video_alloc(const char* path, const char* codec_name,
int width, int height, int bitrate) {
@@ -91,10 +95,18 @@ guacenc_video* guacenc_video_alloc(const char* path, const char* codec_name,
}
/* Open output file */
- FILE* output = fopen(path, "wb");
- if (output == NULL) {
+ int fd = open(path, O_CREAT | O_EXCL | O_WRONLY, S_IRUSR | S_IWUSR);
+ if (fd == -1) {
guacenc_log(GUAC_LOG_ERROR, "Failed to open output file \"%s\": %s",
path, strerror(errno));
+ goto fail_output_fd;
+ }
+
+ /* Create stream for output file */
+ FILE* output = fdopen(fd, "wb");
+ if (output == NULL) {
+ guacenc_log(GUAC_LOG_ERROR, "Failed to allocate stream for output "
+ "file \"%s\": %s", path, strerror(errno));
goto fail_output_file;
}
@@ -123,6 +135,9 @@ fail_video:
fclose(output);
fail_output_file:
+ close(fd);
+
+fail_output_fd:
av_freep(&frame->data[0]);
fail_frame_data:
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/c50561ef/src/guacenc/video.h
----------------------------------------------------------------------
diff --git a/src/guacenc/video.h b/src/guacenc/video.h
index b9cbf13..61c7ff8 100644
--- a/src/guacenc/video.h
+++ b/src/guacenc/video.h
@@ -93,9 +93,10 @@ typedef struct guacenc_video {
/**
* Allocates a new guacenc_video which encodes video according to the given
- * specifications, saving the output in the given file. The output file will be
- * created if necessary and truncated if it already exists. Frames will be
- * scaled up or down as necessary to fit the given width and height.
+ * specifications, saving the output in the given file. If the output file
+ * already exists, encoding will be aborted, and the original file contents
+ * will be preserved. Frames will be scaled up or down as necessary to fit the
+ * given width and height.
*
* @param path
* The full path to the file in which encoded video should be written.