Re: Help with RDP Virtual Channel Implementation

2022-04-11 Thread Nick Couchman
On Mon, Apr 11, 2022 at 7:23 AM Nick Couchman  wrote:

> Hi,
>>
>> I'd say that the URI is UTF16 encoded, so you have h\0t\0... as string
>> and so your debug message only prints the h.
>>
>>
> Ah, yes, you are probably correct - I'll do the UTF16 -> UTF8 conversion
> and see if that works any better.
>
>
And, just to confirm and provide the answer to the question, yes, this had
everything to do with UTF16 data being provided by RDP - conversion worked
perfectly.

Thanks
-Nick

>


Re: Help with RDP Virtual Channel Implementation

2022-04-11 Thread Nick Couchman
>
> Hi,
>
> I'd say that the URI is UTF16 encoded, so you have h\0t\0... as string
> and so your debug message only prints the h.
>
>
Ah, yes, you are probably correct - I'll do the UTF16 -> UTF8 conversion
and see if that works any better.

Thanks - Nick


Re: Help with RDP Virtual Channel Implementation

2022-04-10 Thread Hardening

Le 10/04/2022 à 21:52, Nick Couchman a écrit :

Hello, everyone,
So, I decided to take a stab at implementing a RDP virtual channel that
would redirect links from the remote (Windows) server back to the local
browser of the user who is accessing Guacamole. I've got most of the pieces
working - I've written a Virtual Channel service for the Windows side,
along with a "Helper" application to send the data to that service, the
channel gets connected when the user logs in to the RDP server, and I can
log a basic message when data is received for the channel.

At this point I'm trying to actually correctly process the data that is
received, which means reading the Stream provided, and I'm struggling a bit
with that. Here's the current function that I've written:
==
static void guac_rdpuri_channel_receive(guac_rdp_common_svc* svc, wStream*
input_stream) {
 guac_client_log(svc->client, GUAC_LOG_DEBUG, "RDPURI (URI redirection) "
 "channel received data.");

 int len = Stream_Length(input_stream);

 guac_client_log(svc->client, GUAC_LOG_DEBUG, "Received URI %d in
length.", len);

 if (len < 1) {
 guac_client_log(svc->client, GUAC_LOG_WARNING, "Received URI data
is too "
 "small.");
 return;
 }

 BYTE* uri = (BYTE*)malloc(len);
 Stream_Read(input_stream, uri, len);

 guac_client_log(svc->client, GUAC_LOG_DEBUG, "Received URI from server:
%s", uri);

}
==

When I send a URI - I'm just using "https://guacamole.apache.org"; for my
testing - over this channel, I get:
* A notification that data has been received.
* A message indicating that the length of the data is 58 bytes.
* The letter "h"

The final message is the problem - somehow or another I'm either not
reading the entire input stream, or I'm not processing the received data
correctly, and I'm only getting the debug line to print out the first
character.

Any hints would be appreciated.



Hi,

I'd say that the URI is UTF16 encoded, so you have h\0t\0... as string 
and so your debug message only prints the h.


Best regards.

--
David FORT
website: https://www.hardening-consulting.com/