[Midnightbsd-cvs] mports [15423] trunk/security/openct: openct 0.6.20

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Sep 8 17:26:50 EDT 2013


Revision: 15423
          http://svnweb.midnightbsd.org/mports/?rev=15423
Author:   laffer1
Date:     2013-09-08 17:26:49 -0400 (Sun, 08 Sep 2013)
Log Message:
-----------
openct 0.6.20

Modified Paths:
--------------
    trunk/security/openct/Makefile
    trunk/security/openct/distinfo
    trunk/security/openct/files/openct.in

Added Paths:
-----------
    trunk/security/openct/files/patch-ctapi.c

Removed Paths:
-------------
    trunk/security/openct/files/patch-configure
    trunk/security/openct/files/patch-src_ifd_sys-bsd.c

Modified: trunk/security/openct/Makefile
===================================================================
--- trunk/security/openct/Makefile	2013-09-08 21:24:31 UTC (rev 15422)
+++ trunk/security/openct/Makefile	2013-09-08 21:26:49 UTC (rev 15423)
@@ -1,22 +1,22 @@
 # $MidnightBSD: mports/security/openct/Makefile,v 1.3 2009/09/20 04:08:37 laffer1 Exp $
 
 PORTNAME=	openct
-DISTVERSION=	0.6.15
+PORTVERSION=	0.6.20
 CATEGORIES=	security
-MASTER_SITES=	http://www.opensc-project.org/files/${PORTNAME}/ \
-		http://www.opensc-project.org/files/${PORTNAME}/testing/
+MASTER_SITES=	SF
+MASTER_SITE_SUBDIR=	opensc/${PORTNAME}
 
 MAINTAINER=	ports at MidnightBSD.org
-COMMENT=	A middleware framework for smart card terminals
+COMMENT=	Middleware framework for smart card terminals
+
 LICENSE=	lgpl
 
-OPTIONS=	USB "Install libusb for USB tokens/readers support" on \
-		PCSC "Install pcsc-lite to build the PC/SC->OpenCT frontend" off
+OPTIONS_DEFINE=	PCSC DOCS
+PCSC_DESC=	Enable PC/SC support
 
 USE_AUTOTOOLS=	libltdl
 GNU_CONFIGURE=	yes
-USE_GMAKE=	yes
-USE_GNOME=	gnomehack pkgconfig
+USES=		gmake pkgconfig
 USE_LDCONFIG=	yes
 USE_RC_SUBR=	openct
 SUB_FILES=	etoken.conf
@@ -32,11 +32,14 @@
 
 .include <bsd.port.pre.mk>
 
-.if !defined(WITHOUT_USB) || exists(${LOCALBASE}/lib/libusb-0.1.so)
-LIB_DEPENDS+=	usb-0.1.8:${PORTSDIR}/devel/libusb
+.if ${OSVERSION} >= 4016
+CONFIGURE_ENV+=	LIBUSB_CFLAGS="-I/usr/include" \
+		LIBUSB_LIBS="-lusb"
+
+CONFIGURE_ARGS+=--enable-usb
 .endif
 
-.if defined(WITH_PCSC)
+.if ${PORT_OPTIONS:MPCSC}
 LIB_DEPENDS+=	pcsclite.1:${PORTSDIR}/devel/pcsc-lite
 CONFIGURE_ARGS+=--enable-pcsc
 PLIST_SUB+=	PCSC=""
@@ -44,7 +47,7 @@
 PLIST_SUB+=	PCSC="@comment "
 .endif
 
-.ifndef(NOPORTDOCS)
+.if ${PORT_OPTIONS:MDOCS}
 CONFIGURE_ARGS+=--enable-doc
 .endif
 
@@ -51,13 +54,13 @@
 post-patch:
 	@${REINPLACE_CMD} 's|(libdir)/pkgconfig|(prefix)/libdata/pkgconfig|' \
 		${WRKSRC}/configure
