Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incompatibility between pcsc-tools 1.5.2 and pcsc-lite-devel 1.8.23? #23

Closed
emasean opened this issue Jun 18, 2019 · 8 comments
Closed

Comments

@emasean
Copy link

emasean commented Jun 18, 2019

I am downloading:

  • pcsc-tools
  • pcsc-lite-devel
  • pcsc-ccud
    For SLES 15 but got:
68796f5e8c86:/opt/ic/ic-sim # pcsc_scan
PC/SC device scanner
V 1.5.2 (c) 2001-2017, Ludovic Rousseau <[email protected]>
SCardEstablishContext: RPC transport error.```

versions used:

68796f5e8c86:/usr/lib64 # zypper info pcsc-tools
Refreshing service 'container-suseconnect-zypp'.
Problem retrieving the repository index file for service 'container-suseconnect-zypp':
[container-suseconnect-zypp|file:/usr/lib/zypp/plugins/services/container-suseconnect-zypp] 
Warning: Skipping service 'container-suseconnect-zypp' because of the above error.
Loading repository data...
Reading installed packages...


Information for package pcsc-tools:
-----------------------------------
Repository     : SLE-Module-Basesystem           
Name           : pcsc-tools                      
Version        : 1.5.2-1.31                      
Arch           : x86_64                          
Vendor         : SUSE LLC <https://www.suse.com/>
Support Level  : Level 3                         
Installed Size : 949.4 KiB                       
Installed      : Yes                             
Status         : up-to-date                      
Source package : pcsc-tools-1.5.2-1.31.src       
Summary        : PC/SC Tools                     
Description    :                                 
    These tools are used to test a PC/SC driver, card or reader
    or send commands in a friendly environment
    (text or graphical user interface).

68796f5e8c86:/usr/lib64 # zypper info pcsc-lite-devel
Refreshing service 'container-suseconnect-zypp'.
Problem retrieving the repository index file for service 'container-suseconnect-zypp':
[container-suseconnect-zypp|file:/usr/lib/zypp/plugins/services/container-suseconnect-zypp] 
Warning: Skipping service 'container-suseconnect-zypp' because of the above error.
Loading repository data...
Reading installed packages...


Information for package pcsc-lite-devel:
----------------------------------------
Repository     : SLE-Module-Basesystem                                        
Name           : pcsc-lite-devel                                              
Version        : 1.8.23-2.27                                                  
Arch           : x86_64                                                       
Vendor         : SUSE LLC <https://www.suse.com/>                             
Support Level  : Level 3                                                      
Installed Size : 180.5 KiB                                                    
Installed      : Yes                                                          
Status         : up-to-date                                                   
Source package : pcsc-lite-1.8.23-2.27.src                                    
Summary        : Development package for the MUSCLE project SmartCards library
Description    :                                                              
    This package contains the development files for pcsc-lite. It allows to
    compile plugins for the pcsc-lite package.

68796f5e8c86:/usr/lib64 # zypper info pcsc-ccid      
Refreshing service 'container-suseconnect-zypp'.
Problem retrieving the repository index file for service 'container-suseconnect-zypp':
[container-suseconnect-zypp|file:/usr/lib/zypp/plugins/services/container-suseconnect-zypp] 
Warning: Skipping service 'container-suseconnect-zypp' because of the above error.
Loading repository data...
Reading installed packages...


Information for package pcsc-ccid:
----------------------------------
Repository     : SLE-Module-Basesystem                                                     
Name           : pcsc-ccid                                                                 
Version        : 1.4.28-1.31                                                               
Arch           : x86_64                                                                    
Vendor         : SUSE LLC <https://www.suse.com/>                                          
Support Level  : Level 3                                                                   
Installed Size : 1.4 MiB                                                                   
Installed      : Yes                                                                       
Status         : up-to-date                                                                
Source package : pcsc-ccid-1.4.28-1.31.src                                                 
Summary        : PCSC Driver for CCID Based Smart Card Readers and GemPC Twin Serial Reader
Description    :                                                                           
    This package contains a generic USB CCID (Chip/Smart Card Interface
    Devices) driver.

    This driver is meant to be used with the PCSC-Lite daemon from the
    pcsc-lite package.
@LudovicRousseau
Copy link
Owner

What is the output of:

strace pcsc_scan

@emasean
Copy link
Author

emasean commented Jun 27, 2019

strace pcsc_scan
execve("/usr/bin/pcsc_scan", ["pcsc_scan"], 0x7ffc66e6abf0 /* 8 vars */) = 0
brk(NULL)                               = 0x55f39b4bc000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=14611, ...}) = 0
mmap(NULL, 14611, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fe0b4f14000
close(3)                                = 0
openat(AT_FDCWD, "/usr/lib64/libpcsclite.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\33\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=43456, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe0b4f12000
mmap(NULL, 2141808, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe0b4ae8000
mprotect(0x7fe0b4af2000, 2093056, PROT_NONE) = 0
mmap(0x7fe0b4cf1000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x9000) = 0x7fe0b4cf1000
close(3)                                = 0
openat(AT_FDCWD, "/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360a\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=140688, ...}) = 0
mmap(NULL, 2217064, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe0b48ca000
mprotect(0x7fe0b48e3000, 2093056, PROT_NONE) = 0
mmap(0x7fe0b4ae2000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0x7fe0b4ae2000
mmap(0x7fe0b4ae4000, 13416, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fe0b4ae4000
close(3)                                = 0
openat(AT_FDCWD, "/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240\20\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2034840, ...}) = 0
mmap(NULL, 3906144, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fe0b4510000
mprotect(0x7fe0b46c1000, 2093056, PROT_NONE) = 0
mmap(0x7fe0b48c0000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b0000) = 0x7fe0b48c0000
mmap(0x7fe0b48c6000, 14944, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fe0b48c6000
close(3)                                = 0
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe0b4f0f000
arch_prctl(ARCH_SET_FS, 0x7fe0b4f0f780) = 0
mprotect(0x7fe0b48c0000, 16384, PROT_READ) = 0
mprotect(0x7fe0b4ae2000, 4096, PROT_READ) = 0
mprotect(0x7fe0b4cf1000, 4096, PROT_READ) = 0
mprotect(0x55f39afd0000, 4096, PROT_READ) = 0
mprotect(0x7fe0b4f18000, 4096, PROT_READ) = 0
munmap(0x7fe0b4f14000, 14611)           = 0
set_tid_address(0x7fe0b4f0fa50)         = 40
set_robust_list(0x7fe0b4f0fa60, 24)     = 0
rt_sigaction(SIGRTMIN, {sa_handler=0x7fe0b48cfc60, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7fe0b48dc300}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0x7fe0b48cfd00, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x7fe0b48dc300}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
brk(NULL)                               = 0x55f39b4bc000
brk(0x55f39b4dd000)                     = 0x55f39b4dd000
write(1, "PC/SC device scanner\n", 21PC/SC device scanner
)  = 21
write(1, "V 1.5.2 (c) 2001-2017, Ludovic R"..., 67V 1.5.2 (c) 2001-2017, Ludovic Rousseau <[email protected]>
) = 67
stat("/var/run/pcscd/pcscd.comm", {st_mode=S_IFSOCK|0666, st_size=0, ...}) = 0
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/pcscd/pcscd.comm"}, 28) = 0
fcntl(3, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
select(4, NULL, [3], NULL, NULL)        = 1 (out [3])
sendto(3, "\f\0\0\0\21\0\0\0", 8, MSG_NOSIGNAL, NULL, 0) = 8
select(4, NULL, [3], NULL, NULL)        = 1 (out [3])
sendto(3, "\4\0\0\0\3\0\0\0\0\0\0\0", 12, MSG_NOSIGNAL, NULL, 0) = 12
select(4, [3], NULL, NULL, NULL)        = 1 (in [3])
read(3, 0x7ffd0c68a16c, 12)             = -1 ECONNRESET (Connection reset by peer)
ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(1, "\33[31mSCardEstablishContext: RPC "..., 53SCardEstablishContext: RPC transport error.
) = 53
exit_group(-1)                          = ?
+++ exited with 255 +++

@LudovicRousseau
Copy link
Owner

Now please provide a pcscd log as described at https://pcsclite.apdu.fr/#support

@emasean
Copy link
Author

emasean commented Jun 27, 2019

24080463 winscard_msg_srv.c:255:ProcessEventsServer() Common channel packet arrival
00000028 winscard_msg_srv.c:267:ProcessEventsServer() ProcessCommonChannelRequest detects: 7
00000004 pcscdaemon.c:133:SVCServiceRunLoop() A new context thread creation is requested: 7
00000251 auth.c:86:IsClientAuthorized() polkit_authority_get_sync failed
00000008 winscard_svc.c:335:ContextThread() Rejected unauthorized PC/SC client
00000015 winscard_svc.c:1029:MSGCleanupClient() Thread is stopping: dwClientID=7, threadContext @0x556cb9519ac0
00000003 winscard_svc.c:1035:MSGCleanupClient() Freeing SCONTEXT @0x556cb9519ac0

@LudovicRousseau
Copy link
Owner

It is a PolicyKit issue.
Have a look at https://github.com/LudovicRousseau/PCSC/blob/master/doc/README.polkit

I don't know why the function failed.
Try to rebuild pcsc-lite with this patch to get more information.

diff --git a/src/auth.c b/src/auth.c
index 1d06b3f..f8ea2dc 100644
--- a/src/auth.c
+++ b/src/auth.c
@@ -80,10 +80,11 @@ unsigned IsClientAuthorized(int socket, const char* action, const char* reader)
        return 0;
    }
 
-   authority = polkit_authority_get_sync(NULL, NULL);
+   authority = polkit_authority_get_sync(NULL, &error);
    if (authority == NULL)
    {
-       Log1(PCSC_LOG_CRITICAL, "polkit_authority_get_sync failed");
+       Log2(PCSC_LOG_CRITICAL, "polkit_authority_get_sync failed: %s",
+           error->message);
        return 0;
    }
 

@emasean
Copy link
Author

emasean commented Jun 27, 2019

00000036 [140396675705024] winscard_msg_srv.c:267:ProcessEventsServer() ProcessCommonChannelRequest detects: 6
00000004 [140396675705024] pcscdaemon.c:133:SVCServiceRunLoop() A new context thread creation is requested: 6
00000076 [140396632725248] winscard_svc.c:340:ContextThread() Authorized PC/SC client
00000010 [140396632725248] winscard_svc.c:344:ContextThread() Thread is started: dwClientID=6, threadContext @0xfe5940
00000056 [140396632725248] winscard_svc.c:362:ContextThread() Received command: CMD_VERSION from client 6
00000086 [140396632725248] winscard_svc.c:374:ContextThread() Client is protocol version 4:3
00000007 [140396632725248] winscard_svc.c:383:ContextThread() Client protocol is 4:3
00000003 [140396632725248] winscard_svc.c:385:ContextThread() Server protocol is 4:4
00000003 [140396632725248] winscard_svc.c:394:ContextThread() CMD_VERSION rv=0x8010001D for client 6
00000300 [140396632725248] winscard_svc.c:354:ContextThread() Client die: 6
00000041 [140396632725248] winscard_svc.c:1055:MSGCleanupClient() Thread is stopping: dwClientID=6, threadContext @0xfe5940
00000007 [140396632725248] winscard_svc.c:1061:MSGCleanupClient() Freeing SCONTEXT @0xfe5940```

@LudovicRousseau
Copy link
Owner

Client protocol is 4:3
Server protocol is 4:4

You are using a pcscd with a libpcsclite.so.1 from 2 different versions of pcsc-lite. This can't work.
I guess you have installed pcsc-lite manually from a different version than the one from pcsc-lite SUSE package.

@emasean
Copy link
Author

emasean commented Jun 28, 2019

When we build ourselves the libpcsclite from the source it worked fine, but when we take the binary from the SUSE repo (same version) it fails, we will check with SUSE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants