aboutsummaryrefslogtreecommitdiff
path: root/xtests/tst-pam_time1.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_time1.c
parenta8b4dce7b53d73de372e150028c970ee0a2a2e97 (diff)
downloadpam-1181e0590c9f059c40b71718d4fb3b6c339f65db.tar.gz
pam-1181e0590c9f059c40b71718d4fb3b6c339f65db.tar.bz2
pam-1181e0590c9f059c40b71718d4fb3b6c339f65db.zip
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_time1.c')
-rw-r--r--xtests/tst-pam_time1.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/xtests/tst-pam_time1.c b/xtests/tst-pam_time1.c
index 9fc0669e..18dfeba9 100644
--- a/xtests/tst-pam_time1.c
+++ b/xtests/tst-pam_time1.c
@@ -49,6 +49,7 @@
#include <stdlib.h>
#include <string.h>
#include <security/pam_appl.h>
+#include "pam_inline.h"
struct test_t {
@@ -65,8 +66,6 @@ static struct test_t tests[] = {
{"y", 6},
};
-static int num_tests = sizeof (tests) / sizeof (struct test_t);
-
static struct pam_conv conv = {
NULL, NULL
};
@@ -77,12 +76,12 @@ main(int argc, char *argv[])
pam_handle_t *pamh = NULL;
int retval;
int debug = 0;
- int i;
+ unsigned int i;
if (argc > 1 && strcmp (argv[1], "-d") == 0)
debug = 1;
- for (i = 0; i < num_tests; i++)
+ for (i = 0; i < PAM_ARRAY_SIZE(tests); i++)
{
retval = pam_start("tst-pam_time1", tests[i].user, &conv, &pamh);
if (retval != PAM_SUCCESS)