mike-jumper commented on a change in pull request #243: GUACAMOLE-249: Migrate 
to FreeRDP 2.x
URL: https://github.com/apache/guacamole-server/pull/243#discussion_r364986388
 
 

 ##########
 File path: src/protocols/rdp/plugins/channels.c
 ##########
 @@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "plugins/channels.h"
+
+#include <freerdp/channels/channels.h>
+#include <freerdp/freerdp.h>
+#include <freerdp/addin.h>
+#include <winpr/wtypes.h>
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+
+int guac_rdp_wrapped_entry_ex_count = 0;
+
+int guac_rdp_wrapped_entry_count = 0;
+
+PVIRTUALCHANNELENTRYEX guac_rdp_wrapped_entry_ex[GUAC_RDP_MAX_CHANNELS] = { 
NULL };
+
+PVIRTUALCHANNELENTRY guac_rdp_wrapped_entry[GUAC_RDP_MAX_CHANNELS] = { NULL };
+
+PVIRTUALCHANNELENTRYEX guac_rdp_plugin_wrap_entry_ex(PVIRTUALCHANNELENTRYEX 
entry_ex) {
+
+    /* Do not wrap if there is insufficient space to store the wrapped
+     * function */
+    if (guac_rdp_wrapped_entry_ex_count == GUAC_RDP_MAX_CHANNELS)
+        return entry_ex;
+
+    /* Generate wrapped version of provided entry point */
+    PVIRTUALCHANNELENTRYEX wrapper = 
guac_rdp_entry_ex_wrappers[guac_rdp_wrapped_entry_ex_count];
+    guac_rdp_wrapped_entry_ex[guac_rdp_wrapped_entry_ex_count] = entry_ex;
+    guac_rdp_wrapped_entry_ex_count++;
+
+    return wrapper;
+
+}
+
+PVIRTUALCHANNELENTRY guac_rdp_plugin_wrap_entry(PVIRTUALCHANNELENTRY entry) {
+
+    /* Do not wrap if there is insufficient space to store the wrapped
+     * function */
+    if (guac_rdp_wrapped_entry_count == GUAC_RDP_MAX_CHANNELS)
 
 Review comment:
   OK - I went ahead and refactored `guac_freerdp_channels_load_plugin()` such 
that it accepts a `rdpContext` instead, allowing warnings to be logged if 
plugins may fail to load due to limits being reached. It's no longer a true 
drop-in replacement, but it really doesn't need to be.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to