On Thu, Mar 7, 2019 at 1:13 PM Nick Couchman <[email protected]> wrote:

> Well, I'm taking my next stab, of who knows how many, at getting prompting
> to work in Guacamole, but going the route that Mike suggested on the pull
> request and using the protocol to request the parameters rather than
> tokens.  I'm determined to do this :-).
>
>
Nice! :)


> I'm running into some challenges with this that I think may be related to
> handling the usually-asynchronous nature of JavaScript and the connection
> protocol, but needing to temporarily make the connection pause to wait for
> the input.  I've implemented the protocol-level changes for this - I'd
> appreciate some sanity check on my code, but those items were pretty easy.
> See the following commits:
>
> Server:
>
> https://github.com/necouchman/guacamole-server/commit/c3bf085076344951621a0170b205d51e387f7cd6
>
>
Looks reasonable. Naming convention within libguac for the various
instruction sending functions is guac_protocol_send_OPCODE(), though, so
this would need to be guac_protocol_send_required().

Perhaps the instruction should accept a list of parameter names rather than
just a single name? This is what is done for the related "args"
instruction:
https://guacamole.apache.org/doc/1.0.0/libguac/protocol_8h.html#a6047d380b097ebc7d5f35b167e3419e6

Client:
>
> https://github.com/necouchman/guacamole-client/commit/72de5595880baea46505cf4f9ad49640f16519e7


Same here - convention is "onOPCODE", so this would need to be "onrequired".

Easy enough - hopefully those look sane?  I've done a little more building
> out for RDP connections, for both server and client.  On the server-side,
> there's actually a callback function that is invoked by FreeRDP when
> authentication fails.  I'm using this as a way to send the prompts back to
> the client:
>
>
> https://github.com/necouchman/guacamole-server/blob/cfe68a796eb58b1aaecf82bbd01fe49e685f3846/src/protocols/rdp/rdp.c#L445-L501
>
>
I think you will run into trouble manually parsing the Guacamole protocol
with a guac_parser in a context where inbound instructions are already
being parsed received. Is this because the FreeRDP authentication callback
must be synchronous?

Things will need to be changed to allow normal handling of received
instructions, with the response to your prompt being received via two argv
streams, handled with user->argv_handler, etc. This may already be doable
if the FreeRDP aspects of the connection are in a separate thread (I think
they are), as this function could (1) send the request for credentials and
(2) block on a pthread conditional waiting for those credentials to be
received.

This seems to be working, fine - I see the prompt come through on the
> client-side when implementing a simple GuacClient.onprompt() function that
> just logs the request.  However, I don't think the connection is pausing
> and waiting for the response - rather than getting a prompt on the client
> side, I get a notification that the connection failed.  Relevant client
> code is here:
>
>
> https://github.com/necouchman/guacamole-client/blob/23c784e9d812ba3fd3ee0dd352f3b75e7f422381/guacamole/src/main/webapp/app/client/types/ManagedClient.js#L517-L581


What error are you seeing specifically?

- Mike

Reply via email to