summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/tst-pam_get_item.c10
-rw-r--r--tests/tst-pam_set_item.c8
2 files changed, 9 insertions, 9 deletions
diff --git a/tests/tst-pam_get_item.c b/tests/tst-pam_get_item.c
index e6c98a0f..2b0cc7e2 100644
--- a/tests/tst-pam_get_item.c
+++ b/tests/tst-pam_get_item.c
@@ -39,6 +39,7 @@
#include <unistd.h>
#include <security/pam_appl.h>
+#include "pam_inline.h"
struct mapping {
int type;
@@ -67,7 +68,8 @@ main (void)
const char *user = "root";
struct pam_conv conv;
pam_handle_t *pamh;
- int retval, num, i;
+ int retval;
+ unsigned int i;
const void *value;
/* 1: Call with NULL as pam handle */
@@ -89,9 +91,7 @@ main (void)
/* 2: check for valid item types. Expected return value is
PAM_SUCCESS, except it has to fail. */
- num = sizeof(items) / sizeof(struct mapping);
-
- for (i = 0; i < num; i++)
+ for (i = 0; i < PAM_ARRAY_SIZE(items); i++)
{
retval = pam_get_item (pamh, items[i].type, &value);
@@ -115,7 +115,7 @@ main (void)
}
/* 4: check for valid item types, but NULL as value address. */
- for (i = 0; i < num; i++)
+ for (i = 0; i < PAM_ARRAY_SIZE(items); i++)
{
retval = pam_get_item (pamh, items[i].type, NULL);
diff --git a/tests/tst-pam_set_item.c b/tests/tst-pam_set_item.c
index f8f271d1..bd17e11a 100644
--- a/tests/tst-pam_set_item.c
+++ b/tests/tst-pam_set_item.c
@@ -40,6 +40,7 @@
#include <string.h>
#include <security/pam_appl.h>
+#include "pam_inline.h"
struct mapping {
int type;
@@ -68,7 +69,8 @@ main (void)
const char *user = "root";
struct pam_conv conv;
pam_handle_t *pamh;
- int retval, num, i;
+ int retval;
+ unsigned int i;
/* 1: Call with NULL as pam handle */
retval = pam_set_item (NULL, PAM_SERVICE, "dummy");
@@ -108,9 +110,7 @@ main (void)
}
/* 4: try to replace all items */
- num = sizeof(items) / sizeof(struct mapping);
-
- for (i = 0; i < num; i++)
+ for (i = 0; i < PAM_ARRAY_SIZE(items); i++)
{
retval = pam_set_item (pamh, items[i].type, items[i].new_value);