You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by jm...@apache.org on 2017/02/16 04:54:06 UTC
[05/10] incubator-guacamole-server git commit: GUACAMOLE-200:
Maintain print jobs at top level. Do not rely on proper free of RDPDR plugin.
GUACAMOLE-200: Maintain print jobs at top level. Do not rely on proper free of RDPDR plugin.
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/5a68f932
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/5a68f932
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/5a68f932
Branch: refs/heads/master
Commit: 5a68f932d6cc048c3ec9df8c48e64cb4e7a36202
Parents: 1537e47
Author: Michael Jumper <mj...@apache.org>
Authored: Tue Feb 14 00:02:17 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Tue Feb 14 00:02:17 2017 -0800
----------------------------------------------------------------------
src/protocols/rdp/client.c | 8 ++++++
src/protocols/rdp/guac_rdpdr/rdpdr_printer.c | 31 +++++++++++------------
src/protocols/rdp/rdp.h | 6 +++++
3 files changed, 29 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/5a68f932/src/protocols/rdp/client.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/client.c b/src/protocols/rdp/client.c
index 2a9a690..203bdb0 100644
--- a/src/protocols/rdp/client.c
+++ b/src/protocols/rdp/client.c
@@ -23,6 +23,8 @@
#include "client.h"
#include "rdp.h"
#include "rdp_disp.h"
+#include "rdp_fs.h"
+#include "rdp_print_job.h"
#include "user.h"
#ifdef ENABLE_COMMON_SSH
@@ -105,6 +107,12 @@ int guac_rdp_client_free_handler(guac_client* client) {
if (rdp_client->filesystem != NULL)
guac_rdp_fs_free(rdp_client->filesystem);
+ /* Clean up print job, if active */
+ if (rdp_client->active_job != NULL) {
+ guac_rdp_print_job_kill(rdp_client->active_job);
+ guac_rdp_print_job_free(rdp_client->active_job);
+ }
+
#ifdef ENABLE_COMMON_SSH
/* Free SFTP filesystem, if loaded */
if (rdp_client->sftp_filesystem)
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/5a68f932/src/protocols/rdp/guac_rdpdr/rdpdr_printer.c
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_printer.c b/src/protocols/rdp/guac_rdpdr/rdpdr_printer.c
index 812eaf0..3733b01 100644
--- a/src/protocols/rdp/guac_rdpdr/rdpdr_printer.c
+++ b/src/protocols/rdp/guac_rdpdr/rdpdr_printer.c
@@ -22,6 +22,7 @@
#include "rdpdr_messages.h"
#include "rdpdr_printer.h"
#include "rdpdr_service.h"
+#include "rdp.h"
#include "rdp_print_job.h"
#include "rdp_status.h"
@@ -48,11 +49,14 @@
void guac_rdpdr_process_print_job_create(guac_rdpdr_device* device,
wStream* input_stream, int completion_id) {
+ guac_client* client = device->rdpdr->client;
+ guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
+
/* Log creation of print job */
- guac_client_log(device->rdpdr->client, GUAC_LOG_INFO, "Print job created");
+ guac_client_log(client, GUAC_LOG_INFO, "Print job created");
/* Create print job */
- device->data = guac_client_for_owner(device->rdpdr->client,
+ rdp_client->active_job = guac_client_for_owner(client,
guac_rdp_print_job_alloc, NULL);
/* Respond with success */
@@ -67,7 +71,9 @@ void guac_rdpdr_process_print_job_create(guac_rdpdr_device* device,
void guac_rdpdr_process_print_job_write(guac_rdpdr_device* device,
wStream* input_stream, int completion_id) {
- guac_rdp_print_job* job = (guac_rdp_print_job*) device->data;
+ guac_client* client = device->rdpdr->client;
+ guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
+ guac_rdp_print_job* job = (guac_rdp_print_job*) rdp_client->active_job;
unsigned char* buffer;
int length;
@@ -104,8 +110,11 @@ void guac_rdpdr_process_print_job_write(guac_rdpdr_device* device,
void guac_rdpdr_process_print_job_close(guac_rdpdr_device* device,
wStream* input_stream, int completion_id) {
+ guac_client* client = device->rdpdr->client;
+ guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
+ guac_rdp_print_job* job = (guac_rdp_print_job*) rdp_client->active_job;
+
/* End print job */
- guac_rdp_print_job* job = (guac_rdp_print_job*) device->data;
if (job != NULL) {
guac_rdp_print_job_free(job);
device->data = NULL;
@@ -118,7 +127,7 @@ void guac_rdpdr_process_print_job_close(guac_rdpdr_device* device,
svc_plugin_send((rdpSvcPlugin*) device->rdpdr, output_stream);
/* Log end of print job */
- guac_client_log(device->rdpdr->client, GUAC_LOG_INFO, "Print job closed");
+ guac_client_log(client, GUAC_LOG_INFO, "Print job closed");
}
@@ -178,14 +187,7 @@ static void guac_rdpdr_device_printer_iorequest_handler(guac_rdpdr_device* devic
}
static void guac_rdpdr_device_printer_free_handler(guac_rdpdr_device* device) {
-
- /* Terminate and free print job if open */
- guac_rdp_print_job* job = (guac_rdp_print_job*) device->data;
- if (job != NULL) {
- guac_rdp_print_job_kill(job);
- guac_rdp_print_job_free(job);
- }
-
+ /* Do nothing */
}
void guac_rdpdr_register_printer(guac_rdpdrPlugin* rdpdr) {
@@ -205,8 +207,5 @@ void guac_rdpdr_register_printer(guac_rdpdrPlugin* rdpdr) {
device->iorequest_handler = guac_rdpdr_device_printer_iorequest_handler;
device->free_handler = guac_rdpdr_device_printer_free_handler;
- /* No active print job yet */
- device->data = NULL;
-
}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/5a68f932/src/protocols/rdp/rdp.h
----------------------------------------------------------------------
diff --git a/src/protocols/rdp/rdp.h b/src/protocols/rdp/rdp.h
index af26408..e3e3311 100644
--- a/src/protocols/rdp/rdp.h
+++ b/src/protocols/rdp/rdp.h
@@ -30,6 +30,7 @@
#include "keyboard.h"
#include "rdp_disp.h"
#include "rdp_fs.h"
+#include "rdp_print_job.h"
#include "rdp_settings.h"
#include <freerdp/freerdp.h>
@@ -120,6 +121,11 @@ typedef struct guac_rdp_client {
*/
guac_rdp_fs* filesystem;
+ /**
+ * The currently-active print job, or NULL if no print job is active.
+ */
+ guac_rdp_print_job* active_job;
+
#ifdef ENABLE_COMMON_SSH
/**
* The user and credentials used to authenticate for SFTP.