Skip to content

Commit

Permalink
make sure out-of-tree builds work
Browse files Browse the repository at this point in the history
  • Loading branch information
klali committed Feb 12, 2015
1 parent ec730d7 commit eca1503
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 2 additions & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
21 changes: 11 additions & 10 deletions tests/pam_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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",
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit eca1503

Please sign in to comment.