diff --git a/configure.in b/configure.in index 7602f10b..e8a0eb2b 100644 --- a/configure.in +++ b/configure.in @@ -756,7 +756,6 @@ if test "x$PAM_MSG" = "xyes" ; then fi LIBS="$saved_LIBS" AM_CONDITIONAL(HAVE_PAM, test "x$PAM_MSG" = "xyes") -AM_CONDITIONAL(HAVE_PAM_AND_SSL, test "x$PAM_MSG" = "xyes" -a "x$SSL_MSG" = "xyes") dnl Check for SIA libs AC_SUBST(LIBSIA) diff --git a/src/pam/Makefile.am b/src/pam/Makefile.am index 378fe036..35d298ad 100644 --- a/src/pam/Makefile.am +++ b/src/pam/Makefile.am @@ -2,20 +2,13 @@ libdir = ${prefix}/lib/security -INCLUDES = @CFLAGS_PCSC@ @CFLAGS_OPENSC@ -I../scam -I../scconf -I../scrandom -I../scldap +INCLUDES = -I../scam -if HAVE_LDAP -LDAP_LTLIBS = @LIBSCLDAP@ -else -LDAP_LTLIBS = -endif +LDFLAGS = @LDFLAGS@ @LIBDL@ @LIBPAM@ ../scam/libpamscam.la -LDFLAGS = @LDFLAGS@ @LIBDL@ @LIBSCRANDOM@ $(LDAP_LTLIBS) @LIBCRYPTO@ @LIBOPENSC@ @LIBPAM@ +SRC = pam_opensc.c pam_support.c pam_support.h -AUTHSRC = ../scam/scam.c ../scam/scam.h ../scam/p15_eid.c ../scam/p15_ldap.c -SRC = $(AUTHSRC) pam_opensc.c pam_support.c pam_support.h - -if HAVE_PAM_AND_SSL +if HAVE_PAM lib_LTLIBRARIES = pam_opensc.la noinst_PROGRAMS = pam_opensc-test else diff --git a/src/pam/README b/src/pam/README index ef8f4630..63ef85b2 100644 --- a/src/pam/README +++ b/src/pam/README @@ -17,9 +17,12 @@ The following options are recognized: resulting in a delay of about 1 second. auth_method=X - use authentication method X, the following methods are currently recognized: - sp, opensc-pkcs15 + pkcs15-ldap, pkcs15-eid -auth_method[sp]: +Generic options: + -h Show help + +auth_method[opensc-pkcs15-ldap]: -r Reader name LDAP specific options: -L ldap.conf Configuration file to load @@ -35,5 +38,5 @@ LDAP specific options: -a attribute(s) -f filter -auth_method[opensc-pkcs15]: - TODO +auth_method[opensc-pkcs15-eid]: + -r Reader name diff --git a/src/pam/pam_opensc.c b/src/pam/pam_opensc.c index f3e6f894..b072df25 100644 --- a/src/pam/pam_opensc.c +++ b/src/pam/pam_opensc.c @@ -34,6 +34,7 @@ #include #endif #include +#include "pam_support.h" #include "scam.h" #define PAM_SM_AUTH diff --git a/src/scam/Makefile.am b/src/scam/Makefile.am index f0b659d7..965d5617 100644 --- a/src/scam/Makefile.am +++ b/src/scam/Makefile.am @@ -1,3 +1,50 @@ # Process this file with automake to create Makefile.in -EXTRA_DIST = scam.c scam.h p15_eid.c p15_ldap.c +INCLUDES = @CFLAGS_PCSC@ @CFLAGS_OPENSC@ -I../scconf -I../scrandom -I../scldap + +if HAVE_PAM +PAM = libpamscam.la +else +PAM = +endif +if HAVE_SIA +SIA = libsiascam.la +else +SIA = +endif + +lib_LTLIBRARIES = $(PAM) $(SIA) + +if HAVE_LDAP +LDAP_LTLIBS = @LIBSCLDAP@ +else +LDAP_LTLIBS = +endif +if HAVE_SSL +SSL_LTLIBS = @LIBCRYPTO@ +else +SSL_LTLIBS = +endif +# Temporary +if HAVE_SCIDI +SCIDI_LTLIBS = @LIBSSP@ +SCIDI_SRC = ../../../scam/sp.c +SCIDI_INC = @CFLAGS_SSP@ +else +SCIDI_LTLIBS = +SCIDI_SRC = +SCIDI_INC = +endif + +LDFLAGS = @LIBOPENSC@ @LIBSCRANDOM@ $(LDAP_LTLIBS) $(SSL_LTLIBS) $(SCIDI_LTLIBS) +EXTRAINC = $(SCIDI_INC) + +SRC = scam.c scam.h p15_eid.c p15_ldap.c $(SCIDI_SRC) + +libpamscam_la_SOURCES = $(SRC) +libpamscam_la_LDFLAGS = -module -avoid-version +libpamscam_la_CFLAGS = -I../pam -DPAM_SCAM $(EXTRAINC) + +libsiascam_la_SOURCES = $(SRC) +libsiascam_la_LDFLAGS = -module -avoid-version +libsiascam_la_CFLAGS = -I../sia -DSIA_SCAM $(EXTRAINC) diff --git a/src/scam/p15_eid.c b/src/scam/p15_eid.c index 904c6502..365b2c92 100644 --- a/src/scam/p15_eid.c +++ b/src/scam/p15_eid.c @@ -36,10 +36,10 @@ #include #include "scam.h" -#if defined(HAVE_PAM) +#if defined(PAM_SCAM) static pam_handle_t *p15_eid_pamh = NULL; static unsigned int *p15_eid_ctrl = NULL; -#elif defined(HAVE_OSF_SIA) +#elif defined(SIA_SCAM) static sia_collect_func_t *p15_eid_collect = NULL; static SIAENTITY *p15_eid_entity = NULL; #endif @@ -71,10 +71,10 @@ const char *p15_eid_usage(void) void p15_eid_handles(void *ctx1, void *ctx2, void *ctx3) { -#if defined(HAVE_PAM) +#if defined(PAM_SCAM) p15_eid_pamh = (pam_handle_t *) ctx1; p15_eid_ctrl = (unsigned int *) ctx2; -#elif defined(HAVE_OSF_SIA) +#elif defined(SIA_SCAM) p15_eid_collect = (sia_collect_func_t *) ctx1; p15_eid_entity = (SIAENTITY *) ctx2; #endif @@ -89,10 +89,10 @@ void p15_eid_printmsg(char *str,...) memset(buf, 0, 128); vsnprintf(buf, 128, str, ap); va_end(ap); -#if defined(HAVE_PAM) +#if defined(PAM_SCAM) if (p15_eid_pamh && p15_eid_ctrl) opensc_pam_msg(p15_eid_pamh, *p15_eid_ctrl, PAM_TEXT_INFO, buf); -#elif defined(HAVE_OSF_SIA) +#elif defined(SIA_SCAM) #endif } @@ -105,10 +105,10 @@ void p15_eid_logmsg(char *str,...) memset(buf, 0, 1024); vsnprintf(buf, 1024, str, ap); va_end(ap); -#if defined(HAVE_PAM) +#if defined(PAM_SCAM) if (p15_eid_pamh) opensc_pam_log(LOG_NOTICE, p15_eid_pamh, buf); -#elif defined(HAVE_OSF_SIA) +#elif defined(SIA_SCAM) opensc_sia_log(buf); #endif } diff --git a/src/scam/p15_ldap.c b/src/scam/p15_ldap.c index 5799a522..8db7c629 100644 --- a/src/scam/p15_ldap.c +++ b/src/scam/p15_ldap.c @@ -37,10 +37,10 @@ #include #include "scam.h" -#if defined(HAVE_PAM) +#if defined(PAM_SCAM) static pam_handle_t *p15_ldap_pamh = NULL; static unsigned int *p15_ldap_ctrl = NULL; -#elif defined(HAVE_OSF_SIA) +#elif defined(SIA_SCAM) static sia_collect_func_t *p15_ldap_collect = NULL; static SIAENTITY *p15_ldap_entity = NULL; #endif @@ -72,10 +72,10 @@ const char *p15_ldap_usage(void) void p15_ldap_handles(void *ctx1, void *ctx2, void *ctx3) { -#if defined(HAVE_PAM) +#if defined(PAM_SCAM) p15_ldap_pamh = (pam_handle_t *) ctx1; p15_ldap_ctrl = (unsigned int *) ctx2; -#elif defined(HAVE_OSF_SIA) +#elif defined(SIA_SCAM) p15_ldap_collect = (sia_collect_func_t *) ctx1; p15_ldap_entity = (SIAENTITY *) ctx2; #endif @@ -90,10 +90,10 @@ void p15_ldap_printmsg(char *str,...) memset(buf, 0, 128); vsnprintf(buf, 128, str, ap); va_end(ap); -#if defined(HAVE_PAM) +#if defined(PAM_SCAM) if (p15_ldap_pamh && p15_ldap_ctrl) opensc_pam_msg(p15_ldap_pamh, *p15_ldap_ctrl, PAM_TEXT_INFO, buf); -#elif defined(HAVE_OSF_SIA) +#elif defined(SIA_SCAM) #endif } @@ -106,10 +106,10 @@ void p15_ldap_logmsg(char *str,...) memset(buf, 0, 1024); vsnprintf(buf, 1024, str, ap); va_end(ap); -#if defined(HAVE_PAM) +#if defined(PAM_SCAM) if (p15_ldap_pamh) opensc_pam_log(LOG_NOTICE, p15_ldap_pamh, buf); -#elif defined(HAVE_OSF_SIA) +#elif defined(SIA_SCAM) opensc_sia_log(buf); #endif } diff --git a/src/scam/scam.c b/src/scam/scam.c index 50b3a6ac..0d0b7465 100644 --- a/src/scam/scam.c +++ b/src/scam/scam.c @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef HAVE_CONFIH_H +#ifdef HAVE_CONFIG_H #include #endif #include diff --git a/src/scam/scam.h b/src/scam/scam.h index 1b314190..adf927dd 100644 --- a/src/scam/scam.h +++ b/src/scam/scam.h @@ -26,13 +26,13 @@ extern "C" { #endif -#ifdef HAVE_CONFIH_H +#ifdef HAVE_CONFIG_H #include #endif -#if defined(HAVE_PAM) -#include "pam_support.h" -#elif defined(HAVE_OSF_SIA) -#include "sia_support.h" +#if defined(PAM_SCAM) +#include +#elif defined(SIA_SCAM) +#include #endif #define SCAM_FAILED 1 diff --git a/src/sia/Makefile.am b/src/sia/Makefile.am index 52e93e74..5bcd8bd7 100644 --- a/src/sia/Makefile.am +++ b/src/sia/Makefile.am @@ -2,18 +2,11 @@ libdir = ${prefix}/lib/security -INCLUDES = @CFLAGS_PCSC@ @CFLAGS_OPENSC@ -I../scam -I../scconf -I../scrandom -I../scldap +INCLUDES = -I../scam -if HAVE_LDAP -LDAP_LTLIBS = @LIBSCLDAP@ -else -LDAP_LTLIBS = -endif +LDFLAGS = @LDFLAGS@ @LIBDL@ ../scam/libsiascam.la -LDFLAGS = @LDFLAGS@ @LIBDL@ @LIBSCRANDOM@ $(LDAP_LTLIBS) @LIBOPENSC@ - -AUTHSRC = ../scam/scam.c ../scam/scam.h ../scam/p15_eid.c ../scam/p15_ldap.c -SRC = $(AUTHSRC) sia_opensc.c sia_support.c sia_support.h +SRC = sia_opensc.c sia_support.c sia_support.h if HAVE_SIA lib_LTLIBRARIES = libsia_opensc.la @@ -23,7 +16,7 @@ lib_LTLIBRARIES = noinst_PROGRAMS = endif -libsia_opensc_la_SOURCES = $(SRC) $(INC) +libsia_opensc_la_SOURCES = $(SRC) libsia_opensc_la_LDFLAGS = -module -avoid-version test_sia_SOURCES = test-sia.c diff --git a/src/sia/sia_opensc.c b/src/sia/sia_opensc.c index 74fad4b1..d001b2fc 100644 --- a/src/sia/sia_opensc.c +++ b/src/sia/sia_opensc.c @@ -26,6 +26,7 @@ #include #include #include +#include "sia_support.h" #include "scam.h" static int scam_method = 0; diff --git a/src/sia/sia_support.c b/src/sia/sia_support.c index dca11914..4153f43d 100644 --- a/src/sia/sia_support.c +++ b/src/sia/sia_support.c @@ -26,7 +26,7 @@ #include #include #include -#include "scam.h" +#include "sia_support.h" /* opensc_sia_log logs to the standard sialog. */ void opensc_sia_log(char *format,...)