summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonnie Berkholz <dberkholz@gentoo.org>2006-09-06 05:23:39 +0000
committerDonnie Berkholz <dberkholz@gentoo.org>2006-09-06 05:23:39 +0000
commite635c98d736bc0ab2725d51ead0069fc96c4ab1f (patch)
treeae08667860cb49a6c35e5911ca587cbde47f6b98 /sys-auth
parentRemoving all mips keywords except from latest stable to fix mips dependencies... (diff)
downloadhistorical-e635c98d736bc0ab2725d51ead0069fc96c4ab1f.tar.gz
historical-e635c98d736bc0ab2725d51ead0069fc96c4ab1f.tar.bz2
historical-e635c98d736bc0ab2725d51ead0069fc96c4ab1f.zip
(#146477) Revision bump to install an easy setup tool, which is also required for app-admin/authconfig to work with this. Committed with approval of dragonheart.
Package-Manager: portage-2.1.1_rc1-r4
Diffstat (limited to 'sys-auth')
-rw-r--r--sys-auth/pam_pkcs11/ChangeLog10
-rw-r--r--sys-auth/pam_pkcs11/Manifest29
-rw-r--r--sys-auth/pam_pkcs11/files/digest-pam_pkcs11-0.5.3-r13
-rw-r--r--sys-auth/pam_pkcs11/files/pam_pkcs11-0.5.3-setup-tool.patch629
-rw-r--r--sys-auth/pam_pkcs11/pam_pkcs11-0.5.3-r1.ebuild49
5 files changed, 705 insertions, 15 deletions
diff --git a/sys-auth/pam_pkcs11/ChangeLog b/sys-auth/pam_pkcs11/ChangeLog
index 6f4008ec2558..a34fea12bec7 100644
--- a/sys-auth/pam_pkcs11/ChangeLog
+++ b/sys-auth/pam_pkcs11/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for sys-auth/pam_pkcs11
# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-auth/pam_pkcs11/ChangeLog,v 1.2 2006/06/12 13:51:21 kingtaco Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-auth/pam_pkcs11/ChangeLog,v 1.3 2006/09/06 05:23:39 dberkholz Exp $
+
+*pam_pkcs11-0.5.3-r1 (06 Sep 2006)
+
+ 06 Sep 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+ +files/pam_pkcs11-0.5.3-setup-tool.patch, +pam_pkcs11-0.5.3-r1.ebuild:
+ (#146477) Revision bump to install an easy setup tool, which is also
+ required for app-admin/authconfig to work with this. Committed with approval
+ of dragonheart.
12 Jun 2006; Mike Doty <kingtaco@gentoo.org> pam_pkcs11-0.5.3.ebuild:
marked ~amd64
diff --git a/sys-auth/pam_pkcs11/Manifest b/sys-auth/pam_pkcs11/Manifest
index 567758025696..7b01ef3616d7 100644
--- a/sys-auth/pam_pkcs11/Manifest
+++ b/sys-auth/pam_pkcs11/Manifest
@@ -1,15 +1,20 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
+AUX pam_pkcs11-0.5.3-setup-tool.patch 18150 RMD160 8336813c77b8cfd2356ad06ce85679e4faf2d426 SHA1 abc4a1980580c9f651768c3458613efe9e0d5d4c SHA256 6727222ec09124506923f0fe1ae8dfd4797bd86d3a1d1634cf0d3cb9305e5fcb
+MD5 c55104d841aea80d9fd2b6993da3e8fd files/pam_pkcs11-0.5.3-setup-tool.patch 18150
+RMD160 8336813c77b8cfd2356ad06ce85679e4faf2d426 files/pam_pkcs11-0.5.3-setup-tool.patch 18150
+SHA256 6727222ec09124506923f0fe1ae8dfd4797bd86d3a1d1634cf0d3cb9305e5fcb files/pam_pkcs11-0.5.3-setup-tool.patch 18150
DIST pam_pkcs11-0.5.3.tar.gz 576432 RMD160 b755b1d5d8c666a44944119df74515a206efc1cd SHA1 b57dec1ef358f36ba1e38611f37de87f752da6b7 SHA256 f38a92ad5822b5da1bef7c74bfbce1ab1b9a59b01c207b3c3e92402f6be985a4
+EBUILD pam_pkcs11-0.5.3-r1.ebuild 1196 RMD160 4ab23a0bb736551b68771c8f09bac14e02ec6c5e SHA1 ea99d1e00c1d0cf2b485ec80a79a7c4ef099921c SHA256 18a58ff36b043dfd77190b7b220c9e996a3fe8228a6bcca847880415357dd8d6
+MD5 a8933947bcb8dbff4d665f55f8b97712 pam_pkcs11-0.5.3-r1.ebuild 1196
+RMD160 4ab23a0bb736551b68771c8f09bac14e02ec6c5e pam_pkcs11-0.5.3-r1.ebuild 1196
+SHA256 18a58ff36b043dfd77190b7b220c9e996a3fe8228a6bcca847880415357dd8d6 pam_pkcs11-0.5.3-r1.ebuild 1196
EBUILD pam_pkcs11-0.5.3.ebuild 1028 RMD160 1c0b1bfb5468caf5d8365725bf0dfe37ea7d1e95 SHA1 a99275d97efda7ea03c6a0609c422682b0a7d7bf SHA256 00e8c00a741ca087e90057e3364ffacf757fd568cdc45e4f3cf6dd41058e4be0
MD5 b42369c47f5787ed2e035859e20a919e pam_pkcs11-0.5.3.ebuild 1028
RMD160 1c0b1bfb5468caf5d8365725bf0dfe37ea7d1e95 pam_pkcs11-0.5.3.ebuild 1028
SHA256 00e8c00a741ca087e90057e3364ffacf757fd568cdc45e4f3cf6dd41058e4be0 pam_pkcs11-0.5.3.ebuild 1028
-MISC ChangeLog 1118 RMD160 14a115745fc37ff34ef0e0fbaaa049e69960d738 SHA1 25a23251f2be657a156534af88a37a7a7f85522f SHA256 b2d54c91f87258275f9a7de806de4e68c38a33cfef11065d8957864b52418a31
-MD5 8c9120f3e95215d728a9bf1a5f62f45e ChangeLog 1118
-RMD160 14a115745fc37ff34ef0e0fbaaa049e69960d738 ChangeLog 1118
-SHA256 b2d54c91f87258275f9a7de806de4e68c38a33cfef11065d8957864b52418a31 ChangeLog 1118
+MISC ChangeLog 1452 RMD160 b1f72fa8c7b7a6ccf742477b6c4b3937f1605a54 SHA1 47e87a2140a6d6cb56a56bf8bb09cdff908ac4c9 SHA256 481cbf5ed5e22aae7b7d11c22d1aeea3c0e2809ccae132b4b4ed1d70598c80e5
+MD5 93b0bac29360d1cb739675b2bd8bef8f ChangeLog 1452
+RMD160 b1f72fa8c7b7a6ccf742477b6c4b3937f1605a54 ChangeLog 1452
+SHA256 481cbf5ed5e22aae7b7d11c22d1aeea3c0e2809ccae132b4b4ed1d70598c80e5 ChangeLog 1452
MISC metadata.xml 248 RMD160 d300a6a39cab5cfc836dd8154166ea93795e7682 SHA1 651e99b4c63f219da583fdc286e904f57bfa7741 SHA256 cab631a70b543455c36e9f6125586ae2421fb453f6b20a158fcdd7317b57f2aa
MD5 59af1ba132e999b7d1c7b6d42ed4b1e7 metadata.xml 248
RMD160 d300a6a39cab5cfc836dd8154166ea93795e7682 metadata.xml 248
@@ -17,10 +22,6 @@ SHA256 cab631a70b543455c36e9f6125586ae2421fb453f6b20a158fcdd7317b57f2aa metadata
MD5 a1d272550e9712942c24bb1134c1ec6e files/digest-pam_pkcs11-0.5.3 250
RMD160 208f742203b5d2bb4cc5f9ead22f061e71d0cfb0 files/digest-pam_pkcs11-0.5.3 250
SHA256 4639d6c891b6a1f55fc9f4d5a769f1624594a68c0d85062e782eacbf2fb98e05 files/digest-pam_pkcs11-0.5.3 250
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.4 (GNU/Linux)
-
-iD8DBQFEqHPkamhnQswr0vIRAks3AKC3ya6SUdqaUKnTtKbtULDKCBXe+QCeNA7h
-2kRlQ5yJINtGGN88s8++hdc=
-=lFBV
------END PGP SIGNATURE-----
+MD5 a1d272550e9712942c24bb1134c1ec6e files/digest-pam_pkcs11-0.5.3-r1 250
+RMD160 208f742203b5d2bb4cc5f9ead22f061e71d0cfb0 files/digest-pam_pkcs11-0.5.3-r1 250
+SHA256 4639d6c891b6a1f55fc9f4d5a769f1624594a68c0d85062e782eacbf2fb98e05 files/digest-pam_pkcs11-0.5.3-r1 250
diff --git a/sys-auth/pam_pkcs11/files/digest-pam_pkcs11-0.5.3-r1 b/sys-auth/pam_pkcs11/files/digest-pam_pkcs11-0.5.3-r1
new file mode 100644
index 000000000000..ebb86f13b7a4
--- /dev/null
+++ b/sys-auth/pam_pkcs11/files/digest-pam_pkcs11-0.5.3-r1
@@ -0,0 +1,3 @@
+MD5 607e3ba84b8938eff20c51c597e522c0 pam_pkcs11-0.5.3.tar.gz 576432
+RMD160 b755b1d5d8c666a44944119df74515a206efc1cd pam_pkcs11-0.5.3.tar.gz 576432
+SHA256 f38a92ad5822b5da1bef7c74bfbce1ab1b9a59b01c207b3c3e92402f6be985a4 pam_pkcs11-0.5.3.tar.gz 576432
diff --git a/sys-auth/pam_pkcs11/files/pam_pkcs11-0.5.3-setup-tool.patch b/sys-auth/pam_pkcs11/files/pam_pkcs11-0.5.3-setup-tool.patch
new file mode 100644
index 000000000000..78e9cfe6fd77
--- /dev/null
+++ b/sys-auth/pam_pkcs11/files/pam_pkcs11-0.5.3-setup-tool.patch
@@ -0,0 +1,629 @@
+--- pam_pkcs11-0.5.3/src/tools/Makefile.am.setup 2006-07-07 13:46:34.000000000 +0200
++++ pam_pkcs11-0.5.3/src/tools/Makefile.am 2006-07-07 13:46:34.000000000 +0200
+@@ -8,11 +8,11 @@
+ AM_LDFLAGS = $(PCSC_LIBS)
+
+ if HAVE_PCSC
+-bin_PROGRAMS = card_eventmgr pkcs11_eventmgr pklogin_finder pkcs11_inspect
++bin_PROGRAMS = card_eventmgr pkcs11_eventmgr pklogin_finder pkcs11_inspect pkcs11_setup
+ card_eventmgr_SOURCES = card_eventmgr.c
+ card_eventmgr_LDADD = @LIBSCCONF@ @LIBCOMMON@
+ else
+-bin_PROGRAMS = pkcs11_eventmgr pklogin_finder pkcs11_inspect
++bin_PROGRAMS = pkcs11_eventmgr pklogin_finder pkcs11_inspect pkcs11_setup
+ endif
+
+ pklogin_finder_SOURCES = pklogin_finder.c
+@@ -23,3 +23,6 @@
+
+ pkcs11_inspect_SOURCES = pkcs11_inspect.c
+ pkcs11_inspect_LDADD = $(FINDER_OBJS) @LIBMAPPERS@
++
++pkcs11_setup_SOURCES = pkcs11_setup.c
++pkcs11_setup_LDADD = @LIBSCCONF@ @LIBCOMMON@
+--- pam_pkcs11-0.5.3/src/tools/Makefile.in.setup 2006-07-07 13:46:34.000000000 +0200
++++ pam_pkcs11-0.5.3/src/tools/Makefile.in 2006-07-07 13:46:34.000000000 +0200
+@@ -16,7 +16,7 @@
+
+ # Process this file with automake to create Makefile.in
+
+-SOURCES = $(card_eventmgr_SOURCES) $(pkcs11_eventmgr_SOURCES) $(pkcs11_inspect_SOURCES) $(pklogin_finder_SOURCES)
++SOURCES = $(card_eventmgr_SOURCES) $(pkcs11_eventmgr_SOURCES) $(pkcs11_inspect_SOURCES) $(pkcs11_setup_SOURCES) $(pklogin_finder_SOURCES)
+
+ srcdir = @srcdir@
+ top_srcdir = @top_srcdir@
+@@ -43,11 +43,11 @@
+ target_triplet = @target@
+ @HAVE_PCSC_FALSE@bin_PROGRAMS = pkcs11_eventmgr$(EXEEXT) \
+ @HAVE_PCSC_FALSE@ pklogin_finder$(EXEEXT) \
+-@HAVE_PCSC_FALSE@ pkcs11_inspect$(EXEEXT)
++@HAVE_PCSC_FALSE@ pkcs11_inspect$(EXEEXT) pkcs11_setup$(EXEEXT)
+ @HAVE_PCSC_TRUE@bin_PROGRAMS = card_eventmgr$(EXEEXT) \
+ @HAVE_PCSC_TRUE@ pkcs11_eventmgr$(EXEEXT) \
+ @HAVE_PCSC_TRUE@ pklogin_finder$(EXEEXT) \
+-@HAVE_PCSC_TRUE@ pkcs11_inspect$(EXEEXT)
++@HAVE_PCSC_TRUE@ pkcs11_inspect$(EXEEXT) pkcs11_setup$(EXEEXT)
+ subdir = src/tools
+ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+@@ -73,6 +73,9 @@
+ am__DEPENDENCIES_2 = ../pam_pkcs11/mapper_mgr.o \
+ ../pam_pkcs11/pam_config.o
+ pkcs11_inspect_DEPENDENCIES = $(am__DEPENDENCIES_2)
++am_pkcs11_setup_OBJECTS = pkcs11_setup.$(OBJEXT)
++pkcs11_setup_OBJECTS = $(am_pkcs11_setup_OBJECTS)
++pkcs11_setup_DEPENDENCIES =
+ am_pklogin_finder_OBJECTS = pklogin_finder.$(OBJEXT)
+ pklogin_finder_OBJECTS = $(am_pklogin_finder_OBJECTS)
+ pklogin_finder_DEPENDENCIES = $(am__DEPENDENCIES_2)
+@@ -88,10 +91,11 @@
+ LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+ SOURCES = $(card_eventmgr_SOURCES) $(pkcs11_eventmgr_SOURCES) \
+- $(pkcs11_inspect_SOURCES) $(pklogin_finder_SOURCES)
++ $(pkcs11_inspect_SOURCES) $(pkcs11_setup_SOURCES) \
++ $(pklogin_finder_SOURCES)
+ DIST_SOURCES = $(am__card_eventmgr_SOURCES_DIST) \
+ $(pkcs11_eventmgr_SOURCES) $(pkcs11_inspect_SOURCES) \
+- $(pklogin_finder_SOURCES)
++ $(pkcs11_setup_SOURCES) $(pklogin_finder_SOURCES)
+ ETAGS = etags
+ CTAGS = ctags
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+@@ -188,6 +192,7 @@
+ ac_ct_F77 = @ac_ct_F77@
+ ac_ct_RANLIB = @ac_ct_RANLIB@
+ ac_ct_STRIP = @ac_ct_STRIP@
++ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
+ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+@@ -241,6 +246,8 @@
+ pkcs11_eventmgr_LDADD = @LIBSCCONF@ @LIBCOMMON@ $(CRYPTO_LIBS)
+ pkcs11_inspect_SOURCES = pkcs11_inspect.c
+ pkcs11_inspect_LDADD = $(FINDER_OBJS) @LIBMAPPERS@
++pkcs11_setup_SOURCES = pkcs11_setup.c
++pkcs11_setup_LDADD = @LIBSCCONF@ @LIBCOMMON@
+ all: all-am
+
+ .SUFFIXES:
+@@ -311,6 +318,9 @@
+ pkcs11_inspect$(EXEEXT): $(pkcs11_inspect_OBJECTS) $(pkcs11_inspect_DEPENDENCIES)
+ @rm -f pkcs11_inspect$(EXEEXT)
+ $(LINK) $(pkcs11_inspect_LDFLAGS) $(pkcs11_inspect_OBJECTS) $(pkcs11_inspect_LDADD) $(LIBS)
++pkcs11_setup$(EXEEXT): $(pkcs11_setup_OBJECTS) $(pkcs11_setup_DEPENDENCIES)
++ @rm -f pkcs11_setup$(EXEEXT)
++ $(LINK) $(pkcs11_setup_LDFLAGS) $(pkcs11_setup_OBJECTS) $(pkcs11_setup_LDADD) $(LIBS)
+ pklogin_finder$(EXEEXT): $(pklogin_finder_OBJECTS) $(pklogin_finder_DEPENDENCIES)
+ @rm -f pklogin_finder$(EXEEXT)
+ $(LINK) $(pklogin_finder_LDFLAGS) $(pklogin_finder_OBJECTS) $(pklogin_finder_LDADD) $(LIBS)
+@@ -324,6 +334,7 @@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/card_eventmgr.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkcs11_eventmgr.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkcs11_inspect.Po@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkcs11_setup.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pklogin_finder.Po@am__quote@
+
+ .c.o:
+--- /dev/null 2006-07-07 08:05:54.592713000 +0200
++++ pam_pkcs11-0.5.3/src/tools/pkcs11_setup.c 2006-07-07 13:54:45.000000000 +0200
+@@ -0,0 +1,519 @@
++/*
++ * PKCS#11 Card viewer tool
++ * Copyright (C) 2006 Red Hat, Inc.
++ *
++ * This library 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.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Lesser General Public License for more details.
++ *
++ */
++
++#define _GNU_SOURCE
++
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
++#include <ctype.h>
++#include <string.h>
++#include <errno.h>
++#include <unistd.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <dlfcn.h>
++#include "../scconf/scconf.h"
++#include "../common/debug.h"
++#include "../common/error.h"
++
++#define PAM_PKCS11_CONF "/etc/pam_pkcs11/pam_pkcs11.conf"
++#define EVENTMGR_CONF "/etc/pam_pkcs11/pkcs11_eventmgr.conf"
++
++static const char Ins_action[] = "ins_action=";
++static const char Rm_action[] = "rm_action=";
++static const char Use_module[] = "use_module=";
++static const char List_modules[] = "list_modules";
++
++enum params { INS_ACTION, RM_ACTION, USE_MODULE, LIST_MODULES };
++
++static const char const *param_names[] = { Ins_action, Rm_action, Use_module, List_modules };
++static int pn_sizes[] = { sizeof(Ins_action), sizeof(Rm_action), sizeof(Use_module), sizeof(List_modules) };
++
++#define NUM_PARAMS (sizeof(param_names)/sizeof(param_names[0]))
++
++const char *scconf_replace_str(scconf_block * block, const char *option, const char *value)
++{
++ scconf_list *list = NULL;
++ scconf_item *item;
++
++ scconf_list_add(&list, value);
++ item = scconf_item_add(NULL, block, NULL, SCCONF_ITEM_TYPE_VALUE, option, list);
++
++ /* now clear out the item list */
++ scconf_list_destroy(item->value.list);
++ item->value.list = list; /* adopt */
++ return value;
++}
++
++int scconf_replace_str_list(scconf_block * block, const char *option, const char *value)
++{
++ scconf_list *list = NULL;
++ scconf_item *item;
++ char *lstitem = NULL;
++ char *next;
++
++ while (value != NULL) {
++ if ((next=strchr(value, ',')) != NULL) {
++ lstitem = strndup(value, next-value);
++ next++;
++ }
++ else {
++ lstitem = strdup(value);
++ }
++ if (lstitem == NULL)
++ return 1;
++ scconf_list_add(&list, lstitem);
++ value = next;
++ free(lstitem);
++ }
++
++ item = scconf_item_add(NULL, block, NULL, SCCONF_ITEM_TYPE_VALUE, option, list);
++
++ /* now clear out the item list */
++ scconf_list_destroy(item->value.list);
++ item->value.list = list; /* adopt */
++ return 0;
++}
++
++int list_modules(void)
++{
++ const scconf_block *pam_pkcs11;
++ scconf_block **pkcs11_blocks;
++ scconf_context *ctx = NULL;
++ int i;
++ int result = 1;
++
++ /*
++ * loop through looking for smart card entries
++ */
++ ctx = scconf_new(PAM_PKCS11_CONF);
++ if (ctx == NULL) {
++ goto bail;
++ }
++ if (scconf_parse(ctx) <= 0 ) {
++ goto bail;
++ }
++ pam_pkcs11 = scconf_find_block(ctx, NULL, "pam_pkcs11");
++ if (!pam_pkcs11) {
++ goto bail;
++ }
++ pkcs11_blocks = scconf_find_blocks(ctx, pam_pkcs11, "pkcs11_module", NULL);
++ if (!pkcs11_blocks) {
++ goto bail;
++ }
++
++ /* list only those smart cards which are actually installed */
++ for (i=0; pkcs11_blocks[i]; i++) {
++ void *libhandle;
++ const char *path =
++ scconf_get_str(pkcs11_blocks[i], "module", NULL);
++ /* check to see if the module exists on the system */
++ if (!path || *path == 0) {
++ continue;
++ }
++ /* verify the module exists */
++ if ((libhandle=dlopen(path, RTLD_LAZY)) != NULL) {
++ dlclose(libhandle);
++ if (pkcs11_blocks[i] && pkcs11_blocks[i]->name
++ && pkcs11_blocks[i]->name->data) {
++ printf("%s\n", pkcs11_blocks[i]->name->data);
++ }
++ }
++ }
++
++ result = 0;
++
++bail:
++ if (ctx) {
++ scconf_free(ctx);
++ }
++ return result;
++}
++
++int print_default_module(void)
++{
++ const scconf_block *pam_pkcs11;
++ scconf_context *ctx = NULL;
++ int result = 1;
++
++ /*
++ * read the base pam_pkcs11.conf
++ */
++ ctx = scconf_new(PAM_PKCS11_CONF);
++ if (ctx == NULL) {
++ goto bail;
++ }
++ if (scconf_parse(ctx) <= 0) {
++ goto bail;
++ }
++ pam_pkcs11 = scconf_find_block(ctx, NULL, "pam_pkcs11");
++ if (!pam_pkcs11) {
++ goto bail;
++ }
++ printf("%s\n", scconf_get_str(pam_pkcs11, "use_pkcs11_module", ""));
++ result = 0;
++
++ bail:
++ if (ctx) {
++ scconf_free(ctx);
++ }
++ ctx = NULL;
++
++ return result;
++}
++
++int set_default_module(const char *mod)
++{
++ scconf_block *pam_pkcs11, *pkcs11_eventmgr;
++ scconf_block **modules = NULL;
++ scconf_context *ctx = NULL;
++ scconf_context *ectx = NULL;
++ const char *lib = NULL;
++ int result = 1;
++
++ /*
++ * write out pam_pkcs11.conf
++ */
++ ctx = scconf_new(PAM_PKCS11_CONF);
++ if (ctx == NULL) {
++ goto bail;
++ }
++ if (scconf_parse(ctx) <= 0) {
++ goto bail;
++ }
++ pam_pkcs11 = (scconf_block *)scconf_find_block(ctx, NULL, "pam_pkcs11");
++ if (!pam_pkcs11) {
++ goto bail;
++ }
++ scconf_replace_str(pam_pkcs11, "use_pkcs11_module", mod);
++
++ modules = scconf_find_blocks(ctx, pam_pkcs11, "pkcs11_module", mod);
++ if (!modules || !modules[0]) {
++ goto bail;
++ }
++ lib = scconf_get_str(modules[0], "module", NULL);
++ if (!lib) {
++ goto bail;
++ }
++ result = scconf_write(ctx, NULL);
++ if (result != 0) {
++ goto bail;
++ }
++
++ ectx = scconf_new(EVENTMGR_CONF);
++ if (ectx == NULL) {
++ goto bail;
++ }
++ if (scconf_parse(ectx) <= 0) {
++ goto bail;
++ }
++ pkcs11_eventmgr = (scconf_block *)
++ scconf_find_block(ectx, NULL, "pkcs11_eventmgr");
++ if (!pkcs11_eventmgr) {
++ goto bail;
++ }
++ scconf_replace_str(pkcs11_eventmgr, "pkcs11_module", lib);
++ result = scconf_write(ectx, NULL);
++
++bail:
++ if (modules) {
++ free(modules);
++ }
++ if (ctx) {
++ scconf_free(ctx);
++ }
++ if (ectx) {
++ scconf_free(ectx);
++ }
++
++ return result;
++}
++
++int print_card_insert_action(void)
++{
++ const scconf_block *pkcs11_eventmgr;
++ scconf_block **event_blocks = NULL;
++ scconf_context *ctx = NULL;
++ const scconf_list *actionList = NULL;
++ int result = 1;
++
++ /*
++ * read the pkcs11_eventmgr.conf to get our action
++ */
++ ctx = scconf_new(EVENTMGR_CONF);
++ if (ctx == NULL) {
++ goto bail;
++ }
++ if (scconf_parse(ctx) <= 0) {
++ goto bail;
++ }
++ pkcs11_eventmgr = scconf_find_block(ctx, NULL, "pkcs11_eventmgr");
++ if (!pkcs11_eventmgr) {
++ goto bail;
++ }
++ event_blocks = scconf_find_blocks(ctx, pkcs11_eventmgr, "event",
++ "card_insert");
++ if (!event_blocks || !event_blocks[0]) {
++ goto bail;
++ }
++ actionList = scconf_find_list(event_blocks[0],"action");
++ if (actionList) {
++ char *lst = scconf_list_strdup(actionList, "\n");
++ if (lst != NULL) {
++ printf("%s\n", lst);
++ free(lst);
++ }
++ }
++ result = 0;
++
++bail:
++ if (event_blocks) {
++ free(event_blocks);
++ }
++ if (ctx) {
++ scconf_free(ctx);
++ }
++
++ return result;
++}
++
++int set_card_insert_action(const char *act)
++{
++ scconf_block *pkcs11_eventmgr;
++ scconf_block **insert_blocks = NULL;
++ scconf_context *ctx = NULL;
++ int result = 1;
++
++ /*
++ * write out pkcs11_eventmgr.conf
++ */
++ ctx = scconf_new(EVENTMGR_CONF);
++ if (ctx == NULL) {
++ goto bail;
++ }
++ if (scconf_parse(ctx) <= 0) {
++ goto bail;
++ }
++ pkcs11_eventmgr = (scconf_block *)
++ scconf_find_block(ctx, NULL, "pkcs11_eventmgr");
++ if (!pkcs11_eventmgr) {
++ goto bail;
++ }
++ insert_blocks = scconf_find_blocks(ctx, pkcs11_eventmgr,
++ "event", "card_insert");
++ if (!insert_blocks || !insert_blocks[0]) {
++ goto bail;
++ }
++
++ scconf_replace_str_list(insert_blocks[0], "action", act);
++
++ result = scconf_write(ctx, NULL);
++
++bail:
++ if (insert_blocks) {
++ free(insert_blocks);
++ }
++ if (ctx) {
++ scconf_free(ctx);
++ }
++ return result;
++}
++
++int print_card_remove_action(void)
++{
++ const scconf_block *pkcs11_eventmgr;
++ scconf_block **event_blocks = NULL;
++ scconf_context *ctx = NULL;
++ const scconf_list *actionList = NULL;
++ int result = 1;
++
++ /*
++ * read the pkcs11_eventmgr.conf to get our action
++ */
++ ctx = scconf_new(EVENTMGR_CONF);
++ if (ctx == NULL) {
++ goto bail;
++ }
++ if (scconf_parse(ctx) <= 0) {
++ goto bail;
++ }
++ pkcs11_eventmgr = scconf_find_block(ctx, NULL, "pkcs11_eventmgr");
++ if (!pkcs11_eventmgr) {
++ goto bail;
++ }
++ event_blocks = scconf_find_blocks(ctx, pkcs11_eventmgr, "event",
++ "card_remove");
++ if (!event_blocks || !event_blocks[0]) {
++ goto bail;
++ }
++ actionList = scconf_find_list(event_blocks[0],"action");
++ if (actionList) {
++ char *lst = scconf_list_strdup(actionList, "\n");
++ if (lst != NULL) {
++ printf("%s\n", lst);
++ free(lst);
++ }
++ }
++ result = 0;
++
++bail:
++ if (event_blocks) {
++ free(event_blocks);
++ }
++ if (ctx) {
++ scconf_free(ctx);
++ }
++
++ return result;
++}
++
++int set_card_remove_action(const char *act)
++{
++ scconf_block *pkcs11_eventmgr;
++ scconf_block **insert_blocks = NULL;
++ scconf_context *ctx = NULL;
++ int result = 1;
++
++ /*
++ * write out pkcs11_eventmgr.conf
++ */
++ ctx = scconf_new(EVENTMGR_CONF);
++ if (ctx == NULL) {
++ goto bail;
++ }
++ if (scconf_parse(ctx) <= 0) {
++ goto bail;
++ }
++ pkcs11_eventmgr = (scconf_block *)
++ scconf_find_block(ctx, NULL, "pkcs11_eventmgr");
++ if (!pkcs11_eventmgr) {
++ goto bail;
++ }
++ insert_blocks = scconf_find_blocks(ctx, pkcs11_eventmgr,
++ "event", "card_remove");
++ if (!insert_blocks || !insert_blocks[0]) {
++ goto bail;
++ }
++
++ scconf_replace_str_list(insert_blocks[0], "action", act);
++
++ result = scconf_write(ctx, NULL);
++
++bail:
++ if (insert_blocks) {
++ free(insert_blocks);
++ }
++ if (ctx) {
++ scconf_free(ctx);
++ }
++ return result;
++}
++
++int main(int argc, const char **argv)
++{
++ int i;
++ int pname;
++ const char *params[NUM_PARAMS];
++
++ memset(params, '\0', sizeof(params));
++
++ for (i = 1; i < argc; i++) {
++ for (pname = 0; pname < NUM_PARAMS; pname++) {
++ if (param_names[pname][pn_sizes[pname]-2] == '=') {
++ if (strncmp(argv[i], param_names[pname], pn_sizes[pname]-1) == 0) {
++ params[pname] = argv[i] + pn_sizes[pname] - 1;
++ }
++ else if (strncmp(argv[i], param_names[pname], pn_sizes[pname]-2) == 0
++ && argv[i][pn_sizes[pname]-2] == '\0') {
++ params[pname] = (void *)1;
++ }
++ }
++ else {
++ if (strcmp(argv[i], param_names[pname]) == 0) {
++ params[pname] = (void *)1;
++ }
++ }
++ }
++ }
++
++ for (pname = 0; pname < NUM_PARAMS; pname++) {
++ if (params[pname] != NULL)
++ break;
++ }
++
++ if (pname == NUM_PARAMS) {
++ DBG("No correct parameter specified");
++ printf("usage: pkcs11_setup [list_modules] [use_module[=<module_name>]]\n"
++ " [ins_action[=<executable,executable,...>]]\n"
++ " [rm_action[=<executable,executable,...>]]\n");
++ }
++
++ if (params[LIST_MODULES] != NULL) {
++ DBG("List modules:");
++ return list_modules();
++ }
++ else {
++ if (params[USE_MODULE] == (void *)1) {
++ DBG("Print default module:");
++ if ((i=print_default_module()) != 0) {
++ DBG1("Print default module failed with: %d", i);
++ return i;
++ }
++ return 0;
++ }
++ else if (params[USE_MODULE] != NULL) {
++ DBG1("Set default module: %s", params[USE_MODULE]);
++ if ((i=set_default_module(params[USE_MODULE])) != 0) {
++ DBG1("Set default module failed with: %d", i);
++ return i;
++ }
++ }
++ if (params[INS_ACTION] == (void *)1) {
++ DBG("Print card insert action:");
++ if ((i=print_card_insert_action()) != 0) {
++ DBG1("Print card insert action failed with: %d", i);
++ return i;
++ }
++ return 0;
++ }
++ else if (params[INS_ACTION] != NULL) {
++ DBG1("Set card insert action: %s", params[INS_ACTION]);
++ if ((i=set_card_insert_action(params[INS_ACTION])) != 0) {
++ DBG1("Set card insert action failed with: %d", i);
++ return i;
++ }
++ }
++ if (params[RM_ACTION] == (void *)1) {
++ DBG("Print card remove action:");
++ if ((i=print_card_remove_action()) != 0) {
++ DBG1("Set card remove action failed with: %d", i);
++ return i;
++ }
++ return 0;
++ }
++ else if (params[RM_ACTION] != NULL) {
++ DBG1("Set card remove action: %s", params[RM_ACTION]);
++ if ((i=set_card_remove_action(params[RM_ACTION])) != 0) {
++ DBG1("Set card remove action failed with: %d", i);
++ return i;
++ }
++ }
++ }
++ DBG("Process completed");
++ return 0;
++}
diff --git a/sys-auth/pam_pkcs11/pam_pkcs11-0.5.3-r1.ebuild b/sys-auth/pam_pkcs11/pam_pkcs11-0.5.3-r1.ebuild
new file mode 100644
index 000000000000..0cfe6eda2d15
--- /dev/null
+++ b/sys-auth/pam_pkcs11/pam_pkcs11-0.5.3-r1.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-auth/pam_pkcs11/pam_pkcs11-0.5.3-r1.ebuild,v 1.1 2006/09/06 05:23:39 dberkholz Exp $
+
+inherit eutils
+
+DESCRIPTION="PKCS11 Pam library"
+HOMEPAGE="http://www.opensc-project.org/pam_pkcs11"
+SRC_URI="http://www.opensc-project.org/files/pam_pkcs11/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="curl ldap pcsc-lite"
+
+DEPEND=">=dev-libs/opensc-0.10
+ sys-libs/pam
+ curl? ( net-misc/curl )
+ ldap? ( net-nds/openldap )
+ pcsc-lite? ( sys-apps/pcsc-lite )
+ dev-libs/openssl"
+
+src_unpack() {
+ unpack ${A}
+
+ # Simple setup tool, from Red Hat
+ # Needed for app-admin/authconfig
+ epatch "${FILESDIR}"/${P}-setup-tool.patch
+}
+
+src_compile() {
+ econf \
+ $(use_with curl) \
+ $(use_with pcsc-lite pcsclite) \
+ $(use_with ldap) \
+ || die "econf failed"
+
+ emake || die "emake failed"
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die "install failed"
+
+ dodir /lib/security
+ dosym ../../usr/lib/security/pam_pkcs11.so /lib/security/
+
+ dodoc NEWS README
+ dohtml docs/*.{html,css}
+}