summaryrefslogtreecommitdiff
path: root/transaction.c
diff options
context:
space:
mode:
authorDidier Roche <[email protected]>2022-09-16 08:09:26 +0200
committerDidier Roche <[email protected]>2022-09-16 08:09:26 +0200
commitbc958bdbd745ac622cf332152816669cc4fb108a (patch)
tree206196a2278afe6c0626e76b567da786836fa1b8 /transaction.c
parentf401703daf29acc07acb7d078755f4eb0bcd6e8c (diff)
Allow to define confdir
PAM has a pam_start_confdir() which allows to define the configuration directory where all services are located. This is useful to define your own service on tests in particular, so that you can control your stack and be independant of the host when running them. Allow defining this configuration directory, with a new StartConfDir function. Also, allow pre-checking for the API availability with CheckPamHasStartConfdir().
Diffstat (limited to 'transaction.c')
-rw-r--r--transaction.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/transaction.c b/transaction.c
index c8ca4d2..07155e1 100644
--- a/transaction.c
+++ b/transaction.c
@@ -50,3 +50,12 @@ void init_pam_conv(struct pam_conv *conv, long c)
conv->conv = cb_pam_conv;
conv->appdata_ptr = (void *)c;
}
+
+// pam_start_confdir is a recent PAM api to declare a confdir (mostly for tests)
+// weaken the linking dependency to detect if it’s present.
+int pam_start_confdir(const char *service_name, const char *user, const struct pam_conv *pam_conversation, const char *confdir, pam_handle_t **pamh) __attribute__ ((weak));
+int check_pam_start_confdir(void) {
+ if (pam_start_confdir == NULL)
+ return 1;
+ return 0;
+}