[Pcsclite-muscle] Delegate WinSCard calls to another library (for a RDP server for example)

Ludovic Rousseau ludovic.rousseau at gmail.com
Sat Mar 16 03:54:06 PDT 2024


Hello Marcin,

Le sam. 16 mars 2024 à 02:35, Marcin Cieslak <saper at saper.info> a écrit :
>
> On Fri, 15 Mar 2024, Ludovic Rousseau wrote:
>
> > Hello,
> >
> > I am working on a new idea for pcsc-lite: Delegate WinSCard calls to
> > another library
> >
> > The application will call SCardEstablishContext() (for example) as
> > before but the call is not directly sent to libpcsclite.so.1. Instead
> > we have a intermediate library that can redirect the call somewhere
> > else.
>
> I think the same effect could be achieved with the runtime linker
> filter feature, see https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter4-4.html
> "Shared Objects as Filters".

This looks very interesting.

> I don't know for macOS, but FreeBSD has moved its system calls
> out of the libc using this feature. I guess it is available
> to other systems, not only BSD and Solaris.

I could not find the GNU GCC documentation for this "Shared Objects as
Filters" feature.

And it looks like gcc or clang do not support it:
gcc -o filtee.so.1 -G -K pic filtee.c
gcc: error: unrecognized command-line option ‘-G’
gcc: error: unrecognized command-line option ‘-K’

clang -o filtee.so.1 -G -K pic filtee.c
clang: error: no such file or directory: 'pic'

If I remove "pic" argument:
clang -o filtee.so.1 -G -K filtee.c
clang: warning: argument unused during compilation: '-G -K'
[-Wunused-command-line-argument]
/usr/bin/ld: /lib/x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Shared Objects as Filters looks to be a *BSD and Solaris specific feature.
Maybe GNU/Linux has a similar mechanism but I have not yet found it.

Regards,

--
 Dr. Ludovic Rousseau



More information about the pcsclite-muscle mailing list