Skip to content

Commit

Permalink
Fix compiler warning in pam_test.c
Browse files Browse the repository at this point in the history
Compiler cannot find the declaration for pm_sm_authenticate and prints
the following warning (split due to long line):
pam_test.c:184:10: warning: implicit declaration of function
‘pam_sm_authenticate’; did you mean ‘pam_authenticate’?
[-Wimplicit-function-declaration]
  • Loading branch information
terop committed Oct 24, 2018
1 parent a9b2057 commit 9341f34
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions tests/pam_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ struct pam_modutil_privs {
};
#endif

int
pam_sm_authenticate (pam_handle_t * pamh,
int flags, int argc, const char **argv);

#define YKVAL_PORT1 "17502"
#define YKVAL_PORT2 "30559"
#define LDAP_PORT "52825"
Expand Down Expand Up @@ -181,7 +185,7 @@ static int test_authenticate1(void) {
"authfile="AUTHFILE,
"debug",
};
return pam_sm_authenticate(0, 0, sizeof(cfg) / sizeof(char*), cfg);
return pam_sm_authenticate((pam_handle_t *)0, 0, sizeof(cfg) / sizeof(char*), cfg);
}

static int test_authenticate2(void) {
Expand All @@ -191,7 +195,7 @@ static int test_authenticate2(void) {
"authfile="AUTHFILE,
"debug",
};
return pam_sm_authenticate(0, 0, sizeof(cfg) / sizeof(char*), cfg);
return pam_sm_authenticate((pam_handle_t *)0, 0, sizeof(cfg) / sizeof(char*), cfg);
}

static int test_authenticate3(void) {
Expand All @@ -201,7 +205,7 @@ static int test_authenticate3(void) {
"authfile="AUTHFILE,
"debug",
};
return pam_sm_authenticate(4, 0, sizeof(cfg) / sizeof(char*), cfg);
return pam_sm_authenticate((pam_handle_t *)4, 0, sizeof(cfg) / sizeof(char*), cfg);
}

static int test_authenticate4(void) {
Expand All @@ -211,7 +215,7 @@ static int test_authenticate4(void) {
"authfile="AUTHFILE,
"debug",
};
return pam_sm_authenticate(5, 0, sizeof(cfg) / sizeof(char*), cfg);
return pam_sm_authenticate((pam_handle_t *)5, 0, sizeof(cfg) / sizeof(char*), cfg);
}

static int test_authenticate5(void) {
Expand All @@ -221,7 +225,7 @@ static int test_authenticate5(void) {
"authfile="AUTHFILE,
"debug",
};
return pam_sm_authenticate(6, 0, sizeof(cfg) / sizeof(char*), cfg);
return pam_sm_authenticate((pam_handle_t *)6, 0, sizeof(cfg) / sizeof(char*), cfg);
}

static int test_fail_authenticate1(void) {
Expand All @@ -231,7 +235,7 @@ static int test_fail_authenticate1(void) {
"authfile="AUTHFILE,
"debug"
};
return pam_sm_authenticate(1, 0, sizeof(cfg) / sizeof(char*), cfg);
return pam_sm_authenticate((pam_handle_t *)1, 0, sizeof(cfg) / sizeof(char*), cfg);
}

static int test_fail_authenticate2(void) {
Expand All @@ -241,7 +245,7 @@ static int test_fail_authenticate2(void) {
"authfile="AUTHFILE,
"debug"
};
return pam_sm_authenticate(2, 0, sizeof(cfg) / sizeof(char*), cfg);
return pam_sm_authenticate((pam_handle_t *)2, 0, sizeof(cfg) / sizeof(char*), cfg);
}

static int test_fail_authenticate3(void) {
Expand All @@ -251,7 +255,7 @@ static int test_fail_authenticate3(void) {
"authfile="AUTHFILE,
"debug"
};
return pam_sm_authenticate(3, 0, sizeof(cfg) / sizeof(char*), cfg);
return pam_sm_authenticate((pam_handle_t *)3, 0, sizeof(cfg) / sizeof(char*), cfg);
}

