Hi,

Attached is a diff to update OpenCT to version 0.6.14.

I tested it on a OpenBSD 4.3 snapshot from the beginning of April and on
 OpenBSD 4.1, both on i386 hardware. And with the following card
readers/tokens:
 - eToken Pro/32k, OK
 - eToken Pro/32k(4.2b) (=etoken64), Unstable
 - Kobil mIdentity Light, Unstable
 - OmniKey CardMan 3121, Seems to work(didn't have a writable card for
   testing)

Some card readers/tokens where unstable, meaning they had I/O errors. This
 seems to be more a ugen problem then an OpenCT problem, since enabling
debugging in OpenCT or connecting the device through a USB hub fixed the
instability. The amount of instability also depended on which machine i
used(Dell 1850 vs. Dell 850). But since only readers that also don't work
with the OpenCT currently in the ports tree are affected, i don't think
this should block updating to the this new OpenCT version.

Best regards,

David
diff -urN openct.orig/Makefile openct/Makefile
--- openct.orig/Makefile	Sun Sep 16 17:03:05 2007
+++ openct/Makefile	Thu Apr 24 07:42:07 2008
@@ -1,9 +1,9 @@
-# $OpenBSD: Makefile,v 1.9 2007/09/15 23:29:59 merdely Exp $
+# $OpenBSD: Makefile,v 1.8 2006/12/16 12:22:34 espie Exp $
 
 COMMENT=	drivers for several smart card readers
 
-DISTNAME=	openct-0.6.6
-PKGNAME=	${DISTNAME}p3
+DISTNAME=	openct-0.6.14
+PKGNAME=	${DISTNAME}p0
 CATEGORIES=	security
 SHARED_LIBS=	openct	1.0
 
@@ -20,13 +20,12 @@
 MASTER_SITES=	http://www.opensc-project.org/files/openct/
 
 WANTLIB=	c pthread
-LIB_DEPENDS=	usb.>=8::devel/libusb \
-		ltdl.>=4::devel/libtool,-ltdl
+LIB_DEPENDS=	ltdl.>=4::devel/libtool,-ltdl
 
 USE_GMAKE=	Yes
 USE_LIBTOOL=	Yes
 
-CONFIGURE_STYLE=gnu old
+CONFIGURE_STYLE=gnu
 CONFIGURE_ARGS=	${CONFIGURE_SHARED} \
 		--enable-static \
 		--sysconfdir=${SYSCONFDIR} \
