When a user presses cancel in the login dialog on a session on Windows
2008 R2 while a resize was pending, the user would be reconnected to
the session rather than disconnected.
A naive fix for this problem led to problems where reconnecting to
resize a session led to the user being disconnected instead.
The solution for both of these problems is to only look at the error
code sent by the server is if the connection also was deactivated at
the time of the disconnect. In just about all other cases, a
disconnect/main loop quit when the connection is active should result
in a reconnect. The sole exception is if the user closed the rdesktop
window, in case rdesktop also should exit.
We had a case on Windows 2012R2 where any early resizes would be
handled by a reconnect rather than an online resize, which led to a
bunch of follow-up problems with the session startup.
To solve this, we gave the RDPEDISP channel more time to become
established.
Co-authored-by: Henrik Andersson <hean01@cendio.com>
Co-authored-by: Karl Mikaelsson <derfian@cendio.se>
This fixes a problem where a connect loop is triggered
when a user is closing the session and there is a pending
resize triggered. When server sends error info PDU, this
means that the client should close and not enter a
reconnect due to pending resize or other reason such as
network error or redirect...
Co-authored-by: Henrik Andersson <hean01@cendio.com>
Co-authored-by: Karl Mikaelsson <derfian@cendio.se>
Co-authored-by: Thomas Nilefalk <thomas@nilefalk.se>
When dynamic session resize is disabled, leaving fullscreen should
result in a window that matches the session size.
Co-authored-by: Henrik Andersson <hean01@cendio.com>
Co-authored-by: Karl Mikaelsson <derfian@cendio.se>
When the server does not comply with our initial session size
request, we disable the dynamic session resize feature.
Co-authored-by: Henrik Andersson <hean01@cendio.com>
Co-authored-by: Karl Mikaelsson <derfian@cendio.se>
Given that a fullscreen window should have the same size as the
screen, when the server tells us a session size, then we can't
resize the fullscreen window.
Co-authored-by: Henrik Andersson <hean01@cendio.com>
Co-authored-by: Karl Mikaelsson <derfian@cendio.se>
Moving responsibility for actual resize to process_pending_resize()
Cleaning up duplicated calculation of session size
Removing handling of percentage of screen for now
Signed-off-by: Henrik Andersson <hean01@cendio.com>
Signed-off-by: Karl Mikaelsson <derfian@cendio.se>
Signed-off-by: Thomas Nilefalk <thoni56@cendio.se>
Signed-off-by: Henrik Andersson <hean01@cendio.com>
Signed-off-by: Karl Mikaelsson <derfian@cendio.se>
Signed-off-by: Thomas Nilefalk <thoni56@cendio.se>
Resize session using disconnect/reconnect sequence should not be
performed before we have received an auto-reconnect cookie which is
used for reconnecting to the session. There is a race when trying to
reconnect at this point so a defer timer is used to delay this further
from the point where the auto-reconnect cookie is received.
Fixes a problem where a login prompt is shown upon reconnect even if
the auto-reconnect cookie is available and used.
Signed-off-by: Henrik Andersson <hean01@cendio.com>
Signed-off-by: Karl Mikaelsson <derfian@cendio.se>
A correct user initated disconnect sequence should send
a MCS Disconnect Provider Ultimatum PDU defined in T.128
upon a disconnect. This commit adds the implementation
the mentioned PDU and the actual write of the packet.
Signed-off-by: Henrik Andersson <hean01@cendio.com>
This matches how they're described in MS-RDPBCGR. Also add the proper
constant name as comments.
Signed-off-by: Henrik Andersson <hean01@cendio.com>
Signed-off-by: Thomas Nilefalk <thoni56@cendio.se>
Reuse of g_exit_mainloop can occur at various situations
such as on redirection, when a new connection is initialized.
If you call rdp_loop with this flag set, things will not work as
you'd expect.
Fixes issue #228
Signed-off-by: Henrik Andersson <hean01@cendio.com>
Signed-off-by: Karl Mikaelsson <derfian@cendio.se>
Renamed to function to match the PDU it was processing. Removed the
function from proto.h and made it static - there's nothing calling
this from outside of rdp.c. Fixed the logging output to output the
error code instead of the pointer value.
There was either an X11 BadMatch error crash or the
rdesktop main window disappeared when toggling from
window to fullscreen. The bug is consitently
reproducible but only on some systems, maybe this is
a X11 version dependent bug. Move back to old beahavior
were we destroy and recreate the window when toggling
between fullscreen and windowed mode.
Signed-off-by: Henrik Andersson <hean01@cendio.com>
Extract ui_init_connection() into smaller functions
to clarify purpose.
Signed-off-by: Henrik Andersson <hean01@cendio.com>
Signed-off-by: Thomas Nilefalk <thoni56@cendio.se>
When starting rdesktop with a fixed window size against W2008R2,
toggling to fullscreen failed to resize window to expected fullscreen
size.
Signed-off-by: Henrik Andersson <hean01@cendio.com>
Signed-off-by: Thomas Nilefalk <thoni56@cendio.se>
Move ui_init_connection() outside main loop since it is the source for the
fight of requested session size after a resize reconnect. This should only
be called once for setting up initial requested session size via command
line args.
Signed-off-by: Henrik Andersson <hean01@cendio.com>
Signed-off-by: Thomas Nilefalk <thoni56@cendio.se>
This test suite was built with cgreen, and has various tests that
tries to ensure that we didn't break something while developing the
dynamic resize feature.
Signed-off-by: Henrik Andersson <hean01@cendio.com>
Signed-off-by: Karl Mikaelsson <derfian@cendio.se>
Signed-off-by: Thomas Nilefalk <thoni56@cendio.se>
The rdesktop window used to move to a new position on the screen after
leaving fullscreen. This commit restores the window to the position it
had before entering fullscreen.
Signed-off-by: Henrik Andersson <hean01@cendio.com>
Signed-off-by: Karl Mikaelsson <derfian@cendio.se>
Signed-off-by: Thomas Nilefalk <thoni56@cendio.se>