diff options
author | Jake Chen <jakechenTW@gmail.com> | 2021-03-30 09:38:58 +0800 |
---|---|---|
committer | Jan Pazdziora <jpazdziora@redhat.com> | 2021-03-30 08:46:20 +0200 |
commit | ac3ebb23e3271f83be9a7976acd3d48e7a3d45b7 (patch) | |
tree | e0d664fd2f969bd0d61d16a9abd621c2fed770f2 | |
parent | 7d30a9433265402d5c8f9094fd9823cc3bd41167 (diff) | |
download | mod_authnz_pam-ac3ebb23e3271f83be9a7976acd3d48e7a3d45b7.tar.gz mod_authnz_pam-ac3ebb23e3271f83be9a7976acd3d48e7a3d45b7.tar.xz mod_authnz_pam-ac3ebb23e3271f83be9a7976acd3d48e7a3d45b7.zip |
Use ap_get_useragent_host instead of ap_get_remote_host
- according to https://www.apachelounge.com/Changelog-2.4.html,
modules should be updated to inquire for ap_get_useragent_host()
in place of ap_get_remote_host().
- use module magic number 20120211,56 to determine whether to use ap_get_useragent_host
(according to https://github.com/apache/httpd/blob/2.4.x/include/ap_mmn.h)
-rw-r--r-- | mod_authnz_pam.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mod_authnz_pam.c b/mod_authnz_pam.c index 7b4bb7a..7da820f 100644 --- a/mod_authnz_pam.c +++ b/mod_authnz_pam.c @@ -186,7 +186,11 @@ static authn_status pam_authenticate_with_login_password(request_rec * r, const int ret; ret = pam_start(pam_service, login, &pam_conversation, &pamh); if (ret == PAM_SUCCESS) { +#if AP_MODULE_MAGIC_AT_LEAST(20120211,56) + const char * remote_host_or_ip = ap_get_useragent_host(r, REMOTE_NAME, NULL); +#else const char * remote_host_or_ip = ap_get_remote_host(r->connection, r->per_dir_config, REMOTE_NAME, NULL); +#endif if (remote_host_or_ip) { stage = "PAM pam_set_item PAM_RHOST failed for service"; ret = pam_set_item(pamh, PAM_RHOST, remote_host_or_ip); |