diff -urN openct.orig/distinfo openct/distinfo
--- openct.orig/distinfo	Thu Apr  5 11:26:07 2007
+++ openct/distinfo	Thu Apr 24 07:39:15 2008
@@ -1,5 +1,5 @@
-MD5 (openct-0.6.6.tar.gz) = qd47745eKCe41yoqUNC8Zg==
-RMD160 (openct-0.6.6.tar.gz) = y+ubWUrxuD5yHVUNyN4KASp4JDM=
-SHA1 (openct-0.6.6.tar.gz) = uhE3CY4zV4Y6VKukSkMGVnxRQcQ=
-SHA256 (openct-0.6.6.tar.gz) = c7V6yEKjC0BQfeLiytIO+4T8rzquSYI92W8uquxUEyw=
-SIZE (openct-0.6.6.tar.gz) = 563890
+MD5 (openct-0.6.14.tar.gz) = BKXAx97cscoNVQsZcPvztw==
+RMD160 (openct-0.6.14.tar.gz) = v3vytxG459NldJ02WTEUq6L+z20=
+SHA1 (openct-0.6.14.tar.gz) = pEMsadhzELxlNmaqQURHA8ZP8CQ=
+SHA256 (openct-0.6.14.tar.gz) = PfGH9j62aUZSCYI4vflnswTa2PYukhm+TPO21exdtYs=
+SIZE (openct-0.6.14.tar.gz) = 670510
diff -urN openct.orig/patches/patch-configure openct/patches/patch-configure
--- openct.orig/patches/patch-configure	Wed Dec 31 17:00:00 1969
+++ openct/patches/patch-configure	Tue Apr 22 06:36:09 2008
@@ -0,0 +1,24 @@
+$OpenBSD: patch-etc_openct_conf_in,v 1.1 2006/01/08 13:33:22 alek Exp $
+--- configure.orig	Tue Apr 22 13:48:53 2008
++++ configure	Tue Apr 22 13:48:25 2008
+@@ -22822,6 +22822,8 @@
+ 
+ fi
+ 
++case "$host" in
++*-*-linux*)
+ pkg_failed=no
+ { echo "$as_me:$LINENO: checking for LIBUSB_CFLAGS" >&5
+ echo $ECHO_N "checking for LIBUSB_CFLAGS... $ECHO_C" >&6; }
+@@ -22894,6 +22896,11 @@
+ 
+ 
+ fi
++;;
++*)
++        LIBUSB_MSG=no
++	;;
++esac
+ 
+ 
+ 
diff -urN openct.orig/patches/patch-src_ifd_sys-bsd_c openct/patches/patch-src_ifd_sys-bsd_c
--- openct.orig/patches/patch-src_ifd_sys-bsd_c	Thu Nov 24 05:23:04 2005
+++ openct/patches/patch-src_ifd_sys-bsd_c	Tue Apr 22 06:36:26 2008
@@ -1,34 +1,103 @@
-$OpenBSD: patch-src_ifd_sys-bsd_c,v 1.1 2005/11/24 12:23:04 markus Exp $
---- src/ifd/sys-bsd.c.orig	Sun Jun 12 11:35:17 2005
-+++ src/ifd/sys-bsd.c	Wed Nov 23 12:14:56 2005
-@@ -37,8 +37,10 @@ int ifd_sysdep_device_type(const char *n
+$OpenBSD: patch-etc_openct_conf_in,v 1.1 2006/01/08 13:33:22 alek Exp $
+--- src/ifd/sys-bsd.c.orig	Tue Apr 22 12:29:35 2008
++++ src/ifd/sys-bsd.c	Tue Apr 22 12:29:09 2008
+@@ -57,13 +57,19 @@
+ int open_ep(char *name, int interface, int endpoint, int flags)
+ {
+ 	char filename[256];
++	int rc;
++	int val;
  
- 	if (!strncmp(name, "/dev/ugen", 9)) {
- 		ifd_debug(1, "BSD: returning IFD_DEVICE_TYPE_USB");
-+#ifndef __OpenBSD__
- 		if (stat(name, &stb) < 0)
- 			return -1;
-+#endif
- 		return IFD_DEVICE_TYPE_USB;
+ 	if (interfaces[interface][endpoint].ep_fd) {
+ 		ifd_debug(6, "open_ep: endpoint already opened");
+ 		return 0;
  	}
  
-@@ -329,7 +331,19 @@ int ifd_sysdep_usb_release_interface(ifd
++#ifdef __OpenBSD__
++	sprintf((char *)&filename, "%s.%.2d", name, endpoint);
++#else
+ 	sprintf((char *)&filename, "%s.%d", name, endpoint);
++#endif /* __OpenBSD__ */
  
- int ifd_sysdep_usb_open(const char *device, int flags)
+ 	if ((interfaces[interface][endpoint].ep_fd = open(filename, flags)) < 0) {
+ 		ifd_debug(6, "open_ep: error opening \"%s\": %s", filename,
+@@ -71,6 +77,16 @@
+ 		interfaces[interface][endpoint].ep_fd = 0;
+ 		return -1;
+ 	}
++
++	if (!(flags & O_WRONLY)) {
++		val = 1;
++		if ((rc = ioctl(interfaces[interface][endpoint].ep_fd, USB_SET_SHORT_XFER, &val)) < 0) {
++			ifd_debug(1, "USB_SET_SHORT_XFER failed: %d", rc);
++			ct_error("usb_set_short_xfer failed: %s(%d)",
++				 strerror(errno), errno);
++		} 
++	}
++
+ 	return 0;
+ }
+ 
+@@ -94,11 +110,12 @@
+ 
+ 	ct_debug("ifd_sysdep_usb_bulk: endpoint=%d direction=%d", endpoint,
+ 		 direction);
+-	if (open_ep(dev->name, 0, endpoint, O_RDWR | O_NONBLOCK)) {
+-		ct_debug("ifd_sysdep_usb_bulk: opening endpoint failed");
+-		return -1;
+-	}
+ 	if (direction) {
++		if (open_ep(dev->name, 0, endpoint, O_RDONLY | O_NONBLOCK)) {
++			ct_debug("ifd_sysdep_usb_bulk: opening endpoint failed");
++			return -1;
++		}
++
+ 		if ((bytes_to_process =
+ 		     read(interfaces[0][endpoint].ep_fd, buffer, len)) < 0) {
+ 			ifd_debug(6, "ifd_sysdep_usb_bulk: read failed: %s",
+@@ -110,6 +127,11 @@
+ 			 bytes_to_process);
+ 		return bytes_to_process;
+ 	} else {
++		if (open_ep(dev->name, 0, endpoint, O_WRONLY | O_NONBLOCK)) {
++			ct_debug("ifd_sysdep_usb_bulk: opening endpoint failed");
++			return -1;
++		}
++
+ 		bytes_to_process = len;
+ 		if ((bytes_processed =
+ 		     write(interfaces[0][endpoint].ep_fd, buffer,
+@@ -314,7 +336,19 @@
+ 
+ int ifd_sysdep_usb_open(const char *device)
  {
 +#ifdef __OpenBSD__
 +	char *path;
 +	int fd;
 +
-+        if (asprintf(&path, "%s.00", device) < 0)
-+                return -1;
++	if (asprintf(&path, "%s.00", device) < 0)
++		return -1;
 +	ifd_debug(1, "BSD: ifd_sysdep_usb_open(%s)", path);
-+	fd = open(path, O_EXCL | O_RDWR);
++	fd = open(path, O_RDWR);
 +	free(path);
 +	return fd;
 +#else
- 	return open(device, O_EXCL | O_RDWR);
-+#endif
+ 	return open(device, O_RDWR);
++#endif /* __OpenBSD__ */
  }
  
- /*
+ int ifd_sysdep_usb_reset(ifd_device_t * dev)
+@@ -384,13 +418,8 @@
+ 
+ 			if (!(driver = ifd_driver_for_id(&id)))
+ 				continue;
+-#ifdef __OpenBSD__
+-			snprintf(typedev, sizeof(typedev),
+-				 "usb:/dev/%s.00", device_info.udi_devnames[0]);
+-#else
+ 			snprintf(typedev, sizeof(typedev),
+ 				 "usb:/dev/%s", device_info.udi_devnames[0]);
+-#endif				/* __OpenBSD__ */
+ 
+ 			ifd_spawn_handler(driver, typedev, -1);
+ 		}
diff -urN openct.orig/pkg/PLIST openct/pkg/PLIST
--- openct.orig/pkg/PLIST	Tue Oct  4 15:58:54 2005
+++ openct/pkg/PLIST	Thu Apr 24 05:07:59 2008
@@ -12,6 +12,7 @@
 include/openct/ifd.h
 include/openct/logging.h
 include/openct/openct.h
+include/openct/path.h
 include/openct/protocol.h
 include/openct/server.h
 include/openct/socket.h
@@ -32,5 +33,5 @@
 @mode 644
 @sample ${SYSCONFDIR}/openct.conf
 @mode 755
[EMAIL PROTECTED] /var/run/openct/
[EMAIL PROTECTED] rm -rf /var/run/openct/*
[EMAIL PROTECTED] mkdir -m 755 -p /var/run/openct
[EMAIL PROTECTED] rm -rf /var/run/openct

Reply via email to