Commit Graph

64 Commits

Author SHA1 Message Date
Karl Mikaelsson
d6c99bf599 Save and re-use resolved address for given hostname
If tcp_connect is called with the same server name, don't look up the
address again. This avoids connecting to other servers when using a
round-robin RDS farm name, as recommended by Microsoft.

This introduces a backwards-incompatible change. If rdesktop was
reconnecting because the user was moving between networks and the
server is no longer reachable on the same address, the user must
re-start rdesktop to reach their server.
2018-03-22 15:36:36 +01:00
Cendio
ab50ea31cf Implement dynamic session resize
This adds support for resizing the RDP session dynamically based on
the window size. Some complicated logic has been added to avoid
sending excessive amounts of resize requests to the RDP server.

When supported, this resize mechanism should use the RDPEDISP way of
signalling the server to initiate a Deactivate/Activate sequence, but
rdesktop will fall back on Disconnect/Reconnect if RDPEDISP is not
supported by the server.

ui_select has been refactored and most functionality has been broken
out into three new functions, simplifying ui_select into a loop.

Signed-off-by: Henrik Andersson <hean01@cendio.com>
Signed-off-by: Karl Mikaelsson <derfian@cendio.se>
Signed-off-by: Thomas Nilefalk <thoni56@cendio.se>
2017-12-07 11:15:03 +01:00
Henrik Andersson
fc6ce03875 Make use of shared stream api
Remove own componized realloc and reset code to
shared stream api implementation.
2017-09-28 19:15:00 +02:00
Henrik Andersson
908ad64d84 Add additional logging for SSL errors
This was added to provide more information when things fails
as in  issue #118.
2017-05-12 13:15:45 +02:00
Henrik Andersson
87d8d123b8 Rework the logging system
This commit will add a logging system to solve the problem that
one actually need to recompile rdesktop from source to enable
different debug logging.

- Same logging api  for all kind of logging and messages to
   end user.

- Adding -v for verbose output when running rdesktop.

- All messages are logged into a subject and with a type, eg:

     logger(Keyboard, Notice, "Autos-electing %s based on locale.", locale);

- Debug logging is enabled trough a environment variable RDEKSTOP_DEBUG,
  which specifies subjects of interest, comma separated. There is a special
  subject named All which includes all subject for debug loggin. There is also
  a simple logic opeartor '!' = NOT which can be used in combination like:

    RDESKTOP_DEBUG=All,!Graphics,!Sound

  Which would give debug log output for All subject except Graphics and Sound.
