New versions.

Did some hacks to break the circular dependency, so that the proper
dependency order is respected.
And I've also regenerated the distinfo files.

Still working fine with my OpenPGP SmartCard V2 and my O2Micro CCID
SC Reader (http://shop.kernelconcepts.de/images/opgpv2.jpg).

Please comment, I'd like to have this in for 5.2!

Ciao,
David

Index: Makefile
===================================================================
RCS file: /cvs/ports/security/pcsc-lite/Makefile,v
retrieving revision 1.10
diff -u -p -r1.10 Makefile
--- Makefile    20 Nov 2010 17:22:45 -0000      1.10
+++ Makefile    16 Jul 2012 10:13:30 -0000
@@ -1,45 +1,49 @@
 # $OpenBSD: Makefile,v 1.10 2010/11/20 17:22:45 espie Exp $
-# Uses pthreads
 
 COMMENT=       resource manager for PCSC
 
-DISTNAME=      pcsc-lite-1.0.1
-REVISION =     0
+DISTNAME=      pcsc-lite-1.8.4
 CATEGORIES=    security
-SHARED_LIBS=   pcsclite-core   0.2 \
-               pcsclite        0.1
-MODGNU_SHARED_LIBS=    pcsclite-core   '' \
-                       pcsclite        ''
-LIBpcsclite-core_ALIAS=        realpcsclite_core
 
-MASTER_SITES=  http://www.linuxnet.com/middleware/files/
+SHARED_LIBS+=  pcsclite        1.0 # 1.0.0
+SHARED_LIBS+=  pcscspy         0.0 # 0.0.0
 
-HOMEPAGE=      http://www.linuxnet.com/
+HOMEPAGE=      http://pcsclite.alioth.debian.org/pcsclite.html
 
+MASTER_SITES=  https://alioth.debian.org/frs/download.php/3734/
+
+EXTRACT_SUFX=  .tar.bz2
+
+MAINTAINER=    David Coppa <dco...@openbsd.org>
+
+# BSD and GPLv3+
 PERMIT_PACKAGE_CDROM=  Yes
 PERMIT_PACKAGE_FTP=    Yes
 PERMIT_DISTFILES_CDROM=        Yes
 PERMIT_DISTFILES_FTP=  Yes
-WANTLIB=               c pthread
 
-CONFIGURE_STYLE= gnu
-CONFIGURE_ARGS=        ${CONFIGURE_SHARED}     \
-               --enable-static         \
-               --enable-daemon         \
-               --enable-debug          \
-               --enable-syslog         \
-               --enable-threadsafe
-CONFIGURE_ENV= PTHREAD_LIBS=-pthread
-MODGNU_CONFIG_GUESS_DIRS=${WRKSRC}/build
+WANTLIB=               c pthread usb-1.0
+
+MODULES=               lang/python
+
+LIB_DEPENDS=           devel/libusb1
+
+RUN_DEPENDS=           security/ccid
+
+MODPY_ADJ_FILES=       src/spy/pcsc-spy
 
 USE_GMAKE=     Yes
 USE_LIBTOOL=   Yes
-NO_REGRESS=    Yes
 
-EXDIR=         ${PREFIX}/share/examples/pcscd
+CONFIGURE_STYLE= gnu
+
+CONFIGURE_ARGS= --disable-libudev \
+               --without-systemdsystemunitdir \
+               --enable-libusb \
+               --enable-confdir=${SYSCONFDIR}/ccid
+
+CONFIGURE_ENV= ac_cv_lib_lex='none needed'
 
-post-install:
-       ${INSTALL_DATA_DIR} ${EXDIR}
-       ${INSTALL_DATA} ${FILESDIR}/reader.conf.sample ${EXDIR}
+NO_REGRESS=    Yes
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/security/pcsc-lite/distinfo,v
retrieving revision 1.3
diff -u -p -r1.3 distinfo
--- distinfo    5 Apr 2007 17:26:09 -0000       1.3
+++ distinfo    16 Jul 2012 10:13:30 -0000
@@ -1,5 +1,2 @@
-MD5 (pcsc-lite-1.0.1.tar.gz) = UZ+Gtc3d17+5q2Mw3Ylmsw==
-RMD160 (pcsc-lite-1.0.1.tar.gz) = +gcgqKS4Y1h8VO5HNEIqRhIVbBE=
-SHA1 (pcsc-lite-1.0.1.tar.gz) = qYeJ7Kc0hziSMAXQ9MG6sOl2Dqw=
-SHA256 (pcsc-lite-1.0.1.tar.gz) = AiAh8aOOEiCSCRdIWgKahF6C3rWhs0ieB5gvSIfCbW0=
-SIZE (pcsc-lite-1.0.1.tar.gz) = 333975
+SHA256 (pcsc-lite-1.8.4.tar.bz2) = XvzVoqQxhoV19/zhwULYvBJPxlhc4Ueir7ndb1jaP6Y=
+SIZE (pcsc-lite-1.8.4.tar.bz2) = 550284
Index: files/reader.conf.sample
===================================================================
RCS file: files/reader.conf.sample
diff -N files/reader.conf.sample
--- files/reader.conf.sample    7 Dec 2001 06:33:19 -0000       1.1.1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,24 +0,0 @@
-# Configuration file for pcsc-lite
-# David Corcoran <corco...@linuxnet.com>
-#
-# In this file, you can have more than one
-# reader information.
-#
-# FRIENDLYNAME         Give any name to your reader
-# DEVICENAME           Give any name to your reader
-# LIBPATH              The path of your reader's driver
-# CHANNELID :
-#      0x0103F8        COM1
-#      0x0102F8        COM2
-#      0x0103E8        COM3
-#      0x0102E8        COM4
-#
-# $OpenBSD: reader.conf.sample,v 1.1.1.1 2001/12/07 06:33:19 shell Exp $
-
-FRIENDLYNAME     "Generic Reader"
-DEVICENAME       GEN_SMART_RDR
-LIBPATH          /usr/lib/readers/libgen_ifd.so
-CHANNELID        0x0103F8
-
-
-# End of file
Index: patches/patch-src-debuglog_c
===================================================================
RCS file: patches/patch-src-debuglog_c
diff -N patches/patch-src-debuglog_c
--- patches/patch-src-debuglog_c        25 Dec 2005 09:13:57 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,99 +0,0 @@
-$OpenBSD: patch-src-debuglog_c,v 1.2 2005/12/25 09:13:57 sturm Exp $
---- src/debuglog.c.orig        Wed Nov  7 23:54:30 2001
-+++ src/debuglog.c     Sun Dec 25 10:08:57 2005
-@@ -18,15 +18,17 @@
- #include <syslog.h>
- #include <stdio.h>
- 
-+#define DEBUG_BUFFER_LENGTH 150
-+
- static LONG lSuppress = DEBUGLOG_LOG_ENTRIES;
- 
- void DebugLogA( LPCSTR pcMessage, LPCSTR pcFile, LONG liLine ) {
- 
-   if ( lSuppress == DEBUGLOG_LOG_ENTRIES ) {
- #ifdef        USE_SYSLOG
--    syslog( LOG_DEBUG, "%15s %3d: %s", pcFile, (int)liLine, pcMessage );
-+    syslog( LOG_INFO, "%15s %3d: %s", pcFile, (int)liLine, pcMessage );
- #else
--    printf("%15s %3d: %s", pcFile, (int)liLine, pcMessage);
-+    printf("%15s %3d: %s\n", pcFile, (int)liLine, pcMessage);
- #endif
-   }
- 
-@@ -34,14 +36,16 @@ void DebugLogA( LPCSTR pcMessage, LPCSTR
- 
- void DebugLogB( LPCSTR pcFormat, LONG liValue, LPCSTR pcFile, LONG liLine ) {
- 
--  char pcBuffer[150];
-+  char pcBuffer[DEBUG_BUFFER_LENGTH];
- 
-   if ( lSuppress == DEBUGLOG_LOG_ENTRIES ) {
--    sprintf(pcBuffer, "%15s %3d: %s", pcFile, (int)liLine, pcFormat );
-+    snprintf(pcBuffer, sizeof(pcBuffer), "%15s %3d: %s", pcFile,
-+              (int)liLine, pcFormat );
- #ifdef        USE_SYSLOG
--    syslog( LOG_DEBUG, pcBuffer, liValue );
-+    syslog( LOG_INFO, pcBuffer, liValue );
- #else
-     printf(pcBuffer, liValue);
-+      putchar('\n');
- #endif
-   }
- 
-@@ -50,14 +54,16 @@ void DebugLogB( LPCSTR pcFormat, LONG li
- void DebugLogC( LPCSTR pcFormat, LPCSTR pcMessage, LPCSTR pcFile, 
-               LONG liLine ) {
- 
--  char pcBuffer[150];
-+  char pcBuffer[DEBUG_BUFFER_LENGTH];
- 
-   if ( lSuppress == DEBUGLOG_LOG_ENTRIES ) {
--    sprintf(pcBuffer, "%15s %3d: %s", pcFile, (int)liLine, pcFormat );
-+    snprintf(pcBuffer,  sizeof(pcBuffer), "%15s %3d: %s", pcFile,
-+              (int)liLine, pcFormat );
- #ifdef  USE_SYSLOG
--    syslog( LOG_DEBUG, pcBuffer, pcMessage );
-+    syslog( LOG_INFO, pcBuffer, pcMessage );
- #else
-     printf(pcBuffer, pcMessage);
-+      putchar('\n');
- #endif
-   }
- 
-@@ -67,28 +73,26 @@ void DebugLogD( LPCSTR pcFormat, PUCHAR 
-               LPCSTR pcFile, LONG liLine ) {
- 
-   int i;
--  char pcBuffer[150];
-+  char pcBuffer[DEBUG_BUFFER_LENGTH];
-   char *tmpBuffer;
--  /* tmpBuffer = (char *)malloc( ( 4+liLength ) * sizeof( PUCHAR ) ); */
- 
-   if ( lSuppress == DEBUGLOG_LOG_ENTRIES ) {
--    sprintf(pcBuffer, "%15s %3d: %s", pcFile, (int)liLine, pcFormat );
-+    snprintf(pcBuffer,  sizeof(pcBuffer), "%15s %3d: %s", pcFile,
-+              (int)liLine, pcFormat );
- #ifdef  USE_SYSLOG
-     tmpBuffer = (char *)malloc( liLength*3 + 1); 
--    syslog( LOG_DEBUG, pcBuffer, pcFormat );
-+    syslog( LOG_INFO, pcBuffer, pcFormat );
-     for (i=0; i < liLength; i++) {
--      /* sprintf( tmpBuffer, "%x ", pucData[i] ); */
-       sprintf( tmpBuffer + i*3, "%02X ", pucData[i] );
- 
-     } 
--    /*    sprintf( tmpBuffer, "\n" ); */
--    syslog( LOG_DEBUG, tmpBuffer );
-+    syslog( LOG_INFO, tmpBuffer );
-     free( tmpBuffer );
- #else
-     printf(pcBuffer, pcFormat);
-     for (i=0; i < liLength; i++) {
--      printf("%x ", pucData[i]);
--    } printf("\n");
-+      printf("%02X ", pucData[i]);
-+    } putchar('\n');
- #endif
-   }
- 
Index: patches/patch-src-pcscdaemon_c
===================================================================
RCS file: patches/patch-src-pcscdaemon_c
diff -N patches/patch-src-pcscdaemon_c
--- patches/patch-src-pcscdaemon_c      2 Jan 2004 22:53:09 -0000       1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,190 +0,0 @@
-$OpenBSD: patch-src-pcscdaemon_c,v 1.2 2004/01/02 22:53:09 espie Exp $
---- src/pcscdaemon.c.orig      2001-11-07 23:54:30.000000000 +0100
-+++ src/pcscdaemon.c   2004-01-02 23:47:08.000000000 +0100
-@@ -26,9 +26,17 @@
- #include <stdio.h>
- #include <unistd.h>
- 
-+#ifdef USE_DAEMON
-+#ifndef USE_SYSLOG
-+#error You must use '--enable-syslog' when also using '--enable-daemon' or 
you will not get any message
-+#endif
-+#endif
-+
- /* Some internal functions */
- void SVCServiceRunLoop();
- void SVCClientCleanup( psharedSegmentMsg );
-+void at_exit(void);
-+void at_exit_signal(int);
- 
- extern int errno;
- 
-@@ -55,9 +63,9 @@ void SVCServiceRunLoop() {
-   rsp = SHMInitializeCommonSegment();
- 
-   if ( rsp == -1 ) {
--    DebugLogA("SVCServiceRunLoop: Error initializing pcscd.\n",
-+    DebugLogA("SVCServiceRunLoop: Error initializing pcscd.",
-             __FILE__, __LINE__);
--    SYS_Exit(-1);
-+    exit(-1);
-   }
- 
-   /* Solaris sends a SIGALRM and it is annoying */
-@@ -82,8 +90,7 @@ void SVCServiceRunLoop() {
-       MSGCleanupClient( &msgStruct ); 
-       SYS_MutexUnLock(&usbNotifierMutex);
-       snprintf(errMessage, sizeof(errMessage), "%s%d%s",
--               "SVCServiceRun: Client ", msgStruct.request_id,
--               " has disappeared.\n" );
-+               "SVCServiceRun: Client ", msgStruct.request_id, " has 
disappeared." );
- #ifdef PCSC_DEBUG
-       DebugLogA(errMessage, __FILE__, __LINE__);
- #endif
-@@ -108,8 +115,7 @@ void SVCServiceRunLoop() {
- 
-     case -1:
- #ifdef PCSC_DEBUG
--      DebugLogA("SVCServiceRun: Error in ProcessEvents.\n", 
--                __FILE__, __LINE__);
-+      DebugLogA("SVCServiceRun: Error in ProcessEvents.", __FILE__, __LINE__);
- #endif
-       break;
- 
-@@ -137,8 +143,7 @@ int main(int argc, char **argv) {
-     printf("pcscd -help    - This help menu\n");
-     return 0;
-   } else if ( argc == 3 && (strcmp(argv[1], "-c") == 0) ) {
--    DebugLogC("main: Using new config file: %s\n", argv[2],
--            __FILE__, __LINE__);
-+    DebugLogC("main: Using new config file: %s", argv[2], __FILE__, __LINE__);
-     newReaderConfig = argv[2];
-   } else if ( argc == 1 ) {
-     /* All OK Here */
-@@ -150,7 +155,7 @@ int main(int argc, char **argv) {
- #ifdef USE_DAEMON
-   /* standard daemonizing actions */
- #ifndef HAVE_DAEMON
--  switch (fork()) {
-+  switch (SYS_Fork()) {
-     case -1:
-       return (-1);
-     case 0:
-@@ -167,22 +172,47 @@ int main(int argc, char **argv) {
- #endif
- #endif
- 
--  /* Create the /tmp/pcsc directory and chmod it */
--  rv = SYS_Mkdir("/tmp/pcsc", S_ISVTX | S_IRWXO | S_IRWXG | S_IRWXU );
-+  /* test the presence of /tmp/pcsc */
-+  {
-+      struct stat buf;
-+
-+    rv = SYS_Stat(PCSCLITE_IPC_DIR, &buf);
-+      if (rv == 0)
-+      {
- #ifdef PCSC_DEBUG
-+      DebugLogA("main: directory " PCSCLITE_IPC_DIR " already exists",
-+                      __FILE__, __LINE__);
-+              return 1;
-+#endif
-+      }
-+
-+  }
-+
-+  /* cleanly remove /tmp/pcsc when exiting */
-+  atexit(at_exit);
-+  signal(SIGQUIT, at_exit_signal);
-+  signal(SIGTERM, at_exit_signal);
-+  signal(SIGINT, at_exit_signal);
-+  signal(SIGHUP, at_exit_signal);
-+
-+  /* Create the /tmp/pcsc directory and chmod it */
-+  rv = SYS_Mkdir(PCSCLITE_IPC_DIR, S_ISVTX | S_IRWXO | S_IRWXG | S_IRWXU );
-   if ( rv != 0 ) {
--    DebugLogC("main: Cannot create /tmp/pcsc: %s\n", strerror(errno),
-+#ifdef PCSC_DEBUG
-+    DebugLogC("main: Cannot create " PCSCLITE_IPC_DIR ": %s", strerror(errno),
-             __FILE__, __LINE__);
--  }
- #endif
-+      return 1;
-+  }
- 
--  rv = SYS_Chmod("/tmp/pcsc", S_ISVTX | S_IRWXO | S_IRWXG | S_IRWXU );
--#ifdef PCSC_DEBUG
-+  rv = SYS_Chmod(PCSCLITE_IPC_DIR, S_ISVTX | S_IRWXO | S_IRWXG | S_IRWXU );
-   if ( rv != 0 ) {
--    DebugLogC("main: Cannot chmod /tmp/pcsc: %s\n", strerror(errno),
-+#ifdef PCSC_DEBUG
-+    DebugLogC("main: Cannot chmod " PCSCLITE_IPC_DIR ": %s", strerror(errno),
-             __FILE__, __LINE__);
--  }
- #endif
-+      return 1;
-+  }
- 
-   /* Allocate memory for reader structures     */
-   RFAllocateReaderSpace( PCSCLITE_MAX_CONTEXTS );
-@@ -199,13 +229,58 @@ int main(int argc, char **argv) {
-   g_rgSCardT1Pci.dwProtocol  = SCARD_PROTOCOL_T1;  
-   g_rgSCardRawPci.dwProtocol = SCARD_PROTOCOL_RAW;
-   
--  DebugLogA("main: PC/SC Lite Daemon Ready.\n", __FILE__, __LINE__);
-+  DebugLogA("main: PC/SC Lite Daemon Ready.", __FILE__, __LINE__);
-   
-   SVCServiceRunLoop();
-+
- #ifdef USE_SYSLOG
--  syslog( LOG_ERR, "pcscdaemon.c: main: SVCServiceRunLoop returned\n" );
-+  syslog( LOG_ERR, "pcscdaemon.c: main: SVCServiceRunLoop returned" );
- #else
--  fprintf(stderr, "pcscdaemon.c: main: SVCServiceRunLoop returned\n");
-+  fprintf(stderr, "pcscdaemon.c: main: SVCServiceRunLoop returned");
- #endif
-   return 1;
- }
-+
-+void at_exit(void)
-+{
-+      int rv;
-+
-+      DebugLogA("at_exit: cleaning " PCSCLITE_IPC_DIR, __FILE__, __LINE__);
-+
-+      rv = SYS_Unlink(PCSCLITE_SHM_FILE);
-+#ifdef PCSC_DEBUG
-+      if ( rv != 0 )
-+      DebugLogC("main: Cannot unlink " PCSCLITE_SHM_FILE ": %s",
-+                      strerror(errno), __FILE__, __LINE__);
-+#endif
-+
-+      rv = SYS_Unlink(PCSCLITE_PUBSHM_FILE);
-+#ifdef PCSC_DEBUG
-+      if ( rv != 0 )
-+      DebugLogC("main: Cannot unlink " PCSCLITE_PUBSHM_FILE ": %s",
-+                      strerror(errno), __FILE__, __LINE__);
-+#endif
-+
-+      rv = SYS_Unlink(PCSCLITE_CSOCK_NAME);
-+#ifdef PCSC_DEBUG
-+      if ( rv != 0 )
-+      DebugLogC("main: Cannot unlink " PCSCLITE_CSOCK_NAME ": %s",
-+                      strerror(errno), __FILE__, __LINE__);
-+#endif
-+
-+      rv = SYS_Rmdir(PCSCLITE_IPC_DIR);
-+#ifdef PCSC_DEBUG
-+      if ( rv != 0 )
-+      DebugLogC("main: Cannot rmdir " PCSCLITE_IPC_DIR ": %s",
-+                      strerror(errno), __FILE__, __LINE__);
-+#endif
-+
-+      SYS_Exit(1);
-+}
-+
-+void at_exit_signal(int sig)
-+{
-+      /* will call at_exit() */
-+      exit(0);
-+}
-+
Index: patches/patch-src-pcsclite_h
===================================================================
RCS file: patches/patch-src-pcsclite_h
diff -N patches/patch-src-pcsclite_h
--- patches/patch-src-pcsclite_h        25 Dec 2005 09:13:57 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,22 +0,0 @@
-$OpenBSD: patch-src-pcsclite_h,v 1.4 2005/12/25 09:13:57 sturm Exp $
---- src/pcsclite.h.orig        Wed Nov  7 23:54:30 2001
-+++ src/pcsclite.h     Sun Dec 25 10:08:58 2005
-@@ -143,11 +143,13 @@ char * pcsc_stringify_error( long );
- #define BLOCK_STATUS_RESUME             0x00FF  /* Normal resume        */
- #define BLOCK_STATUS_BLOCKING           0x00FA  /* Function is blocking */
- 
--#define PCSCLITE_READER_CONFIG                "/etc/reader.conf"
--#define PCSCLITE_CARD_CONFIG          "/etc/card.conf"
--#define PCSCLITE_SHM_FILE               "/tmp/pcsc/.pcsctmp"
--#define PCSCLITE_PUBSHM_FILE            "/tmp/pcsc/.pcscpub"
--#define PCSCLITE_CSOCK_NAME             "/tmp/pcsc/.pcscomm"
-+#define PCSCLITE_CONFIG_DIR           "/etc/pcscd"
-+#define PCSCLITE_READER_CONFIG                PCSCLITE_CONFIG_DIR 
"/reader.conf"
-+#define PCSCLITE_CARD_CONFIG          PCSCLITE_CONFIG_DIR "/card.conf"
-+#define PCSCLITE_IPC_DIR              "/var/run/pcsc"
-+#define PCSCLITE_SHM_FILE               PCSCLITE_IPC_DIR "/.pcsctmp"
-+#define PCSCLITE_PUBSHM_FILE            PCSCLITE_IPC_DIR "/.pcscpub"
-+#define PCSCLITE_CSOCK_NAME             PCSCLITE_IPC_DIR "/.pcscomm"
- 
- #define PCSCLITE_SVC_IDENTITY      0x01030000 /* Service ID           */
- 
Index: patches/patch-src-sys_generic_h
===================================================================
RCS file: patches/patch-src-sys_generic_h
diff -N patches/patch-src-sys_generic_h
--- patches/patch-src-sys_generic_h     25 Dec 2005 09:13:57 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,33 +0,0 @@
-$OpenBSD: patch-src-sys_generic_h,v 1.2 2005/12/25 09:13:57 sturm Exp $
---- src/sys_generic.h.orig     Wed Nov  7 23:54:32 2001
-+++ src/sys_generic.h  Sun Dec 25 10:08:58 2005
-@@ -19,6 +19,8 @@
- extern "C" {
- #endif     
- 
-+#include <sys/stat.h>
-+
-   int SYS_Initialize();
- 
-   int SYS_Mkdir( char*, int );
-@@ -73,13 +75,19 @@ extern "C" {
-   
-   int SYS_Wait( int, int );
-   
--  int SYS_Stat( int );
-+  int SYS_Stat( char *pcFile, struct stat *psStatus );
-+
-+  int SYS_Fstat( int );
-   
-   int SYS_Random( int, float, float );
- 
-   int SYS_GetSeed();
- 
-   int SYS_Exit( int );
-+
-+  int SYS_Rmdir( char *pcFile );
-+
-+  int SYS_Unlink( char *pcFile );
- 
- #ifdef __cplusplus
- }
Index: patches/patch-src-sys_unix_c
===================================================================
RCS file: patches/patch-src-sys_unix_c
diff -N patches/patch-src-sys_unix_c
--- patches/patch-src-sys_unix_c        25 Dec 2005 09:13:57 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,41 +0,0 @@
-$OpenBSD: patch-src-sys_unix_c,v 1.2 2005/12/25 09:13:57 sturm Exp $
---- src/sys_unix.c.orig        Wed Nov  7 23:54:32 2001
-+++ src/sys_unix.c     Sun Dec 25 10:08:58 2005
-@@ -128,7 +128,7 @@ void *SYS_MemoryMap( int iSize, int iFid
-   /* Here are some common error types:
-   switch( errno ) {
-   case EINVAL:
--    printf("EINVAL\n");
-+    printf("EINVAL");
-   case EBADF:
-     printf("EBADF");
-     break;
-@@ -169,7 +169,11 @@ int SYS_Wait( int iPid, int iWait ) {
-  return waitpid( -1, 0, WNOHANG );
- }
- 
--int SYS_Stat( int iFd ) {
-+int SYS_Stat( char *pcFile, struct stat *psStatus ) {
-+  return stat( pcFile, psStatus );
-+}
-+
-+int SYS_Fstat( int iFd ) {
-   struct stat sStatus;
-   return fstat( iFd, &sStatus );
- }
-@@ -205,5 +209,15 @@ int SYS_GetSeed() {
- 
- int SYS_Exit( int iRetVal ) {
-   _exit( iRetVal );
-+}
-+
-+int SYS_Rmdir( char *pcFile )
-+{
-+      return rmdir(pcFile);
-+}
-+
-+int SYS_Unlink( char *pcFile )
-+{
-+      return unlink(pcFile);
- }
- 
Index: patches/patch-src-utils-installifs_c
===================================================================
RCS file: patches/patch-src-utils-installifs_c
diff -N patches/patch-src-utils-installifs_c
--- patches/patch-src-utils-installifs_c        25 Dec 2005 09:13:57 -0000      
1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
-$OpenBSD: patch-src-utils-installifs_c,v 1.2 2005/12/25 09:13:57 sturm Exp $
---- src/utils/installifd.c.orig        Wed Nov  7 23:54:32 2001
-+++ src/utils/installifd.c     Sun Dec 25 10:08:58 2005
-@@ -107,12 +107,12 @@ int main(int argc, char **argv) {
- 
- 
-   printf("\n\n");
--  printf("Now creating new /etc/reader.conf: \n");
-+  printf("Now creating new /etc/pcscd/reader.conf: \n");
- 
--  fd = fopen("/etc/reader.conf", "w" );
-+  fd = fopen("/etc/pcscd/reader.conf", "w" );
- 
-   if ( fd == 0 ) {
--    printf("Cannot open file /etc/reader.conf (are you root ?)\n");
-+    printf("Cannot open file /etc/pcscd/reader.conf (are you root ?)\n");
-     free(lpcPortID);
-     return 1;
-   }
Index: patches/patch-src_Makefile_in
===================================================================
RCS file: patches/patch-src_Makefile_in
diff -N patches/patch-src_Makefile_in
--- patches/patch-src_Makefile_in       25 Dec 2005 11:15:34 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,13 +0,0 @@
-$OpenBSD: patch-src_Makefile_in,v 1.1 2005/12/25 11:15:34 sturm Exp $
---- src/Makefile.in.orig       Sun Dec 25 11:33:49 2005
-+++ src/Makefile.in    Sun Dec 25 11:34:06 2005
-@@ -121,7 +121,8 @@ TESTS = testpcsc
- libpcsclite_core_la_SOURCES = configfile.l bundleparser.l     winscard.c 
eventhandler.c ifdwrapper.c atrhandler.c prothandler.c       readerfactory.c 
winscard_msg.c debuglog.c $(PCSC_SYSTEM_SOURCE)         $(PCSC_THREAD_SOURCE) 
$(PCSC_HOTPLUG_SOURCE) $(PCSC_DYNLOAD_SOURCE)
- 
- 
--libpcsclite_core_la_LDFLAGS = -version-info 0:2:0 $(PCSC_INCLUDE_LIBS)
-+libpcsclite_core_la_LDFLAGS = ${librealpcsclite_core_la_LDFLAGS} \
-+      $(PCSC_INCLUDE_LIBS)
- 
- libpcsclite_la_SOURCES = winscard_clnt.c debuglog.c $(PCSC_SYSTEM_SOURCE)     
                 winscard_msg.c $(PCSC_CLIENT)
- 
Index: patches/patch-src_spy_Makefile_in
===================================================================
RCS file: patches/patch-src_spy_Makefile_in
diff -N patches/patch-src_spy_Makefile_in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_spy_Makefile_in   16 Jul 2012 10:13:30 -0000
@@ -0,0 +1,20 @@
+$OpenBSD$
+--- src/spy/Makefile.in.orig   Mon Jul  9 13:33:21 2012
++++ src/spy/Makefile.in        Mon Jul  9 13:33:58 2012
+@@ -293,7 +293,6 @@ dist_bin_SCRIPTS = pcsc-spy
+ libpcscspy_la_SOURCES = \
+       libpcscspy.c
+ 
+-libpcscspy_la_LIBADD = -ldl
+ man_MANS = pcsc-spy.1
+ EXTRA_DIST = install_spy.sh uninstall_spy.sh pcsc-spy.pod
+ CLEANFILES = pcsc-spy.1
+@@ -364,7 +363,7 @@ clean-libLTLIBRARIES:
+         rm -f "$${dir}/so_locations"; \
+       done
+ libpcscspy.la: $(libpcscspy_la_OBJECTS) $(libpcscspy_la_DEPENDENCIES) 
$(EXTRA_libpcscspy_la_DEPENDENCIES) 
+-      $(AM_V_CCLD)$(LINK) -rpath $(libdir) $(libpcscspy_la_OBJECTS) 
$(libpcscspy_la_LIBADD) $(LIBS)
++      $(AM_V_CCLD)$(LINK) -rpath $(libdir) $(libpcscspy_la_OBJECTS) $(LIBS)
+ install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
+       @$(NORMAL_INSTALL)
+       @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
Index: patches/patch-src_spy_libpcscspy_c
===================================================================
RCS file: patches/patch-src_spy_libpcscspy_c
diff -N patches/patch-src_spy_libpcscspy_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_spy_libpcscspy_c  16 Jul 2012 10:13:30 -0000
@@ -0,0 +1,29 @@
+$OpenBSD$
+--- src/spy/libpcscspy.c.orig  Mon Jul  9 16:54:38 2012
++++ src/spy/libpcscspy.c       Mon Jul  9 16:56:12 2012
+@@ -28,6 +28,7 @@
+ #include <unistd.h>
+ #include <sys/time.h>
+ #include <pthread.h>
++#include <inttypes.h>
+ 
+ #include "misc.h"
+ #include <winscard.h>
+@@ -168,7 +169,7 @@ static void spy_line_direct(char *line)
+       if (Log_fd < 0)
+               return;
+ 
+-      snprintf(threadid, sizeof threadid, "%lX@", pthread_self());
++      snprintf(threadid, sizeof threadid, "%" PRIXPTR "@", 
(uintptr_t)pthread_self());
+       pthread_mutex_lock(&Log_fd_mutex);
+       write(Log_fd, threadid, strlen(threadid));
+       write(Log_fd, line, strlen(line));
+@@ -194,7 +195,7 @@ static void spy_line(const char *fmt, ...)
+               printf("libpcsc-spy: Buffer is too small!\n");
+               return;
+       }
+-      snprintf(threadid, sizeof threadid, "%lX@", pthread_self());
++      snprintf(threadid, sizeof threadid, "%" PRIXPTR "@", 
(uintptr_t)pthread_self());
+       pthread_mutex_lock(&Log_fd_mutex);
+       write(Log_fd, threadid, strlen(threadid));
+       write(Log_fd, line, size);
Index: pkg/DESCR
===================================================================
RCS file: /cvs/ports/security/pcsc-lite/pkg/DESCR,v
retrieving revision 1.2
diff -u -p -r1.2 DESCR
--- pkg/DESCR   15 Dec 2003 21:55:22 -0000      1.2
+++ pkg/DESCR   16 Jul 2012 10:13:30 -0000
@@ -1,4 +1,4 @@
-PC/SC Architecture for most Unix type operating systems.  Allows
-easy porting of Windows smartcard software to other operating
-systems.  Supports many types of serial, PCMCIA, and USB smartcard
-readers and cryptographic tokens.
+PC/SC Architecture for most Unix type operating systems.
+It allows easy porting of Windows smartcard software to other
+operating systems. It supports many types of serial, PCMCIA, and
+USB smartcard readers and cryptographic tokens.
Index: pkg/PFRAG.shared
===================================================================
RCS file: /cvs/ports/security/pcsc-lite/pkg/PFRAG.shared,v
retrieving revision 1.3
diff -u -p -r1.3 PFRAG.shared
--- pkg/PFRAG.shared    25 Dec 2005 11:15:34 -0000      1.3
+++ pkg/PFRAG.shared    16 Jul 2012 10:13:30 -0000
@@ -1,3 +1,3 @@
 @comment $OpenBSD: PFRAG.shared,v 1.3 2005/12/25 11:15:34 sturm Exp $
-@lib lib/libpcsclite-core.so.${LIBpcsclite-core_VERSION}
 @lib lib/libpcsclite.so.${LIBpcsclite_VERSION}
+@lib lib/libpcscspy.so.${LIBpcscspy_VERSION}
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/security/pcsc-lite/pkg/PLIST,v
retrieving revision 1.3
diff -u -p -r1.3 PLIST
--- pkg/PLIST   4 Oct 2004 19:56:28 -0000       1.3
+++ pkg/PLIST   16 Jul 2012 10:13:30 -0000
@@ -1,30 +1,22 @@
 @comment $OpenBSD: PLIST,v 1.3 2004/10/04 19:56:28 xsa Exp $
-include/atrhandler.h
-include/configfile.h
-include/debuglog.h
-include/dyn_generic.h
-include/eventhandler.h
-include/hotplug.h
-include/ifdhandler.h
-include/ifdwrapper.h
-include/pcsclite.h
-include/prothandler.h
-include/readerfactory.h
-include/sys_generic.h
-include/thread_generic.h
-include/winscard.h
-include/winscard_msg.h
-include/winscard_svc.h
-include/wintypes.h
-lib/libpcsclite-core.a
-lib/libpcsclite-core.la
+%%SHARED%%
+bin/pcsc-spy
+include/PCSC/
+include/PCSC/debuglog.h
+include/PCSC/ifdhandler.h
+include/PCSC/pcsclite.h
+include/PCSC/reader.h
+include/PCSC/winscard.h
+include/PCSC/wintypes.h
 lib/libpcsclite.a
 lib/libpcsclite.la
-sbin/pcscd
-share/examples/pcscd/
-share/examples/pcscd/reader.conf.sample
-@mode 711
-@sample ${SYSCONFDIR}/pcscd/
-@mode
-@sample ${SYSCONFDIR}/pcscd/reader.conf
-%%SHARED%%
+lib/libpcscspy.a
+lib/libpcscspy.la
+lib/pkgconfig/libpcsclite.pc
+@man man/man1/pcsc-spy.1
+@man man/man5/reader.conf.5
+@man man/man8/pcscd.8
+@bin sbin/pcscd
+@comment share/doc/pcsc-lite/
+@comment share/doc/pcsc-lite/README.DAEMON
+@rcscript ${RCDIR}/pcscd
Index: pkg/pcscd.rc
===================================================================
RCS file: pkg/pcscd.rc
diff -N pkg/pcscd.rc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ pkg/pcscd.rc        16 Jul 2012 10:13:30 -0000
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD$
+
+daemon="${TRUEPREFIX}/sbin/pcscd"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_cmd $1

Attachment: ccid_v2.tgz
Description: application/tar-gz

Index: Makefile
===================================================================
RCS file: /cvs/ports/security/pcsc-lite/Makefile,v
retrieving revision 1.10
diff -u -p -r1.10 Makefile
--- Makefile    20 Nov 2010 17:22:45 -0000      1.10
+++ Makefile    16 Jul 2012 10:13:30 -0000
@@ -1,45 +1,49 @@
 # $OpenBSD: Makefile,v 1.10 2010/11/20 17:22:45 espie Exp $
-# Uses pthreads
 
 COMMENT=       resource manager for PCSC
 
-DISTNAME=      pcsc-lite-1.0.1
-REVISION =     0
+DISTNAME=      pcsc-lite-1.8.4
 CATEGORIES=    security
-SHARED_LIBS=   pcsclite-core   0.2 \
-               pcsclite        0.1
-MODGNU_SHARED_LIBS=    pcsclite-core   '' \
-                       pcsclite        ''
-LIBpcsclite-core_ALIAS=        realpcsclite_core
 
-MASTER_SITES=  http://www.linuxnet.com/middleware/files/
+SHARED_LIBS+=  pcsclite        1.0 # 1.0.0
+SHARED_LIBS+=  pcscspy         0.0 # 0.0.0
 
-HOMEPAGE=      http://www.linuxnet.com/
+HOMEPAGE=      http://pcsclite.alioth.debian.org/pcsclite.html
 
+MASTER_SITES=  https://alioth.debian.org/frs/download.php/3734/
+
+EXTRACT_SUFX=  .tar.bz2
+
+MAINTAINER=    David Coppa <dco...@openbsd.org>
+
+# BSD and GPLv3+
 PERMIT_PACKAGE_CDROM=  Yes
 PERMIT_PACKAGE_FTP=    Yes
 PERMIT_DISTFILES_CDROM=        Yes
 PERMIT_DISTFILES_FTP=  Yes
-WANTLIB=               c pthread
 
-CONFIGURE_STYLE= gnu
-CONFIGURE_ARGS=        ${CONFIGURE_SHARED}     \
-               --enable-static         \
-               --enable-daemon         \
-               --enable-debug          \
-               --enable-syslog         \
-               --enable-threadsafe
-CONFIGURE_ENV= PTHREAD_LIBS=-pthread
-MODGNU_CONFIG_GUESS_DIRS=${WRKSRC}/build
+WANTLIB=               c pthread usb-1.0
+
+MODULES=               lang/python
+
+LIB_DEPENDS=           devel/libusb1
+
+RUN_DEPENDS=           security/ccid
+
+MODPY_ADJ_FILES=       src/spy/pcsc-spy
 
 USE_GMAKE=     Yes
 USE_LIBTOOL=   Yes
-NO_REGRESS=    Yes
 
-EXDIR=         ${PREFIX}/share/examples/pcscd
+CONFIGURE_STYLE= gnu
+
+CONFIGURE_ARGS= --disable-libudev \
+               --without-systemdsystemunitdir \
+               --enable-libusb \
+               --enable-confdir=${SYSCONFDIR}/ccid
+
+CONFIGURE_ENV= ac_cv_lib_lex='none needed'
 
-post-install:
-       ${INSTALL_DATA_DIR} ${EXDIR}
-       ${INSTALL_DATA} ${FILESDIR}/reader.conf.sample ${EXDIR}
+NO_REGRESS=    Yes
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/security/pcsc-lite/distinfo,v
retrieving revision 1.3
diff -u -p -r1.3 distinfo
--- distinfo    5 Apr 2007 17:26:09 -0000       1.3
+++ distinfo    16 Jul 2012 10:13:30 -0000
@@ -1,5 +1,2 @@
-MD5 (pcsc-lite-1.0.1.tar.gz) = UZ+Gtc3d17+5q2Mw3Ylmsw==
-RMD160 (pcsc-lite-1.0.1.tar.gz) = +gcgqKS4Y1h8VO5HNEIqRhIVbBE=
-SHA1 (pcsc-lite-1.0.1.tar.gz) = qYeJ7Kc0hziSMAXQ9MG6sOl2Dqw=
-SHA256 (pcsc-lite-1.0.1.tar.gz) = AiAh8aOOEiCSCRdIWgKahF6C3rWhs0ieB5gvSIfCbW0=
-SIZE (pcsc-lite-1.0.1.tar.gz) = 333975
+SHA256 (pcsc-lite-1.8.4.tar.bz2) = XvzVoqQxhoV19/zhwULYvBJPxlhc4Ueir7ndb1jaP6Y=
+SIZE (pcsc-lite-1.8.4.tar.bz2) = 550284
Index: files/reader.conf.sample
===================================================================
RCS file: files/reader.conf.sample
diff -N files/reader.conf.sample
--- files/reader.conf.sample    7 Dec 2001 06:33:19 -0000       1.1.1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,24 +0,0 @@
-# Configuration file for pcsc-lite
-# David Corcoran <corco...@linuxnet.com>
-#
-# In this file, you can have more than one
-# reader information.
-#
-# FRIENDLYNAME         Give any name to your reader
-# DEVICENAME           Give any name to your reader
-# LIBPATH              The path of your reader's driver
-# CHANNELID :
-#      0x0103F8        COM1
-#      0x0102F8        COM2
-#      0x0103E8        COM3
-#      0x0102E8        COM4
-#
-# $OpenBSD: reader.conf.sample,v 1.1.1.1 2001/12/07 06:33:19 shell Exp $
-
-FRIENDLYNAME     "Generic Reader"
-DEVICENAME       GEN_SMART_RDR
-LIBPATH          /usr/lib/readers/libgen_ifd.so
-CHANNELID        0x0103F8
-
-
-# End of file
Index: patches/patch-src-debuglog_c
===================================================================
RCS file: patches/patch-src-debuglog_c
diff -N patches/patch-src-debuglog_c
--- patches/patch-src-debuglog_c        25 Dec 2005 09:13:57 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,99 +0,0 @@
-$OpenBSD: patch-src-debuglog_c,v 1.2 2005/12/25 09:13:57 sturm Exp $
---- src/debuglog.c.orig        Wed Nov  7 23:54:30 2001
-+++ src/debuglog.c     Sun Dec 25 10:08:57 2005
-@@ -18,15 +18,17 @@
- #include <syslog.h>
- #include <stdio.h>
- 
-+#define DEBUG_BUFFER_LENGTH 150
-+
- static LONG lSuppress = DEBUGLOG_LOG_ENTRIES;
- 
- void DebugLogA( LPCSTR pcMessage, LPCSTR pcFile, LONG liLine ) {
- 
-   if ( lSuppress == DEBUGLOG_LOG_ENTRIES ) {
- #ifdef        USE_SYSLOG
--    syslog( LOG_DEBUG, "%15s %3d: %s", pcFile, (int)liLine, pcMessage );
-+    syslog( LOG_INFO, "%15s %3d: %s", pcFile, (int)liLine, pcMessage );
- #else
--    printf("%15s %3d: %s", pcFile, (int)liLine, pcMessage);
-+    printf("%15s %3d: %s\n", pcFile, (int)liLine, pcMessage);
- #endif
-   }
- 
-@@ -34,14 +36,16 @@ void DebugLogA( LPCSTR pcMessage, LPCSTR
- 
- void DebugLogB( LPCSTR pcFormat, LONG liValue, LPCSTR pcFile, LONG liLine ) {
- 
--  char pcBuffer[150];
-+  char pcBuffer[DEBUG_BUFFER_LENGTH];
- 
-   if ( lSuppress == DEBUGLOG_LOG_ENTRIES ) {
--    sprintf(pcBuffer, "%15s %3d: %s", pcFile, (int)liLine, pcFormat );
-+    snprintf(pcBuffer, sizeof(pcBuffer), "%15s %3d: %s", pcFile,
-+              (int)liLine, pcFormat );
- #ifdef        USE_SYSLOG
--    syslog( LOG_DEBUG, pcBuffer, liValue );
-+    syslog( LOG_INFO, pcBuffer, liValue );
- #else
-     printf(pcBuffer, liValue);
-+      putchar('\n');
- #endif
-   }
- 
-@@ -50,14 +54,16 @@ void DebugLogB( LPCSTR pcFormat, LONG li
- void DebugLogC( LPCSTR pcFormat, LPCSTR pcMessage, LPCSTR pcFile, 
-               LONG liLine ) {
- 
--  char pcBuffer[150];
-+  char pcBuffer[DEBUG_BUFFER_LENGTH];
- 
-   if ( lSuppress == DEBUGLOG_LOG_ENTRIES ) {
--    sprintf(pcBuffer, "%15s %3d: %s", pcFile, (int)liLine, pcFormat );
-+    snprintf(pcBuffer,  sizeof(pcBuffer), "%15s %3d: %s", pcFile,
-+              (int)liLine, pcFormat );
- #ifdef  USE_SYSLOG
--    syslog( LOG_DEBUG, pcBuffer, pcMessage );
-+    syslog( LOG_INFO, pcBuffer, pcMessage );
- #else
-     printf(pcBuffer, pcMessage);
-+      putchar('\n');
- #endif
-   }
- 
-@@ -67,28 +73,26 @@ void DebugLogD( LPCSTR pcFormat, PUCHAR 
-               LPCSTR pcFile, LONG liLine ) {
- 
-   int i;
--  char pcBuffer[150];
-+  char pcBuffer[DEBUG_BUFFER_LENGTH];
-   char *tmpBuffer;
--  /* tmpBuffer = (char *)malloc( ( 4+liLength ) * sizeof( PUCHAR ) ); */
- 
-   if ( lSuppress == DEBUGLOG_LOG_ENTRIES ) {
--    sprintf(pcBuffer, "%15s %3d: %s", pcFile, (int)liLine, pcFormat );
-+    snprintf(pcBuffer,  sizeof(pcBuffer), "%15s %3d: %s", pcFile,
-+              (int)liLine, pcFormat );
- #ifdef  USE_SYSLOG
-     tmpBuffer = (char *)malloc( liLength*3 + 1); 
--    syslog( LOG_DEBUG, pcBuffer, pcFormat );
-+    syslog( LOG_INFO, pcBuffer, pcFormat );
-     for (i=0; i < liLength; i++) {
--      /* sprintf( tmpBuffer, "%x ", pucData[i] ); */
-       sprintf( tmpBuffer + i*3, "%02X ", pucData[i] );
- 
-     } 
--    /*    sprintf( tmpBuffer, "\n" ); */
--    syslog( LOG_DEBUG, tmpBuffer );
-+    syslog( LOG_INFO, tmpBuffer );
-     free( tmpBuffer );
- #else
-     printf(pcBuffer, pcFormat);
-     for (i=0; i < liLength; i++) {
--      printf("%x ", pucData[i]);
--    } printf("\n");
-+      printf("%02X ", pucData[i]);
-+    } putchar('\n');
- #endif
-   }
- 
Index: patches/patch-src-pcscdaemon_c
===================================================================
RCS file: patches/patch-src-pcscdaemon_c
diff -N patches/patch-src-pcscdaemon_c
--- patches/patch-src-pcscdaemon_c      2 Jan 2004 22:53:09 -0000       1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,190 +0,0 @@
-$OpenBSD: patch-src-pcscdaemon_c,v 1.2 2004/01/02 22:53:09 espie Exp $
---- src/pcscdaemon.c.orig      2001-11-07 23:54:30.000000000 +0100
-+++ src/pcscdaemon.c   2004-01-02 23:47:08.000000000 +0100
-@@ -26,9 +26,17 @@
- #include <stdio.h>
- #include <unistd.h>
- 
-+#ifdef USE_DAEMON
-+#ifndef USE_SYSLOG
-+#error You must use '--enable-syslog' when also using '--enable-daemon' or 
you will not get any message
-+#endif
-+#endif
-+
- /* Some internal functions */
- void SVCServiceRunLoop();
- void SVCClientCleanup( psharedSegmentMsg );
-+void at_exit(void);
-+void at_exit_signal(int);
- 
- extern int errno;
- 
-@@ -55,9 +63,9 @@ void SVCServiceRunLoop() {
-   rsp = SHMInitializeCommonSegment();
- 
-   if ( rsp == -1 ) {
--    DebugLogA("SVCServiceRunLoop: Error initializing pcscd.\n",
-+    DebugLogA("SVCServiceRunLoop: Error initializing pcscd.",
-             __FILE__, __LINE__);
--    SYS_Exit(-1);
-+    exit(-1);
-   }
- 
-   /* Solaris sends a SIGALRM and it is annoying */
-@@ -82,8 +90,7 @@ void SVCServiceRunLoop() {
-       MSGCleanupClient( &msgStruct ); 
-       SYS_MutexUnLock(&usbNotifierMutex);
-       snprintf(errMessage, sizeof(errMessage), "%s%d%s",
--               "SVCServiceRun: Client ", msgStruct.request_id,
--               " has disappeared.\n" );
-+               "SVCServiceRun: Client ", msgStruct.request_id, " has 
disappeared." );
- #ifdef PCSC_DEBUG
-       DebugLogA(errMessage, __FILE__, __LINE__);
- #endif
-@@ -108,8 +115,7 @@ void SVCServiceRunLoop() {
- 
-     case -1:
- #ifdef PCSC_DEBUG
--      DebugLogA("SVCServiceRun: Error in ProcessEvents.\n", 
--                __FILE__, __LINE__);
-+      DebugLogA("SVCServiceRun: Error in ProcessEvents.", __FILE__, __LINE__);
- #endif
-       break;
- 
-@@ -137,8 +143,7 @@ int main(int argc, char **argv) {
-     printf("pcscd -help    - This help menu\n");
-     return 0;
-   } else if ( argc == 3 && (strcmp(argv[1], "-c") == 0) ) {
--    DebugLogC("main: Using new config file: %s\n", argv[2],
--            __FILE__, __LINE__);
-+    DebugLogC("main: Using new config file: %s", argv[2], __FILE__, __LINE__);
-     newReaderConfig = argv[2];
-   } else if ( argc == 1 ) {
-     /* All OK Here */
-@@ -150,7 +155,7 @@ int main(int argc, char **argv) {
- #ifdef USE_DAEMON
-   /* standard daemonizing actions */
- #ifndef HAVE_DAEMON
--  switch (fork()) {
-+  switch (SYS_Fork()) {
-     case -1:
-       return (-1);
-     case 0:
-@@ -167,22 +172,47 @@ int main(int argc, char **argv) {
- #endif
- #endif
- 
--  /* Create the /tmp/pcsc directory and chmod it */
--  rv = SYS_Mkdir("/tmp/pcsc", S_ISVTX | S_IRWXO | S_IRWXG | S_IRWXU );
-+  /* test the presence of /tmp/pcsc */
-+  {
-+      struct stat buf;
-+
-+    rv = SYS_Stat(PCSCLITE_IPC_DIR, &buf);
-+      if (rv == 0)
-+      {
- #ifdef PCSC_DEBUG
-+      DebugLogA("main: directory " PCSCLITE_IPC_DIR " already exists",
-+                      __FILE__, __LINE__);
-+              return 1;
-+#endif
-+      }
-+
-+  }
-+
-+  /* cleanly remove /tmp/pcsc when exiting */
-+  atexit(at_exit);
-+  signal(SIGQUIT, at_exit_signal);
-+  signal(SIGTERM, at_exit_signal);
-+  signal(SIGINT, at_exit_signal);
-+  signal(SIGHUP, at_exit_signal);
-+
-+  /* Create the /tmp/pcsc directory and chmod it */
-+  rv = SYS_Mkdir(PCSCLITE_IPC_DIR, S_ISVTX | S_IRWXO | S_IRWXG | S_IRWXU );
-   if ( rv != 0 ) {
--    DebugLogC("main: Cannot create /tmp/pcsc: %s\n", strerror(errno),
-+#ifdef PCSC_DEBUG
-+    DebugLogC("main: Cannot create " PCSCLITE_IPC_DIR ": %s", strerror(errno),
-             __FILE__, __LINE__);
--  }
- #endif
-+      return 1;
-+  }
- 
--  rv = SYS_Chmod("/tmp/pcsc", S_ISVTX | S_IRWXO | S_IRWXG | S_IRWXU );
--#ifdef PCSC_DEBUG
-+  rv = SYS_Chmod(PCSCLITE_IPC_DIR, S_ISVTX | S_IRWXO | S_IRWXG | S_IRWXU );
-   if ( rv != 0 ) {
--    DebugLogC("main: Cannot chmod /tmp/pcsc: %s\n", strerror(errno),
-+#ifdef PCSC_DEBUG
-+    DebugLogC("main: Cannot chmod " PCSCLITE_IPC_DIR ": %s", strerror(errno),
-             __FILE__, __LINE__);
--  }
- #endif
-+      return 1;
-+  }
- 
-   /* Allocate memory for reader structures     */
-   RFAllocateReaderSpace( PCSCLITE_MAX_CONTEXTS );
-@@ -199,13 +229,58 @@ int main(int argc, char **argv) {
-   g_rgSCardT1Pci.dwProtocol  = SCARD_PROTOCOL_T1;  
-   g_rgSCardRawPci.dwProtocol = SCARD_PROTOCOL_RAW;
-   
--  DebugLogA("main: PC/SC Lite Daemon Ready.\n", __FILE__, __LINE__);
-+  DebugLogA("main: PC/SC Lite Daemon Ready.", __FILE__, __LINE__);
-   
-   SVCServiceRunLoop();
-+
- #ifdef USE_SYSLOG
--  syslog( LOG_ERR, "pcscdaemon.c: main: SVCServiceRunLoop returned\n" );
-+  syslog( LOG_ERR, "pcscdaemon.c: main: SVCServiceRunLoop returned" );
- #else
--  fprintf(stderr, "pcscdaemon.c: main: SVCServiceRunLoop returned\n");
-+  fprintf(stderr, "pcscdaemon.c: main: SVCServiceRunLoop returned");
- #endif
-   return 1;
- }
-+
-+void at_exit(void)
-+{
-+      int rv;
-+
-+      DebugLogA("at_exit: cleaning " PCSCLITE_IPC_DIR, __FILE__, __LINE__);
-+
-+      rv = SYS_Unlink(PCSCLITE_SHM_FILE);
-+#ifdef PCSC_DEBUG
-+      if ( rv != 0 )
-+      DebugLogC("main: Cannot unlink " PCSCLITE_SHM_FILE ": %s",
-+                      strerror(errno), __FILE__, __LINE__);
-+#endif
-+
-+      rv = SYS_Unlink(PCSCLITE_PUBSHM_FILE);
-+#ifdef PCSC_DEBUG
-+      if ( rv != 0 )
-+      DebugLogC("main: Cannot unlink " PCSCLITE_PUBSHM_FILE ": %s",
-+                      strerror(errno), __FILE__, __LINE__);
-+#endif
-+
-+      rv = SYS_Unlink(PCSCLITE_CSOCK_NAME);
-+#ifdef PCSC_DEBUG
-+      if ( rv != 0 )
-+      DebugLogC("main: Cannot unlink " PCSCLITE_CSOCK_NAME ": %s",
-+                      strerror(errno), __FILE__, __LINE__);
-+#endif
-+
-+      rv = SYS_Rmdir(PCSCLITE_IPC_DIR);
-+#ifdef PCSC_DEBUG
-+      if ( rv != 0 )
-+      DebugLogC("main: Cannot rmdir " PCSCLITE_IPC_DIR ": %s",
-+                      strerror(errno), __FILE__, __LINE__);
-+#endif
-+
-+      SYS_Exit(1);
-+}
-+
-+void at_exit_signal(int sig)
-+{
-+      /* will call at_exit() */
-+      exit(0);
-+}
-+
Index: patches/patch-src-pcsclite_h
===================================================================
RCS file: patches/patch-src-pcsclite_h
diff -N patches/patch-src-pcsclite_h
--- patches/patch-src-pcsclite_h        25 Dec 2005 09:13:57 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,22 +0,0 @@
-$OpenBSD: patch-src-pcsclite_h,v 1.4 2005/12/25 09:13:57 sturm Exp $
---- src/pcsclite.h.orig        Wed Nov  7 23:54:30 2001
-+++ src/pcsclite.h     Sun Dec 25 10:08:58 2005
-@@ -143,11 +143,13 @@ char * pcsc_stringify_error( long );
- #define BLOCK_STATUS_RESUME             0x00FF  /* Normal resume        */
- #define BLOCK_STATUS_BLOCKING           0x00FA  /* Function is blocking */
- 
--#define PCSCLITE_READER_CONFIG                "/etc/reader.conf"
--#define PCSCLITE_CARD_CONFIG          "/etc/card.conf"
--#define PCSCLITE_SHM_FILE               "/tmp/pcsc/.pcsctmp"
--#define PCSCLITE_PUBSHM_FILE            "/tmp/pcsc/.pcscpub"
--#define PCSCLITE_CSOCK_NAME             "/tmp/pcsc/.pcscomm"
-+#define PCSCLITE_CONFIG_DIR           "/etc/pcscd"
-+#define PCSCLITE_READER_CONFIG                PCSCLITE_CONFIG_DIR 
"/reader.conf"
-+#define PCSCLITE_CARD_CONFIG          PCSCLITE_CONFIG_DIR "/card.conf"
-+#define PCSCLITE_IPC_DIR              "/var/run/pcsc"
-+#define PCSCLITE_SHM_FILE               PCSCLITE_IPC_DIR "/.pcsctmp"
-+#define PCSCLITE_PUBSHM_FILE            PCSCLITE_IPC_DIR "/.pcscpub"
-+#define PCSCLITE_CSOCK_NAME             PCSCLITE_IPC_DIR "/.pcscomm"
- 
- #define PCSCLITE_SVC_IDENTITY      0x01030000 /* Service ID           */
- 
Index: patches/patch-src-sys_generic_h
===================================================================
RCS file: patches/patch-src-sys_generic_h
diff -N patches/patch-src-sys_generic_h
--- patches/patch-src-sys_generic_h     25 Dec 2005 09:13:57 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,33 +0,0 @@
-$OpenBSD: patch-src-sys_generic_h,v 1.2 2005/12/25 09:13:57 sturm Exp $
---- src/sys_generic.h.orig     Wed Nov  7 23:54:32 2001
-+++ src/sys_generic.h  Sun Dec 25 10:08:58 2005
-@@ -19,6 +19,8 @@
- extern "C" {
- #endif     
- 
-+#include <sys/stat.h>
-+
-   int SYS_Initialize();
- 
-   int SYS_Mkdir( char*, int );
-@@ -73,13 +75,19 @@ extern "C" {
-   
-   int SYS_Wait( int, int );
-   
--  int SYS_Stat( int );
-+  int SYS_Stat( char *pcFile, struct stat *psStatus );
-+
-+  int SYS_Fstat( int );
-   
-   int SYS_Random( int, float, float );
- 
-   int SYS_GetSeed();
- 
-   int SYS_Exit( int );
-+
-+  int SYS_Rmdir( char *pcFile );
-+
-+  int SYS_Unlink( char *pcFile );
- 
- #ifdef __cplusplus
- }
Index: patches/patch-src-sys_unix_c
===================================================================
RCS file: patches/patch-src-sys_unix_c
diff -N patches/patch-src-sys_unix_c
--- patches/patch-src-sys_unix_c        25 Dec 2005 09:13:57 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,41 +0,0 @@
-$OpenBSD: patch-src-sys_unix_c,v 1.2 2005/12/25 09:13:57 sturm Exp $
---- src/sys_unix.c.orig        Wed Nov  7 23:54:32 2001
-+++ src/sys_unix.c     Sun Dec 25 10:08:58 2005
-@@ -128,7 +128,7 @@ void *SYS_MemoryMap( int iSize, int iFid
-   /* Here are some common error types:
-   switch( errno ) {
-   case EINVAL:
--    printf("EINVAL\n");
-+    printf("EINVAL");
-   case EBADF:
-     printf("EBADF");
-     break;
-@@ -169,7 +169,11 @@ int SYS_Wait( int iPid, int iWait ) {
-  return waitpid( -1, 0, WNOHANG );
- }
- 
--int SYS_Stat( int iFd ) {
-+int SYS_Stat( char *pcFile, struct stat *psStatus ) {
-+  return stat( pcFile, psStatus );
-+}
-+
-+int SYS_Fstat( int iFd ) {
-   struct stat sStatus;
-   return fstat( iFd, &sStatus );
- }
-@@ -205,5 +209,15 @@ int SYS_GetSeed() {
- 
- int SYS_Exit( int iRetVal ) {
-   _exit( iRetVal );
-+}
-+
-+int SYS_Rmdir( char *pcFile )
-+{
-+      return rmdir(pcFile);
-+}
-+
-+int SYS_Unlink( char *pcFile )
-+{
-+      return unlink(pcFile);
- }
- 
Index: patches/patch-src-utils-installifs_c
===================================================================
RCS file: patches/patch-src-utils-installifs_c
diff -N patches/patch-src-utils-installifs_c
--- patches/patch-src-utils-installifs_c        25 Dec 2005 09:13:57 -0000      
1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
-$OpenBSD: patch-src-utils-installifs_c,v 1.2 2005/12/25 09:13:57 sturm Exp $
---- src/utils/installifd.c.orig        Wed Nov  7 23:54:32 2001
-+++ src/utils/installifd.c     Sun Dec 25 10:08:58 2005
-@@ -107,12 +107,12 @@ int main(int argc, char **argv) {
- 
- 
-   printf("\n\n");
--  printf("Now creating new /etc/reader.conf: \n");
-+  printf("Now creating new /etc/pcscd/reader.conf: \n");
- 
--  fd = fopen("/etc/reader.conf", "w" );
-+  fd = fopen("/etc/pcscd/reader.conf", "w" );
- 
-   if ( fd == 0 ) {
--    printf("Cannot open file /etc/reader.conf (are you root ?)\n");
-+    printf("Cannot open file /etc/pcscd/reader.conf (are you root ?)\n");
-     free(lpcPortID);
-     return 1;
-   }
Index: patches/patch-src_Makefile_in
===================================================================
RCS file: patches/patch-src_Makefile_in
diff -N patches/patch-src_Makefile_in
--- patches/patch-src_Makefile_in       25 Dec 2005 11:15:34 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,13 +0,0 @@
-$OpenBSD: patch-src_Makefile_in,v 1.1 2005/12/25 11:15:34 sturm Exp $
---- src/Makefile.in.orig       Sun Dec 25 11:33:49 2005
-+++ src/Makefile.in    Sun Dec 25 11:34:06 2005
-@@ -121,7 +121,8 @@ TESTS = testpcsc
- libpcsclite_core_la_SOURCES = configfile.l bundleparser.l     winscard.c 
eventhandler.c ifdwrapper.c atrhandler.c prothandler.c       readerfactory.c 
winscard_msg.c debuglog.c $(PCSC_SYSTEM_SOURCE)         $(PCSC_THREAD_SOURCE) 
$(PCSC_HOTPLUG_SOURCE) $(PCSC_DYNLOAD_SOURCE)
- 
- 
--libpcsclite_core_la_LDFLAGS = -version-info 0:2:0 $(PCSC_INCLUDE_LIBS)
-+libpcsclite_core_la_LDFLAGS = ${librealpcsclite_core_la_LDFLAGS} \
-+      $(PCSC_INCLUDE_LIBS)
- 
- libpcsclite_la_SOURCES = winscard_clnt.c debuglog.c $(PCSC_SYSTEM_SOURCE)     
                 winscard_msg.c $(PCSC_CLIENT)
- 
Index: patches/patch-src_spy_Makefile_in
===================================================================
RCS file: patches/patch-src_spy_Makefile_in
diff -N patches/patch-src_spy_Makefile_in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_spy_Makefile_in   16 Jul 2012 10:13:30 -0000
@@ -0,0 +1,20 @@
+$OpenBSD$
+--- src/spy/Makefile.in.orig   Mon Jul  9 13:33:21 2012
++++ src/spy/Makefile.in        Mon Jul  9 13:33:58 2012
+@@ -293,7 +293,6 @@ dist_bin_SCRIPTS = pcsc-spy
+ libpcscspy_la_SOURCES = \
+       libpcscspy.c
+ 
+-libpcscspy_la_LIBADD = -ldl
+ man_MANS = pcsc-spy.1
+ EXTRA_DIST = install_spy.sh uninstall_spy.sh pcsc-spy.pod
+ CLEANFILES = pcsc-spy.1
+@@ -364,7 +363,7 @@ clean-libLTLIBRARIES:
+         rm -f "$${dir}/so_locations"; \
+       done
+ libpcscspy.la: $(libpcscspy_la_OBJECTS) $(libpcscspy_la_DEPENDENCIES) 
$(EXTRA_libpcscspy_la_DEPENDENCIES) 
+-      $(AM_V_CCLD)$(LINK) -rpath $(libdir) $(libpcscspy_la_OBJECTS) 
$(libpcscspy_la_LIBADD) $(LIBS)
++      $(AM_V_CCLD)$(LINK) -rpath $(libdir) $(libpcscspy_la_OBJECTS) $(LIBS)
+ install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
+       @$(NORMAL_INSTALL)
+       @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
Index: patches/patch-src_spy_libpcscspy_c
===================================================================
RCS file: patches/patch-src_spy_libpcscspy_c
diff -N patches/patch-src_spy_libpcscspy_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_spy_libpcscspy_c  16 Jul 2012 10:13:30 -0000
@@ -0,0 +1,29 @@
+$OpenBSD$
+--- src/spy/libpcscspy.c.orig  Mon Jul  9 16:54:38 2012
++++ src/spy/libpcscspy.c       Mon Jul  9 16:56:12 2012
+@@ -28,6 +28,7 @@
+ #include <unistd.h>
+ #include <sys/time.h>
+ #include <pthread.h>
++#include <inttypes.h>
+ 
+ #include "misc.h"
+ #include <winscard.h>
+@@ -168,7 +169,7 @@ static void spy_line_direct(char *line)
+       if (Log_fd < 0)
+               return;
+ 
+-      snprintf(threadid, sizeof threadid, "%lX@", pthread_self());
++      snprintf(threadid, sizeof threadid, "%" PRIXPTR "@", 
(uintptr_t)pthread_self());
+       pthread_mutex_lock(&Log_fd_mutex);
+       write(Log_fd, threadid, strlen(threadid));
+       write(Log_fd, line, strlen(line));
+@@ -194,7 +195,7 @@ static void spy_line(const char *fmt, ...)
+               printf("libpcsc-spy: Buffer is too small!\n");
+               return;
+       }
+-      snprintf(threadid, sizeof threadid, "%lX@", pthread_self());
++      snprintf(threadid, sizeof threadid, "%" PRIXPTR "@", 
(uintptr_t)pthread_self());
+       pthread_mutex_lock(&Log_fd_mutex);
+       write(Log_fd, threadid, strlen(threadid));
+       write(Log_fd, line, size);
Index: pkg/DESCR
===================================================================
RCS file: /cvs/ports/security/pcsc-lite/pkg/DESCR,v
retrieving revision 1.2
diff -u -p -r1.2 DESCR
--- pkg/DESCR   15 Dec 2003 21:55:22 -0000      1.2
+++ pkg/DESCR   16 Jul 2012 10:13:30 -0000
@@ -1,4 +1,4 @@
-PC/SC Architecture for most Unix type operating systems.  Allows
-easy porting of Windows smartcard software to other operating
-systems.  Supports many types of serial, PCMCIA, and USB smartcard
-readers and cryptographic tokens.
+PC/SC Architecture for most Unix type operating systems.
+It allows easy porting of Windows smartcard software to other
+operating systems. It supports many types of serial, PCMCIA, and
+USB smartcard readers and cryptographic tokens.
Index: pkg/PFRAG.shared
===================================================================
RCS file: /cvs/ports/security/pcsc-lite/pkg/PFRAG.shared,v
retrieving revision 1.3
diff -u -p -r1.3 PFRAG.shared
--- pkg/PFRAG.shared    25 Dec 2005 11:15:34 -0000      1.3
+++ pkg/PFRAG.shared    16 Jul 2012 10:13:30 -0000
@@ -1,3 +1,3 @@
 @comment $OpenBSD: PFRAG.shared,v 1.3 2005/12/25 11:15:34 sturm Exp $
-@lib lib/libpcsclite-core.so.${LIBpcsclite-core_VERSION}
 @lib lib/libpcsclite.so.${LIBpcsclite_VERSION}
+@lib lib/libpcscspy.so.${LIBpcscspy_VERSION}
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/security/pcsc-lite/pkg/PLIST,v
retrieving revision 1.3
diff -u -p -r1.3 PLIST
--- pkg/PLIST   4 Oct 2004 19:56:28 -0000       1.3
+++ pkg/PLIST   16 Jul 2012 10:13:30 -0000
@@ -1,30 +1,22 @@
 @comment $OpenBSD: PLIST,v 1.3 2004/10/04 19:56:28 xsa Exp $
-include/atrhandler.h
-include/configfile.h
-include/debuglog.h
-include/dyn_generic.h
-include/eventhandler.h
-include/hotplug.h
-include/ifdhandler.h
-include/ifdwrapper.h
-include/pcsclite.h
-include/prothandler.h
-include/readerfactory.h
-include/sys_generic.h
-include/thread_generic.h
-include/winscard.h
-include/winscard_msg.h
-include/winscard_svc.h
-include/wintypes.h
-lib/libpcsclite-core.a
-lib/libpcsclite-core.la
+%%SHARED%%
+bin/pcsc-spy
+include/PCSC/
+include/PCSC/debuglog.h
+include/PCSC/ifdhandler.h
+include/PCSC/pcsclite.h
+include/PCSC/reader.h
+include/PCSC/winscard.h
+include/PCSC/wintypes.h
 lib/libpcsclite.a
 lib/libpcsclite.la
-sbin/pcscd
-share/examples/pcscd/
-share/examples/pcscd/reader.conf.sample
-@mode 711
-@sample ${SYSCONFDIR}/pcscd/
-@mode
-@sample ${SYSCONFDIR}/pcscd/reader.conf
-%%SHARED%%
+lib/libpcscspy.a
+lib/libpcscspy.la
+lib/pkgconfig/libpcsclite.pc
+@man man/man1/pcsc-spy.1
+@man man/man5/reader.conf.5
+@man man/man8/pcscd.8
+@bin sbin/pcscd
+@comment share/doc/pcsc-lite/
+@comment share/doc/pcsc-lite/README.DAEMON
+@rcscript ${RCDIR}/pcscd
Index: pkg/pcscd.rc
===================================================================
RCS file: pkg/pcscd.rc
diff -N pkg/pcscd.rc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ pkg/pcscd.rc        16 Jul 2012 10:13:30 -0000
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD$
+
+daemon="${TRUEPREFIX}/sbin/pcscd"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_cmd $1

Reply via email to