static int test_firstpass_authenticate(void) {
Expand All @@ -262,7 +266,7 @@ static int test_firstpass_authenticate(void) {
"use_first_pass",
"debug"
};
return pam_sm_authenticate(8, 0, sizeof(cfg) / sizeof(char*), cfg);
return pam_sm_authenticate((pam_handle_t *)8, 0, sizeof(cfg) / sizeof(char*), cfg);
}

static int test_firstpass_fail(void) {
Expand All @@ -273,7 +277,7 @@ static int test_firstpass_fail(void) {
"use_first_pass",
"debug"
};
return pam_sm_authenticate(9, 0, sizeof(cfg) / sizeof(char*), cfg);
return pam_sm_authenticate((pam_handle_t *)9, 0, sizeof(cfg) / sizeof(char*), cfg);
}

static int test_firstpass_fail2(void) {
Expand All @@ -284,39 +288,39 @@ static int test_firstpass_fail2(void) {
"use_first_pass",
"debug"
};
return pam_sm_authenticate(10, 0, sizeof(cfg) / sizeof(char*), cfg);
return pam_sm_authenticate((pam_handle_t *)10, 0, sizeof(cfg) / sizeof(char*), cfg);
}

static int test_authenticate_ldap1(void) {
return pam_sm_authenticate(0, 0, sizeof(ldap_cfg) / sizeof(char*), ldap_cfg);
return pam_sm_authenticate((pam_handle_t *)0, 0, sizeof(ldap_cfg) / sizeof(char*), ldap_cfg);
}

static int test_authenticate_ldap_fail1(void) {
return pam_sm_authenticate(1, 0, sizeof(ldap_cfg) / sizeof(char*), ldap_cfg);
return pam_sm_authenticate((pam_handle_t *)1, 0, sizeof(ldap_cfg) / sizeof(char*), ldap_cfg);
}

static int test_authenticate_ldap_fail2(void) {
return pam_sm_authenticate(2, 0, sizeof(ldap_cfg) / sizeof(char*), ldap_cfg);
return pam_sm_authenticate((pam_handle_t *)2, 0, sizeof(ldap_cfg) / sizeof(char*), ldap_cfg);
}

static int test_authenticate_ldap2(void) {
return pam_sm_authenticate(4, 0, sizeof(ldap_cfg) / sizeof(char*), ldap_cfg);
return pam_sm_authenticate((pam_handle_t *)4, 0, sizeof(ldap_cfg) / sizeof(char*), ldap_cfg);
}

static int test_authenticate_ldap3(void) {
return pam_sm_authenticate(4, 0, sizeof(ldap_cfg2) / sizeof(char*), ldap_cfg2);
return pam_sm_authenticate((pam_handle_t *)4, 0, sizeof(ldap_cfg2) / sizeof(char*), ldap_cfg2);
}

static int test_authenticate_ldap4(void) {
return pam_sm_authenticate(5, 0, sizeof(ldap_cfg) / sizeof(char*), ldap_cfg);
return pam_sm_authenticate((pam_handle_t *)5, 0, sizeof(ldap_cfg) / sizeof(char*), ldap_cfg);
}

static int test_authenticate_ldap5(void) {
return pam_sm_authenticate(6, 0, sizeof(ldap_cfg) / sizeof(char*), ldap_cfg);
return pam_sm_authenticate((pam_handle_t *)6, 0, sizeof(ldap_cfg) / sizeof(char*), ldap_cfg);
}

static int test_authenticate_ldap6(void) {
return pam_sm_authenticate(7, 0, sizeof(ldap_cfg) / sizeof(char*), ldap_cfg);
return pam_sm_authenticate((pam_handle_t *)7, 0, sizeof(ldap_cfg) / sizeof(char*), ldap_cfg);
}

static pid_t run_mock(const char *port, const char *type) {
Expand Down

0 comments on commit 9341f34

Please sign in to comment.