-.ifndef(NOPORTDOCS)
-	@${REINPLACE_CMD} 's|install-data-am: install-apidocDATA install-dist_docDATA|install-data-am: install-dist_docDATA|' \
+.if ${PORT_OPTIONS:MDOCS}
+	@${REINPLACE_CMD} 's|install-data-am: install-dist_apidocDATA install-dist_docDATA|install-data-am: install-dist_docDATA|' \
 		${WRKSRC}/doc/Makefile.in
 .else
 	@${REINPLACE_CMD} 's|install-data-am: install-dist_docDATA|install-data-am:|' \
 		${WRKSRC}/Makefile.in
-	@${REINPLACE_CMD} 's|install-data-am: install-apidocDATA install-dist_docDATA|install-data-am:|' \
+	@${REINPLACE_CMD} 's|install-data-am: install-dist_apidocDATA install-dist_docDATA|install-data-am:|' \
 		${WRKSRC}/doc/Makefile.in
 .endif
 

Modified: trunk/security/openct/distinfo
===================================================================
--- trunk/security/openct/distinfo	2013-09-08 21:24:31 UTC (rev 15422)
+++ trunk/security/openct/distinfo	2013-09-08 21:26:49 UTC (rev 15423)
@@ -1,4 +1,2 @@
-MD5 (openct-0.6.15.tar.gz) = 70205beac03974e266fc259b6c9feaa8
-SHA256 (openct-0.6.15.tar.gz) = 737cafaef803e21d63c61a196b07b61c1ba47320a24b9c7c2790c68f92719b6a
-RMD160 (openct-0.6.15.tar.gz) = a646dda412963de2e36e5bff64fce948c06bc761
-SIZE (openct-0.6.15.tar.gz) = 673265
+SHA256 (openct-0.6.20.tar.gz) = 6cd3e2933d29eb1f875c838ee58b8071fd61f0ec8ed5922a86c01c805d181a68
+SIZE (openct-0.6.20.tar.gz) = 702818

Modified: trunk/security/openct/files/openct.in
===================================================================
--- trunk/security/openct/files/openct.in	2013-09-08 21:24:31 UTC (rev 15422)
+++ trunk/security/openct/files/openct.in	2013-09-08 21:26:49 UTC (rev 15423)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $FreeBSD: ports/security/openct/files/openct.in,v 1.2 2008/08/27 21:15:18 ale Exp $
+# $FreeBSD$
 #
 
 # PROVIDE: openct
@@ -14,10 +14,10 @@
 #			Set it to "YES" to enable OpenCT.
 #
 
-. %%RC_SUBR%%
+. /etc/rc.subr
 
 name="openct"
-rcvar=`set_rcvar`
+rcvar=openct_enable
 
 load_rc_config $name
 

Deleted: trunk/security/openct/files/patch-configure
===================================================================
--- trunk/security/openct/files/patch-configure	2013-09-08 21:24:31 UTC (rev 15422)
+++ trunk/security/openct/files/patch-configure	2013-09-08 21:26:49 UTC (rev 15423)
@@ -1,13 +0,0 @@
---- configure.orig	2008-08-28 07:41:50.000000000 +0200
-+++ configure	2008-08-28 08:12:37.000000000 +0200
-@@ -4740,8 +4740,8 @@
- 	;;
- esac
- 
--usrlibdir="/usr/lib${libdir##*/lib}"
--usrsbindir="/usr/sbin${libdir##*/sbin}"
-+usrlibdir=`eval eval eval eval eval echo "${libdir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
-+usrsbindir=`eval eval eval eval eval echo "${sbindir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
- 
- full_sysconfdir=`eval eval eval eval eval echo "${sysconfdir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
- full_localstatedir=`eval eval eval eval eval echo "${localstatedir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`

Added: trunk/security/openct/files/patch-ctapi.c
===================================================================
--- trunk/security/openct/files/patch-ctapi.c	                        (rev 0)
+++ trunk/security/openct/files/patch-ctapi.c	2013-09-08 21:26:49 UTC (rev 15423)
@@ -0,0 +1,15 @@
+--- src/ctapi/ctapi.c	2006-04-25 23:58:06.000000000 +0200
++++ src/ctapi/ctapi.c	2013-07-05 10:08:41.000000000 +0200
+@@ -562,7 +562,11 @@
+ 	ct->next = cardTerminals;
+ 	cardTerminals = ct;
+ 	ct->cwd = &ct->mf;
+-	ct_reader_info(pn, &info);
++	if (ct_reader_info(pn, &info) < 0) { 
++		free(ct);
++		ct_error("ct_reader_info failed\n");
++		return ERR_INVALID;
++	}
+ 	ct->mf.id = 0x3f00;
+ 	ct->mf.gen = dir;
+ 	ct->mf.dir[0] = &ct->mf;

