libregression.so.1 is used to emulate a bug in SCardStatus()
that existed in the open source distribution of PC/SC lite as early as 
the 1.1.x release.  This bug has been discussed and confirmed on the 
sourceforge mail list for the PC/SC lite project.

The problem is a mismatch in how SCardStatus() returns data to
the caller when a zero-length reader list length is passed
(or if a null reader list is passed). 

PCSCBypass used the same specification violating behavior in order
to continue to function with some 3rd party applications, however
the bug is fixed in SUNWpcsc.  Therefore for 3rd party applications
that depend on the broken behavior, a means to simulate the bug
is required, and that's what this interposing library does.

The LD_PRELOAD environment variable is used to insert libregression
between the client application and libpcsclite.so.1, in order to allow
it to intercept the function call and modify the result.  (See note
below if you're using Sun Ray Windows Connector).

LD_PRELOAD should be set only for the duration of the run of the
client application binary.  Otherwise,  subsequent processes will
also be interposed on, possibly to ill-effect, for example during
the execution of UNIX commands.

libregression usage example (from bash shell):

$  LD_PRELOAD=/usr/lib/smartcard/tmp/libregression.so.1 ./my_pcsclite_app

IMPORTANT NOTE FOR SUN RAY WINDOWS CONNECTOR:
   If using Sun Ray Windows Connector instead of using LD_PRELOAD specify 
   SUN_LIB_PCSCLITE.  This is required as a workaround to security
   issues because uttsc sets the setgid bit.

The code the interposer applies to fix the returned data after the 
SCardStatus() call returns is:

   if (rv == SCARD_S_SUCCESS &&
       (origReaderLen == 0 || origReaderNames == NULL)) {
	*pcbAtrLen = 0;
	*pdwState = 0;
	*pdwProtocol = 0;
   }


NOTE: The cardstatus tool can be used to test the behavior of the
interposer.  See cardstatus README for more information