2017-01-26 14:19:40 +01:00
Henrik Andersson
a90ea17abb Test if SSL_OP_NO_COMPRESSION is defined before use.
OpenSSL < 0.9.9 does not support this option, see upstream
commit 566dda07ba16f9d3b9774fd5c8d526d7cc93f179 for reference.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1734 423420c4-83ab-492f-b58f-81f9feb106b5
2013-08-29 14:27:25 +00:00
Henrik Andersson
be5ae57fe0 Return a NULL value as expected.
Partly fix for bug #366



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1728 423420c4-83ab-492f-b58f-81f9feb106b5
2013-08-10 16:16:55 +00:00
Henrik Andersson
cab6380beb Do not do SSL_Shutdown if we have triggered a network error,
this will result in segfault in ssl.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1722 423420c4-83ab-492f-b58f-81f9feb106b5
2013-06-27 10:43:34 +00:00
Henrik Andersson
adbb6cf0fc Run indent-all script.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1721 423420c4-83ab-492f-b58f-81f9feb106b5
2013-06-20 12:57:00 +00:00
Henrik Andersson
e6b10f6bcb Added tcp_ui_run() to prevent ui_select() push data on transport
which corrupts the stream and prevents a SSL reconnect to work.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1720 423420c4-83ab-492f-b58f-81f9feb106b5
2013-06-20 12:51:27 +00:00
Henrik Andersson
dc3be1486d Bring back reset of g_ssl on reset_state()
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1719 423420c4-83ab-492f-b58f-81f9feb106b5
2013-06-20 11:10:24 +00:00
Henrik Andersson
8200b5bbd4 Move g_ssl cleanup from reset_state() and only setup one ssl context per process.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1718 423420c4-83ab-492f-b58f-81f9feb106b5
2013-06-20 10:50:39 +00:00
Henrik Andersson
8ba120fdbd SSL library initialization is not reentrant, lets do it once.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1717 423420c4-83ab-492f-b58f-81f9feb106b5
2013-06-20 09:36:11 +00:00
Henrik Andersson
ae7c48a1c0 Set g_sock at correct point and remove from reset_state()
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1716 423420c4-83ab-492f-b58f-81f9feb106b5
2013-06-20 09:29:21 +00:00
Henrik Andersson
cd7a7342cb Silence some error spamming when rdesktop is in reconnect loop.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1713 423420c4-83ab-492f-b58f-81f9feb106b5
2013-06-14 12:54:38 +00:00
Henrik Andersson
7d2f65002a Make sure we don't spam log with failed send() messages if we
already have detected a network failure.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1711 423420c4-83ab-492f-b58f-81f9feb106b5
2013-06-13 11:01:55 +00:00
Henrik Andersson
eced6ca821 Reconnect upon network failure, retry as long the autoreconnect
cookie is valid.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1707 423420c4-83ab-492f-b58f-81f9feb106b5
2013-04-12 06:46:07 +00:00
Henrik Andersson
9f174ea864 Added check if socket is connected to prevent sending disconnect
sequence to a closed socket.

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1681 423420c4-83ab-492f-b58f-81f9feb106b5
2012-11-22 13:38:35 +00:00
Henrik Andersson
6d437f8116 Change the SSL context option to specific onse instead of using all
which introduces some problems.
Added some graceful handling of peer SSL shutdown for better error
reporting.

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1675 423420c4-83ab-492f-b58f-81f9feb106b5
2012-11-15 11:20:37 +00:00
Henrik Andersson
c44025aa18 Added support for protocol negotiation, this is a part of
adding Enhanced RDP Security support to rdesktop and brings
support for TLSv1 tunnel functionality.

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1659 423420c4-83ab-492f-b58f-81f9feb106b5
2012-06-15 05:16:20 +00:00
Peter Åstrand
b638882347 Include emails in copyright statements.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1615 423420c4-83ab-492f-b58f-81f9feb106b5
2011-04-13 11:13:04 +00:00
Peter Åstrand
27068f53f8 Updated the copyright notices for the things we have been working on.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1612 423420c4-83ab-492f-b58f-81f9feb106b5
2011-04-13 08:55:42 +00:00
Peter Åstrand
281d7c9f06 Changed license to GPLv3
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1534 423420c4-83ab-492f-b58f-81f9feb106b5
2010-01-12 08:31:06 +00:00
Peter Åstrand
058ee33be3 Clean up and document the return values. Trying to solve a number of issues:
* The current return values have been selected pretty much without any
thought. Basically, the value 1 is used for all different kinds of
errors, except for a corner case where the server doesn't send a
RDP_PDU_DEACTIVATE in combination with a few special "reasons", where
the value 2 is used instead.

* rdesktop will currently also return with 2 if the user is closing
the rdesktop window, the same error as many other fatal errors, which
is somewhat strange.

* The main principle of my patch is to utilize more of the available
256 return codes. We are currently only using 3 values out of
256. This is bad; rdesktop should expose more information to the
caller about error conditions if it can.

