Skip to content

Commit

Permalink
Fix reconnection using the cookie
Browse files Browse the repository at this point in the history
The use of redirection cookie was never done due to global
g_redirect flag was cleared on the wrong place. This fixes
the problem with dual authentication prompts when redirect
to another server upon connect.

Fixes issue #18
  • Loading branch information
hean01-cendio committed May 15, 2017
1 parent 708b0f0 commit b9481bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion rdesktop.c
Expand Up @@ -1156,7 +1156,6 @@ main(int argc, char *argv[])
and therefor we just clear this error before we connect to redirected server.
*/
g_network_error = False;
g_redirect = False;
}

ui_init_connection();
Expand Down
4 changes: 4 additions & 0 deletions rdp.c
Expand Up @@ -338,8 +338,10 @@ rdp_send_logon_info(uint32 flags, char *domain, char *user,

if (g_redirect == True && g_redirect_cookie_len > 0)
{
flags |= RDP_INFO_AUTOLOGON;
len_password = g_redirect_cookie_len;
len_password -= 2; /* substract 2 bytes which is added below */
logger(Protocol, Debug, "rdp_send_logon_info(), Using %d bytes redirect cookie as password", g_redirect_cookie_len);
}

packetlen =
Expand Down Expand Up @@ -1575,6 +1577,8 @@ process_redirect_pdu(STREAM s, RD_BOOL enhanced_redirect /*, uint32 * ext_disc_r

/* read cookie as is */
in_uint8p(s, g_redirect_cookie, g_redirect_cookie_len);

logger(Protocol, Debug, "process_redirect_pdu(), Read %d bytes redirection cookie", g_redirect_cookie_len);
}

if (g_redirect_flags & LB_DONTSTOREUSERNAME)
Expand Down

0 comments on commit b9481bb

Please sign in to comment.