Commit Graph

54 Commits

Author SHA1 Message Date
Henrik Andersson
f616b2c1f9 Release scard context if not used 2017-07-07 13:12:38 +02:00
Henrik Andersson
7d8675074f Fail SCardEstablishContext if no readers connected
Windows smartcard application generally behaves better with polling of smartcard
subsystem availability than when there are no smartcard readers available.

This is a potential workaround for issue #109
2017-03-29 13:45:04 +02:00
Henrik Andersson
b37cbe9abd Refactor for cleaner code flow 2017-03-29 13:36:43 +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
remijouannet
b46639ad3c indent-all.sh 2016-05-24 18:02:22 +02:00
Henrik Andersson
761cc053e2 Fixes a bug with Windows Server 2012 r2 and smartcard
redirection were the RDPDR channel is shutdown by server.

The RDPDR channel is shutdown by server when responses from
abdonend iorequests are received on a reinitialized RDPDR
channel. This fix adds epochs for RDPDR channel and tags 
iorequest to specific epoch to handle abdonend iorequest.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1836 423420c4-83ab-492f-b58f-81f9feb106b5
2014-09-11 11:54:46 +00:00
Henrik Andersson
fffb479e0c Workaround for bug in pcsc lite where timeout value 0
for SCardGetStatusChange() behaves just like INFINIT.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1835 423420c4-83ab-492f-b58f-81f9feb106b5
2014-09-11 11:15:46 +00:00
Peter Åstrand
3dbb64050d Ran indent-all
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1738 423420c4-83ab-492f-b58f-81f9feb106b5
2013-09-16 12:45:47 +00:00
Henrik Andersson
69b6171fd1 Remove undocumented fallback codeblock which existence is not motivated.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1733 423420c4-83ab-492f-b58f-81f9feb106b5
2013-08-29 13:27:35 +00:00
Henrik Andersson
982fd425a3 Fixes a issue with 64bit portability.
Fix for bug #366



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1729 423420c4-83ab-492f-b58f-81f9feb106b5
2013-08-12 09:52:08 +00:00
Pierre Ossman
e0766aae22 Don't screw up the attribute ID for SCardGetAttr(). It
worked by pure luck in some cases, and failed in the rest.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1724 423420c4-83ab-492f-b58f-81f9feb106b5
2013-07-05 14:32:43 +00:00
Pierre Ossman
72dd2ac5be Do a proper parsing of the ReaderState structure. We did not
handle NULL szReader properly previously.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1723 423420c4-83ab-492f-b58f-81f9feb106b5
2013-07-05 11:44:03 +00:00
Henrik Andersson
6e7f45f3e7 Adding forceOutAlignemnt(out, 8) which is just cosmetics.
Thanks goes to Arvo for his findings and provided patch of the 
bugs fixed in r1649, r1650 and this commit.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1651 423420c4-83ab-492f-b58f-81f9feb106b5
2011-12-07 09:49:44 +00:00
Henrik Andersson
d8cc551013 Fixes serious bug were output are aligned before all data is available.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1650 423420c4-83ab-492f-b58f-81f9feb106b5
2011-12-07 09:25:27 +00:00
Henrik Andersson
7e39d5a450 Fixes an invalid check for memory allocation.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1649 423420c4-83ab-492f-b58f-81f9feb106b5
2011-12-07 09:20:39 +00:00
Henrik Andersson
abb83dbd6f This patch fixes smartcard handle problems on 64bit version
of rdesktop, this is jsut a hack to fix the problem with
smartcard imlpementation temporarly due the smartcard impl.
really needs to be reimplement for a cleaner code and proper
handling.

- Ripped out the old magic scard handle code to be replaced
  with mappings the works on 64bit rdesktop.

- Added a handle map to support mapping between a 64bit handle
  and 32bit eg:  pcsclite <- 64bit-> rdesktop <- 32bit -> WTS server.

- Added handle mapping for the context handle to which old code didn't
  event respected at all eg. 64bit context handled truncated to 32bit.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1646 423420c4-83ab-492f-b58f-81f9feb106b5
