From eca150344b115f0ee47b0d3cbe08dba34bdcb2a3 Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Thu, 12 Feb 2015 14:10:54 +0100 Subject: [PATCH] make sure out-of-tree builds work --- tests/Makefile.am | 2 ++ tests/pam_test.c | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 56ed5b4a..bd8d715a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -34,6 +34,8 @@ test_LDADD = ../pam_yubico.la util_test_LDADD = ../libpam_util.la pam_test_LDADD = ../libpam_real.la ../libpam_util.la @LTLIBYUBIKEY@ @LTLIBYKCLIENT@ @LIBLDAP@ +pam_test_CPPFLAGS = -DSRCDIR=\"$(srcdir)\" + check_PROGRAMS = test util_test pam_test TESTS = $(check_PROGRAMS) diff --git a/tests/pam_test.c b/tests/pam_test.c index 5b21e1f4..6047f064 100644 --- a/tests/pam_test.c +++ b/tests/pam_test.c @@ -44,6 +44,10 @@ #define YKVAL_PORT2 "30559" #define LDAP_PORT "52825" +#define YKVAL SRCDIR"/aux/ykval.pl" +#define LDAP SRCDIR"/aux/ldap.pl" +#define AUTHFILE SRCDIR"/aux/authfile" + static struct data { const char user[255]; const char otp[255]; @@ -59,7 +63,7 @@ static struct data { static const char *ldap_cfg[] = { "id=1", "urllist=http://localhost:"YKVAL_PORT2"/wsapi/2/verify;http://localhost:"YKVAL_PORT1"/wsapi/2/verify", - "authfile=aux/authfile", + "authfile="AUTHFILE, "ldap_uri=ldap://localhost:"LDAP_PORT, "ldapdn=ou=users,dc=example,dc=com", "user_attr=uid", @@ -136,7 +140,7 @@ static int test_authenticate1(void) { const char *cfg[] = { "id=1", "url=http://localhost:"YKVAL_PORT1"/wsapi/2/verify?id=%d&otp=%s", - "authfile=aux/authfile", + "authfile="AUTHFILE, "debug", }; return pam_sm_authenticate(0, 0, sizeof(cfg) / sizeof(char*), cfg); @@ -146,7 +150,7 @@ static int test_authenticate2(void) { const char *cfg[] = { "id=1", "urllist=http://localhost:"YKVAL_PORT1"/wsapi/2/verify;http://localhost:"YKVAL_PORT2"/wsapi/2/verify", - "authfile=aux/authfile", + "authfile="AUTHFILE, "debug", }; return pam_sm_authenticate(0, 0, sizeof(cfg) / sizeof(char*), cfg); @@ -156,7 +160,7 @@ static int test_authenticate3(void) { const char *cfg[] = { "id=1", "urllist=http://localhost:"YKVAL_PORT1"/wsapi/2/verify", - "authfile=aux/authfile", + "authfile="AUTHFILE, "debug", }; return pam_sm_authenticate(4, 0, sizeof(cfg) / sizeof(char*), cfg); @@ -166,7 +170,7 @@ static int test_fail_authenticate1(void) { const char *cfg[] = { "id=1", "urllist=http://localhost:"YKVAL_PORT2"/wsapi/2/verify;http://localhost:"YKVAL_PORT1"/wsapi/2/verify", - "authfile=aux/authfile", + "authfile="AUTHFILE, "debug" }; return pam_sm_authenticate(1, 0, sizeof(cfg) / sizeof(char*), cfg); @@ -176,7 +180,7 @@ static int test_fail_authenticate2(void) { const char *cfg[] = { "id=1", "urllist=http://localhost:"YKVAL_PORT2"/wsapi/2/verify;http://localhost:"YKVAL_PORT1"/wsapi/2/verify", - "authfile=aux/authfile", + "authfile="AUTHFILE, "debug" }; return pam_sm_authenticate(2, 0, sizeof(cfg) / sizeof(char*), cfg); @@ -186,7 +190,7 @@ static int test_fail_authenticate3(void) { const char *cfg[] = { "id=1", "urllist=http://localhost:"YKVAL_PORT2"/wsapi/2/verify", - "authfile=aux/authfile", + "authfile="AUTHFILE, "debug" }; return pam_sm_authenticate(3, 0, sizeof(cfg) / sizeof(char*), cfg); @@ -216,9 +220,6 @@ static pid_t run_mock(const char *port, const char *type) { return pid; } -#define YKVAL "aux/ykval.pl" -#define LDAP "aux/ldap.pl" - int main(void) { int ret = 0; pid_t child = run_mock(YKVAL_PORT1, YKVAL);