Setting freerdp_last_error in gateway error response.
authorArmin Novak <armin.novak@thincast.com>
Mon, 23 Sep 2019 09:26:55 +0000 (11:26 +0200)
committerArmin Novak <armin.novak@thincast.com>
Tue, 24 Sep 2019 07:42:13 +0000 (09:42 +0200)
libfreerdp/core/gateway/rdg.c
libfreerdp/core/transport.c

index 2da1ced..c554805 100644 (file)
@@ -664,6 +664,7 @@ static BOOL rdg_process_handshake_response(rdpRdg* rdg, wStream* s)
        if (FAILED(errorCode))
        {
                WLog_ERR(TAG, "Handshake error %s", error);
+               freerdp_set_last_error(rdg->context, errorCode);
                return FALSE;
        }
 
@@ -700,6 +701,7 @@ static BOOL rdg_process_tunnel_response(rdpRdg* rdg, wStream* s)
        if (FAILED(errorCode))
        {
                WLog_ERR(TAG, "Tunnel creation error %s", error);
+               freerdp_set_last_error(rdg->context, errorCode);
                return FALSE;
        }
 
@@ -735,6 +737,7 @@ static BOOL rdg_process_tunnel_authorization_response(rdpRdg* rdg, wStream* s)
        if (FAILED(errorCode))
        {
                WLog_ERR(TAG, "Tunnel authorization error %s", error);
+               freerdp_set_last_error(rdg->context, errorCode);
                return FALSE;
        }
 
@@ -771,6 +774,7 @@ static BOOL rdg_process_channel_response(rdpRdg* rdg, wStream* s)
        {
                WLog_ERR(TAG, "channel response errorCode=%s, fieldsPresent=%s",
                         error, channel_response_fields_present_to_string(fieldsPresent));
+               freerdp_set_last_error(rdg->context, errorCode);
                return FALSE;
        }
 
index 77915cd..c421edd 100644 (file)
@@ -395,6 +395,8 @@ BOOL transport_connect(rdpTransport* transport, const char* hostname,
                        if (!transport->tsg)
                                return FALSE;
 
+                       /* Reset error condition from RDG */
+                       freerdp_set_last_error(context, FREERDP_ERROR_SUCCESS);
                        status = tsg_connect(transport->tsg, hostname, port, timeout);
 
                        if (status)