summaryrefslogtreecommitdiff
path: root/xtests/tst-pam_pwhistory1.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2020-03-16 21:02:18 +0000
committerDmitry V. Levin <ldv@altlinux.org>2020-03-19 18:40:16 +0000
commit1181e0590c9f059c40b71718d4fb3b6c339f65db (patch)
tree96da444742d360992e91d6f937e461892ff5f1c0 /xtests/tst-pam_pwhistory1.c
parenta8b4dce7b53d73de372e150028c970ee0a2a2e97 (diff)
Use PAM_ARRAY_SIZE
Replace all instances of sizeof(x) / sizeof(*x) with PAM_ARRAY_SIZE(x) which is less error-prone and implements an additional type check. * libpam/pam_handlers.c: Include "pam_inline.h". (_pam_open_config_file): Use PAM_ARRAY_SIZE. * modules/pam_exec/pam_exec.c: Include "pam_inline.h". (call_exec): Use PAM_ARRAY_SIZE. * modules/pam_namespace/pam_namespace.c: Include "pam_inline.h". (filter_mntopts): Use PAM_ARRAY_SIZE. * modules/pam_timestamp/hmacfile.c: Include "pam_inline.h". (testvectors): Use PAM_ARRAY_SIZE. * modules/pam_xauth/pam_xauth.c: Include "pam_inline.h". (run_coprocess, pam_sm_open_session): Use PAM_ARRAY_SIZE. * tests/tst-pam_get_item.c: Include "pam_inline.h". (main): Use PAM_ARRAY_SIZE. * tests/tst-pam_set_item.c: Likewise. * xtests/tst-pam_pwhistory1.c: Likewise. * xtests/tst-pam_time1.c: Likewise.
Diffstat (limited to 'xtests/tst-pam_pwhistory1.c')
-rw-r--r--xtests/tst-pam_pwhistory1.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/xtests/tst-pam_pwhistory1.c b/xtests/tst-pam_pwhistory1.c
index 5c3246fa..1641c298 100644
--- a/xtests/tst-pam_pwhistory1.c
+++ b/xtests/tst-pam_pwhistory1.c
@@ -46,8 +46,9 @@
#include <stdlib.h>
#include <string.h>
#include <security/pam_appl.h>
+#include "pam_inline.h"
-static int in_test;
+static unsigned int in_test;
static const char *passwords[] = {
"pamhistory01", "pamhistory02", "pamhistory03",
@@ -121,15 +122,14 @@ main(int argc, char *argv[])
if (argc > 1 && strcmp (argv[1], "-d") == 0)
debug = 1;
- for (in_test = 0;
- in_test < (int)(sizeof (passwords)/sizeof (char *)); in_test++)
+ for (in_test = 0; in_test < PAM_ARRAY_SIZE(passwords); in_test++)
{
retval = pam_start("tst-pam_pwhistory1", user, &conv, &pamh);
if (retval != PAM_SUCCESS)
{
if (debug)
- fprintf (stderr, "pwhistory1-%d: pam_start returned %d\n",
+ fprintf (stderr, "pwhistory1-%u: pam_start returned %d\n",
in_test, retval);
return 1;
}
@@ -140,7 +140,7 @@ main(int argc, char *argv[])
if (retval != PAM_SUCCESS)
{
if (debug)
- fprintf (stderr, "pwhistory1-%d: pam_chauthtok returned %d\n",
+ fprintf (stderr, "pwhistory1-%u: pam_chauthtok returned %d\n",
in_test, retval);
return 1;
}
@@ -150,7 +150,7 @@ main(int argc, char *argv[])
if (retval != PAM_MAXTRIES)
{
if (debug)
- fprintf (stderr, "pwhistory1-%d: pam_chauthtok returned %d\n",
+ fprintf (stderr, "pwhistory1-%u: pam_chauthtok returned %d\n",
in_test, retval);
return 1;
}