From e28d70e47ae3cd865b433ace79b6abd7826fc545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Wed, 5 Jan 2011 23:42:10 +0100 Subject: [PATCH] Install udev rules pcscd 0.6.6 is designed to run under restricted user. The rules for udev subsystems adjusts token USB device permissions to be accessible by the restricted used pcscd is running under. XXX: The udev rules file has been copied from LGPL licensed CCID driver, thus this commit poisons BSD sources with LGPL license. --- 92_pcscd_asekey.rules | 21 +++++++++++++++++++++ Makefile | 3 +++ configure | 10 ++++++++++ 3 files changed, 34 insertions(+), 0 deletions(-) create mode 100644 92_pcscd_asekey.rules diff --git a/92_pcscd_asekey.rules b/92_pcscd_asekey.rules new file mode 100644 index 0000000..ddc7939 --- /dev/null +++ b/92_pcscd_asekey.rules @@ -0,0 +1,21 @@ +# udev rules to set the access rights of Asekey tokens so they can be used +# by pcscd. +# +# File stolen from CCID driver. +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at +# your option) any later version. + +# If not adding the device, go away +ACTION!="add", GOTO="pcscd_asekey_rules_end" +SUBSYSTEM!="usb", GOTO="pcscd_asekey_rules_end" +ENV{DEVTYPE}!="usb_device", GOTO="pcscd_asekey_rules_end" + +# Asekey 0x1701 +ATTRS{idVendor}=="0dc3", ATTRS{idProduct}=="1701", GROUP="pcscd" +# Asekey 0x1702 +ATTRS{idVendor}=="0dc3", ATTRS{idProduct}=="1702", GROUP="pcscd" + +# All done +LABEL="pcscd_asekey_rules_end" diff --git a/Makefile b/Makefile index 0d2566e..ce5d20b 100755 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ include Makefile.inc DRIVER_DIR=${DESTDIR}/${USBDROPDIR}/ifd-ASEKey.bundle +UDEV_DIR=${DESTDIR}/${UDEVDIR} CC=${BUILD}-gcc @@ -29,3 +30,5 @@ install: all install -c -d "${DRIVER_DIR}/Contents/${KERNEL_NAME}" install -c -m 0644 Info.plist "${DRIVER_DIR}/Contents/" install -c -m 0755 libASEKey.so "${DRIVER_DIR}/Contents/${KERNEL_NAME}" + install -c -d "${UDEV_DIR}" + install -c -m 0644 92_pcscd_asekey.rules "${UDEV_DIR}" diff --git a/configure b/configure index b21131c..2408edc 100755 --- a/configure +++ b/configure @@ -9,6 +9,7 @@ BUILD= PCSC_HEADERS= PCSC_LIBS= PKCS11_MODULE= +UDEVDIR= for p in $*; do v=${p#*=} @@ -28,6 +29,9 @@ for p in $*; do --with-pcsc-libs=*) PCSC_LIBS="$v" ;; + --with-udev-rules-dir=*) + UDEVDIR="$v" + ;; --build=*) BUILD="$v" ;; @@ -42,6 +46,7 @@ if [ ${USAGE} != 0 ]; then echo -e "\t--with-pcsc-drivers-dir=dir\tSet pcsc drivers directory." echo -e "\t--with-pcsc-headers=dir\t\tSet manual pcsc headers directory." echo -e "\t--with-pcsc-libs=dir\t\tSet manual pcsc library dir." + echo -e "\t--with-udev-rules-dir=dir\t\tSet manual udev rules dir." exit 1 fi @@ -54,6 +59,10 @@ if [ -z "$USBDROPDIR" ]; then exit 1 fi +if [ -z "$UDEVDIR" ]; then + UDEVDIR="/lib/udev/rules.d" +fi + if [ -z "$PCSC_HEADERS" ]; then CFLAGS="$CFLAGS `pkg-config libpcsclite --cflags`" else @@ -68,6 +77,7 @@ fi echo "PREFIX=${PREFIX}" > Makefile.inc echo "USBDROPDIR=${USBDROPDIR}" >> Makefile.inc +echo "UDEVDIR=${UDEVDIR}" >> Makefile.inc echo "BUILD=${BUILD}" >> Makefile.inc echo "CFLAGS=${CFLAGS}" >> Makefile.inc echo "LDFLAGS=${LDFLAGS}" >> Makefile.inc -- 1.7.3.4