libfreerdp-core: fix server redirection when using rdp security
authorAnthony Tong <atong@trustedcs.com>
Wed, 21 Dec 2011 19:59:31 +0000 (14:59 -0500)
committerAnthony Tong <atong@trustedcs.com>
Wed, 21 Dec 2011 19:59:31 +0000 (14:59 -0500)
libfreerdp-core/connection.c
libfreerdp-core/rdp.c

index 66dbe95..02aad7d 100644 (file)
@@ -169,6 +169,12 @@ boolean rdp_client_redirect(rdpRdp* rdp)
                settings->domain = redirection->domain.ascii;
        }
 
+       if (redirection->flags & LB_PASSWORD)
+       {
+               xfree(settings->password);
+               settings->password = redirection->password.ascii;
+       }
+
        return rdp_client_connect(rdp);
 }
 
index 08dc2ec..4373a83 100644 (file)
@@ -637,7 +637,7 @@ static boolean rdp_recv_tpkt_pdu(rdpRdp* rdp, STREAM* s)
                        printf("Error: TODO\n");
                        return false;
                }
-               if (securityHeader & SEC_ENCRYPT)
+               if (securityHeader & (SEC_ENCRYPT|SEC_REDIRECTION_PKT))
                {
                        if (!rdp_decrypt(rdp, s, length - 4))
                        {
@@ -645,6 +645,16 @@ static boolean rdp_recv_tpkt_pdu(rdpRdp* rdp, STREAM* s)
                                return false;
                        }
                }
+               if (securityHeader & SEC_REDIRECTION_PKT)
+               {
+                       /*
+                        * [MS-RDPBCGR] 2.2.13.2.1
+                        *  - no share control header, nor the 2 byte pad
+                        */
+                       s->p -= 2;
+                       rdp_recv_enhanced_security_redirection_packet(rdp, s);
+                       return true;
+               }
        }
 
        if (channelId != MCS_GLOBAL_CHANNEL_ID)