summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pazdziora <jpazdziora@redhat.com>2018-07-15 16:24:03 +0200
committerJan Pazdziora <jpazdziora@redhat.com>2018-07-17 19:24:32 +0200
commit679b087142484c113c1de863a7fb956354dc43a2 (patch)
tree0571a2fbd8175009b49986335a3c7949f48c1f06
parentcba4286a601d00dbf787b84a03efac2156c28b47 (diff)
downloadmod_authnz_pam-679b087142484c113c1de863a7fb956354dc43a2.tar.gz
mod_authnz_pam-679b087142484c113c1de863a7fb956354dc43a2.tar.xz
mod_authnz_pam-679b087142484c113c1de863a7fb956354dc43a2.zip
Skip support for caching on 2.3.7 or older where ap_authn_cache_store did not exist.
-rw-r--r--mod_authnz_pam.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/mod_authnz_pam.c b/mod_authnz_pam.c
index cc7207c..f93ad5c 100644
--- a/mod_authnz_pam.c
+++ b/mod_authnz_pam.c
@@ -144,6 +144,7 @@ module AP_MODULE_DECLARE_DATA authnz_pam_module;
#define SHOW_MODULE "mod_authnz_pam: "
#endif
+#if AP_MODULE_MAGIC_AT_LEAST(20100625,0)
static APR_OPTIONAL_FN_TYPE(ap_authn_cache_store) *authn_cache_store = NULL;
// copied from socache implementations of dbm and dbd @ http://svn.eu.apache.org/viewvc?view=revision&revision=957072
@@ -169,6 +170,7 @@ void store_password_to_cache(request_rec * r, const char * login, const char * p
}
authn_cache_store(r, "PAM", login, NULL, hash);
}
+#endif
#define _REMOTE_USER_ENV_NAME "REMOTE_USER"
#define _EXTERNAL_AUTH_ERROR_ENV_NAME "EXTERNAL_AUTH_ERROR"
@@ -195,9 +197,11 @@ static authn_status pam_authenticate_with_login_password(request_rec * r, const
param = login;
stage = "PAM authentication failed for user";
ret = pam_authenticate(pamh, PAM_SILENT | PAM_DISALLOW_NULL_AUTHTOK);
+#if AP_MODULE_MAGIC_AT_LEAST(20100625,0)
if (ret == PAM_SUCCESS) {
store_password_to_cache(r, login, password);
}
+#endif
}
if ((ret == PAM_SUCCESS) && (steps & _PAM_STEP_ACCOUNT)) {
param = login;
@@ -306,7 +310,9 @@ static void register_hooks(apr_pool_t * p) {
ap_hook_auth_checker(check_user_access, NULL, NULL, APR_HOOK_MIDDLE);
#endif
APR_REGISTER_OPTIONAL_FN(pam_authenticate_with_login_password);
+#if AP_MODULE_MAGIC_AT_LEAST(20100625,0)
ap_hook_optional_fn_retrieve(opt_retr, NULL, NULL, APR_HOOK_MIDDLE);
+#endif
}
#ifdef AP_DECLARE_MODULE