Besides using the standardized exit codes for generic errors such as
EX_USAGE for command line usage errors, I've also exposed the
"extended disconnect reasons" from RDP. This allows for, for example,
to be able to distinguish between a logoff and a disconnect.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1510 423420c4-83ab-492f-b58f-81f9feb106b5
2009-09-02 13:03:43 +00:00
Jay Sorg
88855ddcbf update the copyright year
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1474 423420c4-83ab-492f-b58f-81f9feb106b5
2008-07-11 03:51:23 +00:00
Michael Gernoth
a8338fcd6e always make g_out an array
this removes duplicated code from scard.c


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1396 423420c4-83ab-492f-b58f-81f9feb106b5
2007-02-20 16:51:46 +00:00
Jay Sorg
6091381a81 prefix BOOL with RD_
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1371 423420c4-83ab-492f-b58f-81f9feb106b5
2007-01-08 04:47:06 +00:00
Jay Sorg
797df4fa02 copyright year update
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1364 423420c4-83ab-492f-b58f-81f9feb106b5
2007-01-04 05:39:39 +00:00
Peter Åstrand
9d9a7ecdcb Indent fix
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1361 423420c4-83ab-492f-b58f-81f9feb106b5
2007-01-03 06:41:13 +00:00
Jay Sorg
c1aa0656a4 win32 bits
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1348 423420c4-83ab-492f-b58f-81f9feb106b5
2006-12-23 03:23:59 +00:00
Michael Gernoth
c3f49ea246 more smartcard locking fixes
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1327 423420c4-83ab-492f-b58f-81f9feb106b5
2006-11-03 23:51:35 +00:00
Michael Gernoth
f37c871e8b Smartcard support by Alexi Volkov <alexi@pravex.kiev.ua> and additional
patches for smartcard-support by Jennings Jared <jared.jennings.ctr@eglin.af.mil>


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1308 423420c4-83ab-492f-b58f-81f9feb106b5
2006-11-01 20:52:01 +00:00
Peter Åstrand
75ea7d9148 Applied patch #1247780 (slightly modified) from Brian Chapeau: Session Directory support.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@976 423420c4-83ab-492f-b58f-81f9feb106b5
2005-08-08 19:15:57 +00:00
Peter Åstrand
1320755f2b Added missing c-basic-offset:s and license headers
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@962 423420c4-83ab-492f-b58f-81f9feb106b5
2005-08-03 10:56:16 +00:00
Michael Gernoth
e34eecdad0 Real fix for socklen_t
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@871 423420c4-83ab-492f-b58f-81f9feb106b5
2005-03-31 10:49:59 +00:00
Michael Gernoth
6b43ce2883 socklen_t is not available on all systems (for example mac osx 10.2)
replace it by an int right now


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@869 423420c4-83ab-492f-b58f-81f9feb106b5
2005-03-30 19:35:42 +00:00
Michael Gernoth
ec643e4718 bump version to 1.4.0
change year in files
add missing docu for updated commandline-flags
update changelog


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@827 423420c4-83ab-492f-b58f-81f9feb106b5
2005-03-06 21:11:18 +00:00
Jeroen Meijer
c89189d550 fix compiler warning about passing arg from incompatible pointer type
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@823 423420c4-83ab-492f-b58f-81f9feb106b5
2005-03-02 01:18:33 +00:00
Michael Gernoth
7f90b0ea1f Fix for my last tcp.c fix to provide sensible error-messages again
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@727 423420c4-83ab-492f-b58f-81f9feb106b5
2004-06-27 19:17:24 +00:00
Michael Gernoth
4004b21d48 Fix segfault on platforms where getaddrinfo returns non-negative error-
codes (e.g. solaris)


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@723 423420c4-83ab-492f-b58f-81f9feb106b5
2004-06-25 15:46:26 +00:00
Jay Sorg
a9cad0b9cf proceed more global vars with g_
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@709 423420c4-83ab-492f-b58f-81f9feb106b5
2004-06-15 22:17:08 +00:00
Peter Kallden
4e41a6f2ea get address function from volker milde
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@624 423420c4-83ab-492f-b58f-81f9feb106b5
2004-03-04 08:14:00 +00:00
Peter Åstrand
9c9a020b8f errno is not valid when recv returns zero.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@545 423420c4-83ab-492f-b58f-81f9feb106b5
2003-11-08 09:17:41 +00:00
Peter Åstrand
ec91795552 ipv6 connect sanity checking: error message if not able to connect,
instead of just segfaulting.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@442 423420c4-83ab-492f-b58f-81f9feb106b5
2003-08-17 07:28:53 +00:00
Peter Åstrand
e2e9f20bf2 Applied IPv6 patch from mike@dexy.mine.nu.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@439 423420c4-83ab-492f-b58f-81f9feb106b5
2003-08-11 11:09:17 +00:00
Matt Chapman
2c32c1ec3a Eliminate previous ugly hack for RDP5 packets, in order to make it work
with low encryption.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@422 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-17 08:44:32 +00:00
Erik Forsberg
dc6de146a4 Indentation changes.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@407 423420c4-83ab-492f-b58f-81f9feb106b5
2003-06-06 10:44:20 +00:00
Jay Sorg
70de4fa1f9 changes so it compiles with g++(mainly for ports)
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@375 423420c4-83ab-492f-b58f-81f9feb106b5
2003-05-19 21:36:33 +00:00
Matt Chapman
177848b45b Solaris doesn't define INADDR_NONE (fix from Simon McCartney)
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@305 423420c4-83ab-492f-b58f-81f9feb106b5
2003-01-30 13:38:47 +00:00
Matt Chapman
33296581d6 Fix a bug where we report "Network is unreachable" instead of
"cannot resolve host".


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@302 423420c4-83ab-492f-b58f-81f9feb106b5
2003-01-30 11:57:10 +00:00