2011-11-24 13:19:52 +00:00
Henrik Andersson
aa517c7c39 pcsclite >= 1.6.2 does not include the type SCARD_READERSTATE_A which
breaks compilation, change code to use SCARD_READERSTATE which
is the new name and is also an typedef of the old SCARD_READERSTATE_A
from pcslite <1.9.2 versions.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1643 423420c4-83ab-492f-b58f-81f9feb106b5
2011-11-15 08:40:41 +00:00
Pierre Ossman
1da6ed30e5 Some operations consist of just the control code, no data.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1599 423420c4-83ab-492f-b58f-81f9feb106b5
2010-06-22 13:06:50 +00:00
Pierre Ossman
b82d367a4b Translate the response to control code 3400 as it contains embedded control
codes in the local encoding.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1598 423420c4-83ab-492f-b58f-81f9feb106b5
2010-06-22 13:06:16 +00:00
Pierre Ossman
91af7ba5fc Let bogus control codes through with a warning, in case it might work
anyway.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1597 423420c4-83ab-492f-b58f-81f9feb106b5
2010-06-22 13:05:26 +00:00
Pierre Ossman
7e759ced83 Add copyright notice.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1596 423420c4-83ab-492f-b58f-81f9feb106b5
2010-06-14 07:36:52 +00:00
Pierre Ossman
1ac2cd144e Control codes to SCardControl() are platform dependent so we need to do
some translation before passing them on.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1595 423420c4-83ab-492f-b58f-81f9feb106b5
2010-06-14 07:35:55 +00:00
Pierre Ossman
4635dfc148 Remove undocumented voodoo in SCardGetStatusChange() as it causes the
system version to return immediately, causing CPU intensive loops.


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1594 423420c4-83ab-492f-b58f-81f9feb106b5
2010-06-14 07:35:00 +00:00
Peter Åstrand
aab770d625 Indented
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1562 423420c4-83ab-492f-b58f-81f9feb106b5
2010-01-27 07:40:47 +00:00
Peter Åstrand
60e82d86ef Reset smart card state before reconnect. This fixes stability problems
when using smart cards in conjunction with RandR. 



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1561 423420c4-83ab-492f-b58f-81f9feb106b5
2010-01-26 12:23:53 +00:00
Peter Åstrand
f749dbfef4 Avoid a few more compile warnings. This file should now build without
warnings on 32 bit platforms, when debugging is not enabled. 



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1560 423420c4-83ab-492f-b58f-81f9feb106b5
2010-01-26 10:24:26 +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
f6e5fe5f38 Indent fixes
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1428 423420c4-83ab-492f-b58f-81f9feb106b5
2008-01-24 08:06:02 +00:00
Michael Gernoth
5c01b88a5f Smartcard fixes (bigendian support, locking, bugfixes) from
Paul Winder <Paul.Winder@tadpole.com>


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1420 423420c4-83ab-492f-b58f-81f9feb106b5
2007-10-30 13:09:37 +00:00
Michael Gernoth
27c360df03 really check for version of pcsclite in configure.ac
this fixes the smartcard-support on OS X 10.5


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1419 423420c4-83ab-492f-b58f-81f9feb106b5
2007-10-28 16:49:45 +00:00
Pierre Ossman
190c138e53 Respect mask used when searching for cards.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1415 423420c4-83ab-492f-b58f-81f9feb106b5
2007-07-03 14:20:04 +00:00
Pierre Ossman
421c2386d3 Improve readability of smart card code.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1414 423420c4-83ab-492f-b58f-81f9feb106b5
2007-07-03 14:08:06 +00:00
Pierre Ossman
d90bdbcb23 Fix two crashes caused by improver handling of structures.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1413 423420c4-83ab-492f-b58f-81f9feb106b5
2007-06-28 12:52:13 +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
Michael Gernoth
9769d751ee some more RD_BOOL
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1372 423420c4-83ab-492f-b58f-81f9feb106b5
2007-01-08 12:38:34 +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
Michael Gernoth
510afcca69 ignore PCSCs idea of BOOL
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1367 423420c4-83ab-492f-b58f-81f9feb106b5
2007-01-04 23:19:54 +00:00
Michael Gernoth
ce8fe4d0e4 RD_ prefix
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1366 423420c4-83ab-492f-b58f-81f9feb106b5
2007-01-04 14:38:48 +00:00
Michael Gernoth
a9ad53b482 add human readable error messages
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1329 423420c4-83ab-492f-b58f-81f9feb106b5
2006-11-04 20:02:42 +00:00
Michael Gernoth
1a3b95e662 initialize scard_mutex
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1328 423420c4-83ab-492f-b58f-81f9feb106b5
2006-11-04 17:33:15 +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
8419d91138 make sure to lock the datapath of rdpdr_send_completion to prevent
simultaneous access to shared variables in multiple threads


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1326 423420c4-83ab-492f-b58f-81f9feb106b5
2006-11-03 19:56:42 +00:00
Michael Gernoth
659a1e062b reset padding to 8, as it did not fix the disconnects
enable sendControl mutex, as the rest of rdesktop is not threadsafe and
parallel access to rdpdr_send_completion might very likely result in
these disconnects


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1325 423420c4-83ab-492f-b58f-81f9feb106b5
2006-11-03 18:57:09 +00:00
Michael Gernoth
1c153f3315 Change email of Alexi Volkov
Remove smartcard banner from scard.c (ACKed by Alexi)


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1322 423420c4-83ab-492f-b58f-81f9feb106b5
2006-11-03 14:28:10 +00:00
Michael Gernoth
df43fd5d93 always pad
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1321 423420c4-83ab-492f-b58f-81f9feb106b5
2006-11-02 23:31:58 +00:00
Michael Gernoth
573ded9db3 increase padding.
this seems to fix disconnects with encryption-errors reported in the
TS log


git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1320 423420c4-83ab-492f-b58f-81f9feb106b5
2006-11-02 23:12:25 +00:00
Michael Gernoth
69deb20512 use xmalloc for mutex allocation
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1319 423420c4-83ab-492f-b58f-81f9feb106b5
2006-11-02 21:32:56 +00:00
Michael Gernoth
24680f4f8d clean up smartcard debugging
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1318 423420c4-83ab-492f-b58f-81f9feb106b5
2006-11-02 20:48:28 +00:00
Michael Gernoth
bb039e933b move response-limitation to a more appropriate place
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1316 423420c4-83ab-492f-b58f-81f9feb106b5
2006-11-02 11:09:35 +00:00
Michael Gernoth
58280c0b72 remove a bit code duplication
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1315 423420c4-83ab-492f-b58f-81f9feb106b5
2006-11-01 22:46:05 +00:00