mirror of
https://abf.rosa.ru/djam/pam.git
synced 2025-02-23 16:32:51 +00:00
92 lines
2.4 KiB
Diff
92 lines
2.4 KiB
Diff
From 9facab2134a9e1142ab3c614e72eb25aaafd0dec Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
|
|
Date: Sat, 5 Aug 2023 17:34:42 +0200
|
|
Subject: [PATCH] tests: free handles via pam_end()
|
|
|
|
Destroy the pam handles via pam_end() to release all associated
|
|
resources. This allows to run the test-suite with sanitizers and
|
|
validates the resource cleanup in pam_end() and callees.
|
|
---
|
|
tests/tst-pam_fail_delay.c | 2 ++
|
|
tests/tst-pam_getenvlist.c | 2 ++
|
|
tests/tst-pam_start.c | 4 ++++
|
|
tests/tst-pam_start_confdir.c | 6 ++++++
|
|
4 files changed, 14 insertions(+)
|
|
|
|
diff --git a/tests/tst-pam_fail_delay.c b/tests/tst-pam_fail_delay.c
|
|
index d81c57650..f166ec0df 100644
|
|
--- a/tests/tst-pam_fail_delay.c
|
|
+++ b/tests/tst-pam_fail_delay.c
|
|
@@ -67,6 +67,8 @@ main (void)
|
|
return 1;
|
|
}
|
|
|
|
+ pam_end (pamh, retval);
|
|
+
|
|
/* 2: use NULL pam handle */
|
|
retval = pam_fail_delay (NULL, 60);
|
|
if (retval == PAM_SUCCESS)
|
|
diff --git a/tests/tst-pam_getenvlist.c b/tests/tst-pam_getenvlist.c
|
|
index a1184f1a8..62aea0615 100644
|
|
--- a/tests/tst-pam_getenvlist.c
|
|
+++ b/tests/tst-pam_getenvlist.c
|
|
@@ -130,5 +130,7 @@ main (void)
|
|
free (ptr);
|
|
}
|
|
|
|
+ pam_end (pamh, retval);
|
|
+
|
|
return 0;
|
|
}
|
|
diff --git a/tests/tst-pam_start.c b/tests/tst-pam_start.c
|
|
index 8fa18f74d..23af4fe87 100644
|
|
--- a/tests/tst-pam_start.c
|
|
+++ b/tests/tst-pam_start.c
|
|
@@ -66,6 +66,8 @@ main (void)
|
|
return 1;
|
|
}
|
|
|
|
+ pam_end (pamh, retval);
|
|
+
|
|
/* 2: check with NULL for service */
|
|
retval = pam_start (NULL, user, &conv, &pamh);
|
|
if (retval == PAM_SUCCESS)
|
|
@@ -84,6 +86,8 @@ main (void)
|
|
return 1;
|
|
}
|
|
|
|
+ pam_end (pamh, retval);
|
|
+
|
|
|
|
/* 4: check with NULL for conv */
|
|
retval = pam_start (service, user, NULL, &pamh);
|
|
diff --git a/tests/tst-pam_start_confdir.c b/tests/tst-pam_start_confdir.c
|
|
index f731b2a55..b57ea573c 100644
|
|
--- a/tests/tst-pam_start_confdir.c
|
|
+++ b/tests/tst-pam_start_confdir.c
|
|
@@ -77,6 +77,8 @@ main (void)
|
|
return 1;
|
|
}
|
|
|
|
+ pam_end (pamh, retval);
|
|
+
|
|
/* 2: check with invalid service */
|
|
retval = pam_start_confdir (xservice, user, &conv, confdir, &pamh);
|
|
if (retval == PAM_SUCCESS)
|
|
@@ -86,6 +88,8 @@ main (void)
|
|
return 1;
|
|
}
|
|
|
|
+ pam_end (pamh, retval);
|
|
+
|
|
/* 3: check with invalid confdir */
|
|
retval = pam_start_confdir (service, user, &conv, xconfdir, &pamh);
|
|
if (retval == PAM_SUCCESS)
|
|
@@ -95,5 +99,7 @@ main (void)
|
|
return 1;
|
|
}
|
|
|
|
+ pam_end (pamh, retval);
|
|
+
|
|
return 0;
|
|
}
|