Deleted: trunk/security/openct/files/patch-src_ifd_sys-bsd.c
===================================================================
--- trunk/security/openct/files/patch-src_ifd_sys-bsd.c	2013-09-08 21:24:31 UTC (rev 15422)
+++ trunk/security/openct/files/patch-src_ifd_sys-bsd.c	2013-09-08 21:26:49 UTC (rev 15423)
@@ -1,375 +0,0 @@
---- src/ifd/sys-bsd.c.orig	2008-07-27 02:54:36.000000000 -0700
-+++ src/ifd/sys-bsd.c	2009-03-22 13:00:19.000000000 -0700
-@@ -13,11 +13,13 @@
- #include "internal.h"
- #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
- #include <sys/types.h>
-+#ifndef ENABLE_LIBUSB
- #if defined(__DragonFly__)
- #include <bus/usb/usb.h>
- #else
- #include <dev/usb/usb.h>
- #endif
-+#endif /* !ENABLE_LIBUSB */
- #include <sys/stat.h>
- #include <sys/ioctl.h>
- #include <sys/poll.h>
-@@ -30,9 +32,16 @@
- #include <unistd.h>
- #include <errno.h>
- #include <openct/driver.h>
-+#ifdef ENABLE_LIBUSB
-+#include <usb.h>
-+#endif
- 
- #include "usb-descriptors.h"
- 
-+#ifdef ENABLE_LIBUSB
-+struct usb_dev_handle *devices[128];
-+#endif
-+
- /*
-  * Poll for presence of USB device
-  */
-@@ -45,6 +54,7 @@
- 	return 1;
- }
- 
-+#ifndef ENABLE_LIBUSB
- typedef struct ep {
- 	int ep_fd;
- } ep_t;
-@@ -90,6 +100,7 @@
- 		interfaces[interface][endpoint].ep_fd = 0;
- 	}
- }
-+#endif /* !ENABLE_LIBUSB */
- 
- int ifd_sysdep_usb_bulk(ifd_device_t * dev, int ep, void *buffer, size_t len,
- 			long timeout)
-@@ -103,6 +114,16 @@
- 	ct_debug("ifd_sysdep_usb_bulk: endpoint=%d direction=%d", endpoint,
- 		 direction);
- 	if (direction) {
-+#ifdef ENABLE_LIBUSB
-+		if ((bytes_to_process =
-+		     usb_bulk_read(devices[dev->fd], ep, buffer, len,
-+				   timeout)) < 0) {
-+			ifd_debug(6, "ifd_sysdep_usb_bulk: read failed: %s",
-+				  strerror(errno));
-+			ct_error("usb_bulk read failed: %s", strerror(errno));
-+			return IFD_ERROR_COMM_ERROR;
-+		}
-+#else
- 		int one = 1;
- 
- 		if (open_ep(dev->name, 0, endpoint, O_RDONLY | O_NONBLOCK)) {
-@@ -123,19 +144,28 @@
- 			ct_error("usb_bulk read failed: %s", strerror(errno));
- 			return IFD_ERROR_COMM_ERROR;
- 		}
-+#endif /* ENABLE_LIBUSB */
- 		ct_debug("ifd_sysdep_usb_bulk: read %d bytes",
- 			 bytes_to_process);
- 		return bytes_to_process;
- 	} else {
-+#ifndef ENABLE_LIBUSB
- 		if (open_ep(dev->name, 0, endpoint, O_WRONLY | O_NONBLOCK)) {
- 			ct_debug("ifd_sysdep_usb_bulk: opening endpoint failed");
- 			return -1;
- 		}
-+#endif /* !ENABLE_LIBUSB */
- 
- 		bytes_to_process = len;
- 		if ((bytes_processed =
-+#ifdef ENABLE_LIBUSB
-+		     usb_bulk_write(devices[dev->fd], ep, buffer,
-+				    bytes_to_process, timeout)
-+#else
- 		     write(interfaces[0][endpoint].ep_fd, buffer,
--			   bytes_to_process)) != bytes_to_process) {
-+			   bytes_to_process)
-+#endif /* ENABLE_LIBUSB */
-+			    ) != bytes_to_process) {
- 			ifd_debug(6, "ifd_sysdep_usb_bulk: write failed: %s",
- 				  strerror(errno));
- 			ct_error("usb_bulk write failed: %s", strerror(errno));
-@@ -161,9 +191,11 @@
- 				 size_t maxpacket, ifd_usb_capture_t ** capret)
- {
- 	ifd_usb_capture_t *cap;
-+#ifndef ENABLE_LIBUSB
- 	int direction =
- 	    (ep & IFD_USB_ENDPOINT_DIR_MASK) == IFD_USB_ENDPOINT_IN ? 1 : 0;
- 	int endpoint = (ep & ~IFD_USB_ENDPOINT_DIR_MASK);
-+#endif /* !ENABLE_LIBUSB */
- 
- 	if (!(cap = (ifd_usb_capture_t *) calloc(1, sizeof(*cap) + maxpacket))) {
- 		ct_error("out of memory");
-@@ -173,6 +205,7 @@
- 	cap->endpoint = ep;
- 	cap->maxpacket = maxpacket;
- 
-+#ifndef ENABLE_LIBUSB
- 	if (!interfaces[0][endpoint].ep_fd) {
- 		if (open_ep(dev->name, 0, endpoint, O_RDONLY | O_NONBLOCK)) {
- 			ct_debug
-@@ -180,6 +213,7 @@
- 			return -1;
- 		}
- 	}
-+#endif /* !ENABLE_LIBUSB */
- 	*capret = cap;
- 	return 0;
- }
-@@ -187,8 +221,19 @@
- int ifd_sysdep_usb_capture(ifd_device_t * dev, ifd_usb_capture_t * cap,
- 			   void *buffer, size_t len, long timeout)
- {
--	struct timeval begin;
- 	int bytes_to_process = 0;
-+#ifdef ENABLE_LIBUSB
-+	if ((bytes_to_process =
-+	     usb_interrupt_read(devices[dev->fd], cap->endpoint, buffer, len,
-+				timeout)) < 0) {
-+		ifd_debug(6,
-+			  "ifd_sysdep_usb_capture: usb_interrupt_read failed: %s",
-+			  strerror(errno));
-+		ct_error("usb_bulk read failed: %s", strerror(errno));
-+		return IFD_ERROR_COMM_ERROR;
-+	}
-+#else
-+	struct timeval begin;
- 	int direction =
- 	    (cap->endpoint & IFD_USB_ENDPOINT_DIR_MASK) ==
- 	    IFD_USB_ENDPOINT_IN ? 1 : 0;
-@@ -215,6 +260,7 @@
- 			return IFD_ERROR_COMM_ERROR;
- 		}
- 	} while (!bytes_to_process);
-+#endif /* ENABLE_LIBUSB */
- 	ct_debug("ifd_sysdep_usb_capture: read buffer[%d]=%s", bytes_to_process,
- 		 ct_hexdump(buffer, bytes_to_process));
- 	return bytes_to_process;
-@@ -222,11 +268,13 @@
- 
- int ifd_sysdep_usb_end_capture(ifd_device_t * dev, ifd_usb_capture_t * cap)
- {
-+#ifndef ENABLE_LIBUSB
- 	int direction =
- 	    (cap->endpoint & IFD_USB_ENDPOINT_DIR_MASK) ==
- 	    IFD_USB_ENDPOINT_IN ? 1 : 0;
- 	int endpoint = (cap->endpoint & ~IFD_USB_ENDPOINT_DIR_MASK);
- 	close_ep(0, endpoint);
-+#endif /* !ENABLE_LIBUSB */
- 	if (cap)
- 		free(cap);
- 	return 0;
-@@ -240,9 +288,25 @@
- 			   unsigned int index, void *data, size_t len,
- 			   long timeout)
- {
--	struct usb_ctl_request ctrl;
- 	int rc, val;
- 
-+#ifdef ENABLE_LIBUSB
-+	ct_debug("ifd_sysdep_usb_control: dev->fd=%d handle=0x%x", dev->fd,
-+		 devices[dev->fd]);
-+	if ((rc =
-+	     usb_control_msg(devices[dev->fd], requesttype, request, value,
-+			     index, data, len, timeout)) < 0) {
-+		ifd_debug(1, "usb_control_msg failed: %d", rc);
-+		ct_error("usb_control_msg failed: %s(%d)",
-+			 strerror(errno), errno);
-+		return IFD_ERROR_COMM_ERROR;
-+	}
-+
-+	ct_debug("ifd_sysdep_usb_control: return rc=%d", rc);
-+	return rc;
-+#else
-+	struct usb_ctl_request ctrl;
-+
- 	ifd_debug(1, "BSD: ifd_sysdep_usb_control(0x%x)", request);
- 	memset(&ctrl, 0, sizeof(ctrl));
- 
-@@ -282,14 +346,21 @@
- 		ifd_debug(1, "BSD: CTRL RECV data %s",
- 			  ct_hexdump(ctrl.ucr_data, ctrl.ucr_actlen));
- 	return ctrl.ucr_actlen;
-+#endif /* ENABLE_LIBUSB */
- }
- 
- int ifd_sysdep_usb_set_configuration(ifd_device_t * dev, int config)
- {
--	int value, rc;
-+	int rc;
-+#ifdef ENABLE_LIBUSB
-+	if ((rc = usb_set_configuration(devices[dev->fd], config)) < 0) {
-+		ifd_debug(1, "usb_set_configuration failed: %d", rc);
-+#else
-+	int value;
- 	value = config;
- 	if ((rc = ioctl(dev->fd, USB_SET_CONFIG, &value)) < 0) {
- 		ifd_debug(1, "USB_SET_CONFIG failed: %d", rc);
-+#endif /* ENABLE_LIBUSB */
- 		ct_error("usb_set_configuration failed: %s(%d)",
- 			 strerror(errno), errno);
- 		return IFD_ERROR_COMM_ERROR;
-@@ -300,6 +371,10 @@
- int ifd_sysdep_usb_set_interface(ifd_device_t * dev, int ifc, int alt)
- {
- 	int rc;
-+#ifdef ENABLE_LIBUSB
-+	if ((rc = usb_set_altinterface(devices[dev->fd], alt)) < 0) {
-+		ifd_debug(1, "usb_set_altinterface failed: %d", rc);
-+#else
- 	struct usb_alt_interface {
- 		int uai_config_index;
- 		int uai_interface_index;
-@@ -311,6 +386,7 @@
- 	value.uai_alt_no = alt;
- 	if ((rc = ioctl(dev->fd, USB_SET_ALTINTERFACE, &value)) < 0) {
- 		ifd_debug(1, "USB_SET_ALTINTERFACE failed: %d", rc);
-+#endif /* ENABLE_LIBUSB */
- 		ct_error("usb_set_interface failed: %s(%d)",
- 			 strerror(errno), errno);
- 		return IFD_ERROR_COMM_ERROR;
-@@ -320,22 +396,82 @@
- 
- int ifd_sysdep_usb_claim_interface(ifd_device_t * dev, int interface)
- {
-+#ifdef ENABLE_LIBUSB
-+	int rc;
-+
-+	ct_debug("ifd_sysdep_usb_claim_interface: interface=%d", interface);
-+	if ((rc = usb_claim_interface(devices[dev->fd], interface)) < 0) {
-+		ifd_debug(1, "usb_clain_interface failed: %d", rc);
-+		ct_error("usb_release_interface failed: %s(%d)",
-+			 strerror(errno), errno);
-+		return IFD_ERROR_COMM_ERROR;
-+	}
-+#else
- 	ct_debug
- 	    ("ifd_sysdep_usb_claim_interface: interface=%d (not yet implemented)",
- 	     interface);
-+#endif /* ENABLE_LIBUSB */
- 	return 0;
- }
- 
- int ifd_sysdep_usb_release_interface(ifd_device_t * dev, int interface)
- {
-+#ifdef ENABLE_LIBUSB
-+	int rc;
-+
-+	ct_debug("ifd_sysdep_usb_release_interface: interface=%d", interface);
-+	if ((rc = usb_release_interface(devices[dev->fd], interface)) < 0) {
-+		ifd_debug(1, "usb_release_interface failed: %d", rc);
-+		ct_error("usb_release_interface failed: %s(%d)",
-+			 strerror(errno), errno);
-+		return IFD_ERROR_COMM_ERROR;
-+	}
-+#else
- 	ct_debug
- 	    ("ifd_sysdep_usb_release_interface: interface=%d (not yet implemented)",
- 	     interface);
-+#endif /* ENABLE_LIBUSB */
- 	return 0;
- }
- 
- int ifd_sysdep_usb_open(const char *device)
- {
-+#ifdef ENABLE_LIBUSB
-+	struct usb_bus *bus;
-+	struct usb_device *dev;
-+
-+	ct_debug("ifd_sysdep_usb_open: name=%s", device);
-+	ct_debug("ifd_sysdep_usb_open: usb_init()");
-+	usb_init();
-+	ct_debug("ifd_sysdep_usb_open: usb_find_busses()");
-+	usb_find_busses();
-+	ct_debug("ifd_sysdep_usb_open: usb_find_devices()");
-+	usb_find_devices();
-+
-+	ct_debug("ifd_sysdep_usb_open: walk devices");
-+	for (bus = usb_busses; bus; bus = bus->next) {
-+		for (dev = bus->devices; dev; dev = dev->next) {
-+			int i;
-+
-+			if (strcmp(dev->filename, device) != 0)
-+				continue;
-+
-+			ct_debug
-+			    ("ifd_sysdep_usb_open: found match name=%s device=%s",
-+			     device, dev->filename);
-+			for (i = 0; i < 128; i++) {
-+				if (devices[i] == NULL) {
-+					devices[i] = usb_open(dev);
-+					ct_debug
-+					    ("ifd_sysdep_usb_open: usb_open index=%d handle=0x%x",
-+					     i, devices[i]);
-+					return i;
-+				}
-+			}
-+		}
-+	}
-+	return -1;
-+#else
- #ifdef __OpenBSD__
- 	char path[256];
- 
-@@ -345,6 +481,7 @@
- #else
- 	return open(device, O_RDWR);
- #endif /* __OpenBSD__ */
-+#endif /* ENABLE_LIBUSB */
- }
- 
- int ifd_sysdep_usb_reset(ifd_device_t * dev)
-@@ -358,6 +495,39 @@
-  */
- int ifd_scan_usb(void)
- {
-+#ifdef ENABLE_LIBUSB
-+	struct usb_bus *bus;
-+	struct usb_device *dev;
-+	ifd_devid_t id;
-+
-+	usb_init();
-+	usb_find_busses();
-+	usb_find_devices();
-+
-+	id.type = IFD_DEVICE_TYPE_USB;
-+	id.num = 2;
-+	for (bus = usb_busses; bus; bus = bus->next) {
-+		for (dev = bus->devices; dev; dev = dev->next) {
-+			const char *driver;
-+			char typedev[PATH_MAX];
-+
-+			id.val[0] = dev->descriptor.idVendor;
-+			id.val[1] = dev->descriptor.idProduct;
-+
-+			/* FIXME: if we don't find a driver with vendor/product
-+			 * then check for the interface type (ccid) and use
-+			 * driver ccid... */
-+
-+			if (!(driver = ifd_driver_for_id(&id)))
-+				continue;
-+
-+			snprintf(typedev, sizeof(typedev),
-+				 "usb:%s", dev->filename);
-+
-+			ifd_spawn_handler(driver, typedev, -1);
-+		}
-+	}
-+#else
- 	int i, controller_fd;
- 	char controller_devname[10];
- 
-@@ -421,6 +591,7 @@
- 		}
- 		close(controller_fd);
- 	}
-+#endif /* ENABLE_LIBUSB */
- 	return 0;
- }
- #endif				/* __Net/Free/OpenBSD__ */



More information about the Midnightbsd-cvs mailing list