summaryrefslogtreecommitdiff
path: root/transaction_test.go
AgeCommit message (Collapse)Author
2023-11-30transaction: Skip some tests requiring confdir if not availableMarco Trevisan (Treviño)
2023-11-30transaction_test: Add tests checking the loaded services matchMarco Trevisan (Treviño)
2023-11-30transaction: Add a test finalizer checking if transaction has endedMarco Trevisan (Treviño)
Check if a transaction is ended in in tests.
2023-11-30transaction: Add End() method and Remove Transaction finalizerMarco Trevisan (Treviño)
A PAM transaction needs to be ended in order to release the associated resources, however this can't be sadly automated as the go finalizers run in goroutines and this could cause problems to modules that we load. In fact a module code may be called back during pam_end (to cleanup data for example) and the module code could not be thread safe. So let's make this more manual, but safer. The transaction status is still preserved in the transaction so end will be automatically called with the last-known status. Closes: #14
2023-11-30transaction: Do not make Transaction to implement error interface anymoreMarco Trevisan (Treviño)
As per previous commit, Transaction can't be used anymore as an error value, but we instead we always return the status code.
2023-11-30transaction: Never return Transaction as errorMarco Trevisan (Treviño)
While transaction does implement error, it's not a valid error implementer because it may have bogous values since it's not thread-safe and so we may read the result of Error() when it's into an invalid state As per this never return it as an error, while always return the Status unless when not available, where we still return pam.Error.
2023-11-30transaction: Return errors wrapping pam.Error values on failureMarco Trevisan (Treviño)
If the transaction fails during start, there's no way to get the error detail in a programmatic way, so let's wrap the pam.Error to allow more per-type checks.
2023-11-30transaction: Add tests for all the possible Status (and error) valuesMarco Trevisan (Treviño)
Use pam_debug.so to generate pam configurations at test time and check if the returned values expect the ones we want.
2023-09-23Run go fmtMichael Steinert
2023-09-19transaction_test: Add root-less tests to check pam conversationMarco Trevisan (Treviño)
Use pam_succeed_if to make it implicitly ask for the user name and verify that the provided one is correct. This can safely run as user.
2023-09-19transaction_test: Add more authentication tests to run as userMarco Trevisan (Treviño)
So that it's possible also to verify an info text conversation
2023-09-19transaction_test: Enable conf-dir tests without rootMarco Trevisan (Treviño)
They don't require the `test` user nor being ran as root
2023-09-19tests: Move services to a subdirectoryMarco Trevisan (Treviño)
It makes it cleaner to handle, plus it allows adding more. Also rename the `my-service` to something more self-explanatory.
2022-09-16Integration test for confdir handling.Didier Roche
Add tests to cover StartConfDir with custom services path.
2021-12-03Attempt to modernize the repov1.0.0Michael Steinert
2019-02-15Update CI build matrix & fix some lintMichael Steinert
2015-12-04Remove dead codeMichael Steinert
2015-04-10Test some failure conditionsMichael Steinert
2015-04-10Fix golint warningsMichael Steinert
2015-04-09Improve test coverageMichael Steinert
2015-03-30Test coverage for SetItem/GetItemMichael Steinert
2015-03-30Fix a silly bug and add test coverageMichael Steinert
2015-03-30Rework pam_getenvlist so it doesn't leakMichael Steinert
2015-03-29Add a test suiteMichael Steinert