You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by GitBox <gi...@apache.org> on 2021/01/19 19:22:20 UTC
[GitHub] [guacamole-server] stefan-esq opened a new pull request #327: GUACAMOLE-1267: Add VNC setting 'disable-remote-input'
stefan-esq opened a new pull request #327:
URL: https://github.com/apache/guacamole-server/pull/327
Add a new VNC setting 'disable-remote-input' which attempts to turn the remote input off when set to true.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [guacamole-server] mike-jumper commented on a change in pull request #327: GUACAMOLE-1267: Add VNC setting 'disable-remote-input'
Posted by GitBox <gi...@apache.org>.
mike-jumper commented on a change in pull request #327:
URL: https://github.com/apache/guacamole-server/pull/327#discussion_r560427133
##########
File path: src/protocols/vnc/vnc.c
##########
@@ -385,6 +385,17 @@ void* guac_vnc_client_thread(void* data) {
}
#endif
+ /* Disable remote console */
+ if (settings->disable_remote_input) {
+ rfbSetServerInputMsg no_remote_console = {
+ .type = rfbSetServerInput, .status = 1, .pad = 0
+ };
+ rfbBool success = WriteToRFBServer(rfb_client,
+ (char *) &no_remote_console, sz_rfbSetServerInputMsg);
Review comment:
Why not leverage `PermitServerInput()`?
##########
File path: src/protocols/vnc/settings.h
##########
@@ -300,6 +300,11 @@ typedef struct guac_vnc_settings {
*/
int wol_wait_time;
+ /**
+ * Whether or not to write the disable remote input message to the remote host
+ */
+ bool disable_remote_input;
Review comment:
I think this should be described at more of a high level. Rather than describe the low-level impact on which VNC protocol messages are sent, this should describe the high-level effect of the setting on session/server behavior.
##########
File path: src/protocols/vnc/settings.c
##########
@@ -373,6 +374,8 @@ enum VNC_ARGS_IDX {
*/
IDX_WOL_WAIT_TIME,
+ IDX_DISABLE_REMOTE_INPUT,
Review comment:
Please document.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [guacamole-server] mike-jumper commented on a change in pull request #327: GUACAMOLE-1267: Add VNC setting 'disable-server-input'
Posted by GitBox <gi...@apache.org>.
mike-jumper commented on a change in pull request #327:
URL: https://github.com/apache/guacamole-server/pull/327#discussion_r569160096
##########
File path: src/protocols/vnc/vnc.c
##########
@@ -385,6 +385,17 @@ void* guac_vnc_client_thread(void* data) {
}
#endif
+ /* Disable remote console (Server input) */
+ if (settings->disable_server_input) {
+ rfbSetServerInputMsg msg;
+ msg.type = rfbSetServerInput;
+ msg.status = 1;
+ msg.pad = 0;
+
+ rfbBool success = WriteToRFBServer(rfb_client, (char*)&msg, sz_rfbSetServerInputMsg);
+ guac_client_log(client, GUAC_LOG_DEBUG, "%s send request to disable server input", success ? "Successfully" : "Failed to");
Review comment:
This reads well in the case of failure ("Failed to send request ..."), but the grammar gets wonky if things are sent successfully ("Successfully send request ...").
Perhaps it would be better to simply have two separate `guac_client_log()` calls? That would also allow for the failure case to be logged at a higher log level like `GUAC_LOG_WARNING` without getting too cluttered.
##########
File path: src/protocols/vnc/vnc.c
##########
@@ -385,6 +385,17 @@ void* guac_vnc_client_thread(void* data) {
}
#endif
+ /* Disable remote console (Server input) */
+ if (settings->disable_server_input) {
+ rfbSetServerInputMsg msg;
+ msg.type = rfbSetServerInput;
+ msg.status = 1;
+ msg.pad = 0;
Review comment:
FYI - I'm sure this is fine as-is (all structure members are explicitly initialized here), but you can do this quickly and cleanly in one step with:
```c
rfbSetServerInputMsg msg = {
.type = rfbSetServerInput,
.status = 1
};
```
with `pad` implicitly zeroed.
I'm OK with things as you have them, but just wanted to point the above out. We have additional syntax at our disposal here thanks to the codebase being written for C99.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [guacamole-server] stefan-esq commented on a change in pull request #327: GUACAMOLE-1267: Add VNC setting 'disable-remote-input'
Posted by GitBox <gi...@apache.org>.
stefan-esq commented on a change in pull request #327:
URL: https://github.com/apache/guacamole-server/pull/327#discussion_r560446127
##########
File path: src/protocols/vnc/vnc.c
##########
@@ -385,6 +385,17 @@ void* guac_vnc_client_thread(void* data) {
}
#endif
+ /* Disable remote console */
+ if (settings->disable_remote_input) {
+ rfbSetServerInputMsg no_remote_console = {
+ .type = rfbSetServerInput, .status = 1, .pad = 0
+ };
+ rfbBool success = WriteToRFBServer(rfb_client,
+ (char *) &no_remote_console, sz_rfbSetServerInputMsg);
Review comment:
I have no clue, this is based on custom code written by another developer inside our company, I have rewritten most of it so it is configurable and does not always disable the input. As requested I have changed this to PermitServerInput.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [guacamole-server] mike-jumper commented on a change in pull request #327: GUACAMOLE-1267: Add VNC setting 'disable-remote-input'
Posted by GitBox <gi...@apache.org>.
mike-jumper commented on a change in pull request #327:
URL: https://github.com/apache/guacamole-server/pull/327#discussion_r560430362
##########
File path: src/protocols/vnc/settings.h
##########
@@ -300,6 +300,11 @@ typedef struct guac_vnc_settings {
*/
int wol_wait_time;
+ /**
+ * Whether or not to write the disable remote input message to the remote host
+ */
Review comment:
I should also point out that something happened here to misalign the block comment.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [guacamole-server] stefan-esq commented on a change in pull request #327: GUACAMOLE-1267: Add VNC setting 'disable-server-input'
Posted by GitBox <gi...@apache.org>.
stefan-esq commented on a change in pull request #327:
URL: https://github.com/apache/guacamole-server/pull/327#discussion_r567147639
##########
File path: src/protocols/vnc/vnc.c
##########
@@ -385,6 +385,12 @@ void* guac_vnc_client_thread(void* data) {
}
#endif
+ /* Disable remote console (Server input) */
+ if (settings->disable_server_input) {
+ rfbBool success = PermitServerInput(rfb_client, 1);
+ guac_client_log(client, GUAC_LOG_INFO, "Disabling server input %s.", success ? "succeeded" : "failed");
Review comment:
As stated in your comment it appears that the status is only related to if the sending of the message succeeds. I have adjusted the message for this:
`guac_client_log(client, GUAC_LOG_DEBUG, "%s send request to disable server input", success ? "Successfully" : "Failed to");`
In addition to this, after retesting the code locally PermitServerInput does not seem to work with some vnc clients even though the vnc clients do support the functionality.
After going through the libvncserver code I found the following:
``` /** Which messages are supported by the server
* This is a *guess* for most servers.
* (If we can even detect the type of server)
*
* If the server supports the "rfbEncodingSupportedMessages"
* then this will be updated when the encoding is received to
* accurately reflect the servers capabilities.
*/
rfbSupportedMessages supportedMessages;
```
It would appear that libvncserver guesses if the vnc server supports disabling the remote input and if it guesses the server does not, then PermitServerInput will not send the request even if the client supports it.
For this reason I have changed the code back to use WriteToRFBServer, in my opinion it is better to always send the request.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [guacamole-server] stefan-esq commented on a change in pull request #327: GUACAMOLE-1267: Add VNC setting 'disable-remote-input'
Posted by GitBox <gi...@apache.org>.
stefan-esq commented on a change in pull request #327:
URL: https://github.com/apache/guacamole-server/pull/327#discussion_r560447515
##########
File path: src/protocols/vnc/settings.c
##########
@@ -373,6 +374,8 @@ enum VNC_ARGS_IDX {
*/
IDX_WOL_WAIT_TIME,
+ IDX_DISABLE_REMOTE_INPUT,
Review comment:
Added documentation: "Whether or not to disable the input on the server side.".
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [guacamole-server] stefan-esq commented on a change in pull request #327: GUACAMOLE-1267: Add VNC setting 'disable-remote-input'
Posted by GitBox <gi...@apache.org>.
stefan-esq commented on a change in pull request #327:
URL: https://github.com/apache/guacamole-server/pull/327#discussion_r560447384
##########
File path: src/protocols/vnc/settings.h
##########
@@ -300,6 +300,11 @@ typedef struct guac_vnc_settings {
*/
int wol_wait_time;
+ /**
+ * Whether or not to write the disable remote input message to the remote host
+ */
+ bool disable_remote_input;
Review comment:
I hope the following message is ok, "Whether or not to disable the input on the server side."
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [guacamole-server] stefan-esq commented on a change in pull request #327: GUACAMOLE-1267: Add VNC setting 'disable-remote-input'
Posted by GitBox <gi...@apache.org>.
stefan-esq commented on a change in pull request #327:
URL: https://github.com/apache/guacamole-server/pull/327#discussion_r560447837
##########
File path: src/protocols/vnc/settings.h
##########
@@ -300,6 +300,11 @@ typedef struct guac_vnc_settings {
*/
int wol_wait_time;
+ /**
+ * Whether or not to write the disable remote input message to the remote host
+ */
Review comment:
Should hopefully be fixed.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [guacamole-server] mike-jumper commented on a change in pull request #327: GUACAMOLE-1267: Add VNC setting 'disable-server-input'
Posted by GitBox <gi...@apache.org>.
mike-jumper commented on a change in pull request #327:
URL: https://github.com/apache/guacamole-server/pull/327#discussion_r566599491
##########
File path: src/protocols/vnc/vnc.c
##########
@@ -385,6 +385,12 @@ void* guac_vnc_client_thread(void* data) {
}
#endif
+ /* Disable remote console (Server input) */
+ if (settings->disable_server_input) {
+ rfbBool success = PermitServerInput(rfb_client, 1);
+ guac_client_log(client, GUAC_LOG_INFO, "Disabling server input %s.", success ? "succeeded" : "failed");
Review comment:
There is admittedly not much documentation on the return value of `PermitServerInput()`, but reading through the libvncclient code, the value doesn't appear to indicate whether disabling input succeeded:
```c
/*
* UltraVNC Server Input Disable
* Apparently, the remote client can *prevent* the local user from interacting with the display
* I would think this is extremely helpful when used in a HelpDesk situation
*/
rfbBool PermitServerInput(rfbClient* client, int enabled)
{
rfbSetServerInputMsg msg;
if (!SupportsClient2Server(client, rfbSetServerInput)) return TRUE;
/* enabled==1, then server input from local keyboard is disabled */
msg.type = rfbSetServerInput;
msg.status = (enabled ? 1 : 0);
msg.pad = 0;
return (WriteToRFBServer(client, (char *)&msg, sz_rfbSetServerInputMsg) ? TRUE : FALSE);
}
```
(https://github.com/LibVNC/libvncserver/blob/c82b3abb369983cd737190331b897814a580a980/libvncclient/rfbproto.c#L1502-L1517)
Given the above, it looks like:
* If the VNC server supports the relevant message, the return value indicates only if the message was successfully sent, not whether the server honored the message.
* If the VNC server _doesn't_ support the relevant message, `PermitServerInput()` pretends to succeed.
The silent success of `PermitServerInput()` makes this log message less useful. If you want to keep the message, I suggest moving it to the `GUAC_LOG_DEBUG` level and rephrasing to capture only what we know.
----------------------------------------------------------------
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:
users@infra.apache.org