aboutsummaryrefslogtreecommitdiffstats
path: root/security/opensc
diff options
context:
space:
mode:
authorale <ale@FreeBSD.org>2010-06-28 15:40:42 +0800
committerale <ale@FreeBSD.org>2010-06-28 15:40:42 +0800
commit089fd1c88a37ec92843174cb4250deaef7d3ab55 (patch)
tree60d49f0caa6e6ff5a4b520004d3cb51b849873b9 /security/opensc
parent294478ad8547d330e49f5813b119fd36a618af69 (diff)
downloadfreebsd-ports-gnome-089fd1c88a37ec92843174cb4250deaef7d3ab55.tar.gz
freebsd-ports-gnome-089fd1c88a37ec92843174cb4250deaef7d3ab55.tar.zst
freebsd-ports-gnome-089fd1c88a37ec92843174cb4250deaef7d3ab55.zip
Even if opensc 0.12.x will drop signer plugin, update it to use libassuan2.
PR: ports/148164 Submitted by: lioux Feature safe: yes
Diffstat (limited to 'security/opensc')
-rw-r--r--security/opensc/Makefile9
-rw-r--r--security/opensc/files/patch-src_signer_dialog.c97
2 files changed, 104 insertions, 2 deletions
diff --git a/security/opensc/Makefile b/security/opensc/Makefile
index f46e63a2d4bc..4b4a8647acbe 100644
--- a/security/opensc/Makefile
+++ b/security/opensc/Makefile
@@ -19,6 +19,9 @@ OPTIONS= OPENCT "Enable direct OpenCT backend support" on \
PCSC "Enable PC/SC backend support" off \
SIGNER "Enable signer browser plugin" off
+LICENSE= LGPL21
+LICENSE_FILE= ${WRKSRC}/COPYING
+
USE_AUTOTOOLS= libltdl:22
USE_ICONV= yes
USE_OPENSSL= yes
@@ -76,11 +79,11 @@ CONFIGURE_ARGS+=--enable-pcsc
.endif
.if defined(WITH_SIGNER)
-BUILD_DEPENDS+= ${LOCALBASE}/lib/libassuan.a:${PORTSDIR}/security/libassuan-1
+LIB_DEPENDS+= assuan.0:${PORTSDIR}/security/libassuan
PINENTRY?= ${LOCALBASE}/bin/pinentry
PINENTRY_PORT?= security/pinentry
RUN_DEPENDS+= pinentry:${PORTSDIR}/${PINENTRY_PORT}
-USE_XORG= x11
+USE_XORG= x11 xt
CONFIGURE_ARGS+=--enable-nsplugin \
--with-libassuan-prefix=${LOCALBASE} \
--with-plugindir=${WEBPLUGINS_DIR} \
@@ -101,6 +104,8 @@ CONFIGURE_ARGS+=--enable-doc
post-patch:
@${REINPLACE_CMD} 's|(libdir)/pkgconfig|(prefix)/libdata/pkgconfig|' \
${WRKSRC}/configure
+ @${REINPLACE_CMD} 's|tmp=1:0\.9\.2|tmp=2:2.0.0|' \
+ ${WRKSRC}/configure
.if !defined(WITH_SIGNER)
@${REINPLACE_CMD} 's|install-data-am: install-pluginDATA|install-data-am:|' \
${WRKSRC}/src/signer/Makefile.in
diff --git a/security/opensc/files/patch-src_signer_dialog.c b/security/opensc/files/patch-src_signer_dialog.c
new file mode 100644
index 000000000000..c70406a21bfa
--- /dev/null
+++ b/security/opensc/files/patch-src_signer_dialog.c
@@ -0,0 +1,97 @@
+--- src/signer/dialog.c.orig 2010-02-16 07:03:25.000000000 -0200
++++ src/signer/dialog.c 2010-06-26 06:42:17.000000000 -0300
+@@ -15,31 +15,31 @@
+ char *buffer;
+ };
+
+-static AssuanError
++static gpg_error_t
+ getpin_cb (void *opaque, const void *buffer, size_t length)
+ {
+ struct entry_parm_s *parm = (struct entry_parm_s *) opaque;
+
+ /* we expect the pin to fit on one line */
+ if (parm->lines || length >= parm->size)
+- return ASSUAN_Too_Much_Data;
++ return gpg_error(GPG_ERR_ASS_TOO_MUCH_DATA);
+
+ /* fixme: we should make sure that the assuan buffer is allocated in
+ secure memory or read the response byte by byte */
+ memcpy(parm->buffer, buffer, length);
+ parm->buffer[length] = 0;
+ parm->lines++;
+- return (AssuanError) 0;
++ return gpg_error(GPG_ERR_NO_ERROR);
+ }
+
+ int ask_and_verify_pin_code(struct sc_pkcs15_card *p15card,
+ struct sc_pkcs15_object *pin)
+ {
+- int r;
++ gpg_error_t r;
+ size_t len;
+ const char *argv[3];
+ const char *pgmname = PIN_ENTRY;
+- ASSUAN_CONTEXT ctx;
++ assuan_context_t ctx = NULL;
+ char buf[500];
+ char errtext[100];
+ struct entry_parm_s parm;
+@@ -48,16 +48,26 @@
+ argv[0] = pgmname;
+ argv[1] = NULL;
+
+- r = assuan_pipe_connect(&ctx, pgmname, (char **) argv, NULL);
++ assuan_set_gpg_err_source (GPG_ERR_SOURCE_DEFAULT);
++
++ r = assuan_new(&ctx);
++ if (r) {
++ printf("Can't initialize assuan context: %s\n)",
++ gpg_strerror(r));
++ goto err;
++ }
++
++ r = assuan_pipe_connect(ctx, pgmname, (const char **) argv, \
++ NULL, NULL, NULL, 0);
+ if (r) {
+ printf("Can't connect to the PIN entry module: %s\n",
+- assuan_strerror((AssuanError) r));
++ gpg_strerror(r));
+ goto err;
+ }
+ sprintf(buf, "SETDESC Enter PIN [%s] for digital signing ", pin->label);
+ r = assuan_transact(ctx, buf, NULL, NULL, NULL, NULL, NULL, NULL);
+ if (r) {
+- printf("SETDESC: %s\n", assuan_strerror((AssuanError) r));
++ printf("SETDESC: %s\n", gpg_strerror(r));
+ goto err;
+ }
+ errtext[0] = 0;
+@@ -71,12 +81,12 @@
+ parm.size = sizeof(buf);
+ parm.buffer = buf;
+ r = assuan_transact(ctx, "GETPIN", getpin_cb, &parm, NULL, NULL, NULL, NULL);
+- if (r == ASSUAN_Canceled) {
+- assuan_disconnect(ctx);
++ if (gpg_err_code(r) == GPG_ERR_ASS_CANCELED) {
++ assuan_release(ctx);
+ return -2;
+ }
+ if (r) {
+- printf("GETPIN: %s\n", assuan_strerror((AssuanError) r));
++ printf("GETPIN: %s\n", gpg_strerror(r));
+ goto err;
+ }
+ len = strlen(buf);
+@@ -104,9 +114,9 @@
+ break;
+ }
+
+- assuan_disconnect(ctx);
++ assuan_release(ctx);
+ return 0;
+ err:
+- assuan_disconnect(ctx);
++ assuan_release(ctx);
+ return -1;
+ }