1. 11 Sep, 2019 1 commit
    • Ludovic Rousseau's avatar
      Exit with EXIT_SUCCESS on shutdown to please systemd · 3896019c
      Ludovic Rousseau authored
      From Jakub Jelen nice bug report:
      " The pcscd daemon exits with exit code 1 when it is killed by systemd,
      which confuses system thinking that there was some failure on the exit:
      
      Sep 11 13:22:54 workstation-uefi pcscd[8750]: 08450216 pcscdaemon.c:193:signal_thread() Received signal: 15
      Sep 11 13:22:54 workstation-uefi pcscd[8750]: 00000015 pcscdaemon.c:213:signal_thread() Direct suicide
      Sep 11 13:22:54 workstation-uefi pcscd[8750]: 00000004 pcscdaemon.c:786:at_exit() cleaning /var/run/pcscd
      Sep 11 13:22:54 workstation-uefi systemd[1]: Stopping PC/SC Smart Card Daemon...
      Sep 11 13:22:54 workstation-uefi systemd[1]: pcscd.service: Main process exited, code=exited, status=1/FAILURE
      Sep 11 13:22:54 workstation-uefi systemd[1]: pcscd.service: Failed with result 'exit-code'.
      Sep 11 13:22:54 workstation-uefi systemd[1]: Stopped PC/SC Smart Card Daemon.
      
      Reading through the code, it looks like it exits always with 1 (except
      for the alarm) so I think we should either
      
      - modify the shipped systemd service file to mark the exit code 1 as a
        successful exit code using SuccessExitStatus or - sign in front of
        ExecStart.
      - modify the pcscd to exit "cleanly" in case of termination by systemd.
      
      I do not have any strong opinions which way is more correct, nor the
      systemd maintainers do so this is merely cosmetic issue avoiding bogus
      error messages filling log files on every reboot.
      
      Initially filled as a Fedora bug:
      https://bugzilla.redhat.com/show_bug.cgi?id=1751153 "
      
      I implemented the second solution.
      
      Fixes https://github.com/LudovicRousseau/PCSC/issues/70
      "Unclean exit when the pcscd is killed by systemd (for example on reboot)"
      3896019c
  2. 01 Sep, 2019 2 commits
    • Ludovic Rousseau's avatar
      spy: fix minor warning · 142bc175
      Ludovic Rousseau authored
      Use %08lX for rv codes (LONG)
      
      Thanks to Coverity:
      CID 1453383 (#1 of 1): Invalid type in argument to printf format specifier (PRINTF_ARGS)
      invalid_type: Argument rv to format specifier %08X was expected to have type unsigned int but has type long.
      142bc175
    • Ludovic Rousseau's avatar
      spy: fix year-2038 issue by using long instead of int · 9500c617
      Ludovic Rousseau authored
      .tv_sec and .tv_usec in struct timeval may be long (and should be) to
      avoid the year-2038 problem.
      
      Thanks to Coverity:
      CID 1453385 (#1 of 1): Invalid type in argument to printf format specifier (PRINTF_ARGS)
      invalid_type: Argument profile_time.tv_usec to format specifier %d was expected to have type int but has type long.
      
      CID 1453384 (#1 of 1): Invalid type in argument to printf format specifier (PRINTF_ARGS)
      invalid_type: Argument profile_time.tv_sec to format specifier %d was expected to have type int but has type long.
      9500c617
  3. 21 Aug, 2019 4 commits
  4. 20 Jun, 2019 1 commit
    • Ludovic Rousseau's avatar
      Guard definition of PCSC_API: Fix compiler warning · 3afbec34
      Ludovic Rousseau authored
      When compiling CCID on macOS I got:
      In file included from ccid_usb.c:34:
      ./misc.h:47:9: warning: 'PCSC_API' macro redefined [-Wmacro-redefined]
              ^
      /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/PCSC.framework/Headers/pcsclite.h:51:9: note:
            previous definition is here
              ^
      3afbec34
  5. 16 Jun, 2019 4 commits
  6. 05 Jun, 2019 2 commits
  7. 03 Jun, 2019 1 commit
  8. 30 May, 2019 1 commit
  9. 17 May, 2019 2 commits
  10. 25 Mar, 2019 1 commit
  11. 24 Mar, 2019 1 commit
  12. 22 Mar, 2019 2 commits
  13. 16 Jan, 2019 1 commit
    • Ludovic Rousseau's avatar
      Doc: more explicit documentation for −−auto−exit · e641eaa7
      Ludovic Rousseau authored
      pcscd does not exit after 60 seconds but after 60 seconds of inactivity
      after the release of the last PC/SC context.
      If you start pcscd with −−auto−exit but do run any PC/SC application
      then pcscd will NOT exit after 60 seconds.
      
      Thanks to Matthias Apitz for the bug report.
      e641eaa7
  14. 14 Jan, 2019 2 commits
    • vegaMato's avatar
      Remove usage of function chmod(2) to use fchmod(2) · 36c8eae8
      vegaMato authored
      Race condition possibility; CWE-362: Concurrent Execution using Shared
      Resource with Improper Synchronization ('Race Condition')
      
      Thanks to PA193 project
      https://github.com/vegaMato/PCSC-lite-project-tasks
      36c8eae8
    • St4lkerino's avatar
      Fix realloc(3) error handling · 43004384
      St4lkerino authored
      From realloc(3) manpage:
             The realloc() function returns a pointer to the newly allocated memory,
             which  is  suitably  aligned for any built-in type and may be different
             from ptr, or NULL if the request fails.  If size was equal to 0, either
             NULL  or  a  pointer  suitable  to be passed to free() is returned.  If
             realloc() fails, the original block is left untouched; it is not  freed
             or moved.
      
      If realloc() fails then the memory that was previously allocated needs
      to be freed, or it will create a memory leak.
      
      It was not a real problem because if realloc(3) failed then pcscd would
      exit immediatly and the memory would not leak for a long time.
      
      Thanks to PA193 project
      https://github.com/vegaMato/PCSC-lite-project-tasks
      43004384
  15. 03 Jan, 2019 1 commit
  16. 15 Dec, 2018 1 commit
  17. 12 Dec, 2018 1 commit
  18. 07 Dec, 2018 1 commit
  19. 26 Nov, 2018 1 commit
    • Ludovic Rousseau's avatar
      MSGRemoveContext: remove dead code · 53ab2bc8
      Ludovic Rousseau authored
      Issue found by Coverity:
      >>>     CID 1441490:  Code maintainability issues  (UNUSED_VALUE)
      >>>     Assigning value "2148532329L" to "rv" here, but that stored value is overwritten before it can be used.
      53ab2bc8
  20. 15 Nov, 2018 1 commit
  21. 12 Oct, 2018 5 commits
    • Ludovic Rousseau's avatar
      Release 1.8.23 · 73d95ada
      Ludovic Rousseau authored
      73d95ada
    • Ludovic Rousseau's avatar
      Fix compiler warning: output may be truncated · eaaf8eda
      Ludovic Rousseau authored
      winscard_msg.c: In function ‘ClientSetupSession’:
      winscard_msg.c:134:2: warning: ‘strncpy’ output may be truncated copying 108 bytes from a string of length 109 [-Wstringop-truncation]
        strncpy(svc_addr.sun_path, socketName, sizeof(svc_addr.sun_path));
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      The source was sizeof(struct sockaddr_un) bytes long.
      But the destination was sizeof(svc_addr.sun_path) bytes long only.
      
      svc_addr is a struct sockaddr_un but the sun_path field is shorter (1
      byte shorter according to the compiler) than the complete struct
      sockaddr_un.
      eaaf8eda
    • Ludovic Rousseau's avatar
      Fix compiler warning: cast between incompatible function · 2bef0948
      Ludovic Rousseau authored
      hotplug_libudev.c: In function ‘HPRegisterForHotplugEvents’:
      hotplug_libudev.c:769:3: warning: cast between incompatible function types from ‘void (*)(void *)’ to ‘void * (*)(void *)’ [-Wcast-function-type]
         (PCSCLITE_THREAD_FUNCTION( )) HPEstablishUSBNotifications, udev_monitor))
         ^
      2bef0948
    • Ludovic Rousseau's avatar
      Fix compiler warning: cast between incompatible function · 3c80087b
      Ludovic Rousseau authored
      eventhandler.c: In function ‘EHSpawnEventHandler’:
      eventhandler.c:234:3: warning: cast between incompatible function types from ‘void (*)(READER_CONTEXT *)’ {aka ‘void (*)(struct ReaderContext *)’} to ‘void * (*)(void *)’ [-Wcast-function-type]
         (PCSCLITE_THREAD_FUNCTION( ))EHStatusHandlerThread, (LPVOID) rContext);
         ^
      3c80087b
    • Ludovic Rousseau's avatar
      Fix compiler warning: cast between incompatible function · d6ba979b
      Ludovic Rousseau authored
      winscard_svc.c: In function ‘CreateContextThread’:
      winscard_svc.c:237:3: warning: cast between incompatible function types from ‘void (*)(void *)’ to ‘void * (*)(void *)’ [-Wcast-function-type]
         (PCSCLITE_THREAD_FUNCTION( )) ContextThread, (LPVOID) newContext);
         ^
      d6ba979b
  22. 09 Oct, 2018 1 commit
  23. 08 Oct, 2018 3 commits