[cpp-sp] branch main updated: Add getLocalAddr to HTTP interface.
Scott Cantor
cantor.2 at osu.edu
Fri Oct 17 19:19:45 UTC 2025
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository cpp-sp.
View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=b6804be5e44ba673860c6f4275e23b410fdff5e6
The following commit(s) were added to refs/heads/main by this push:
new b6804be5 Add getLocalAddr to HTTP interface.
b6804be5 is described below
commit b6804be5e44ba673860c6f4275e23b410fdff5e6
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Oct 17 15:19:37 2025 -0400
Add getLocalAddr to HTTP interface.
---
apache/mod_shib4.cpp | 5 ++++-
fastcgi/shibauthorizer.cpp | 4 ++++
fastcgi/shibresponder.cpp | 4 ++++
iis/IIS7Request.cpp | 11 +++++++++++
shibsp/handler/impl/AbstractHandler.cpp | 1 +
shibsp/io/GenericRequest.h | 7 +++++++
6 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/apache/mod_shib4.cpp b/apache/mod_shib4.cpp
index b2e2a52a..3251d34c 100644
--- a/apache/mod_shib4.cpp
+++ b/apache/mod_shib4.cpp
@@ -13,7 +13,7 @@
*/
/**
- * shib_module.cpp
+ * mod_shib4.cpp
*
* Apache module implementation.
*/
@@ -324,6 +324,9 @@ public:
return ret;
return m_req->useragent_ip;
}
+ string getLocalAddr() const {
+ return m_req->connection->local_ip;
+ }
void log(Priority::Value level, const string& msg) const {
AbstractSPRequest::log(level,msg);
ap_log_rerror(
diff --git a/fastcgi/shibauthorizer.cpp b/fastcgi/shibauthorizer.cpp
index 8f6191bf..ee64d5c1 100644
--- a/fastcgi/shibauthorizer.cpp
+++ b/fastcgi/shibauthorizer.cpp
@@ -114,6 +114,10 @@ public:
const char* s = FCGX_GetParam("REMOTE_ADDR", m_req->envp);
return s ? s : "";
}
+ string getLocalAddr() const {
+ const char* s = FCGX_GetParam("LOCAL_ADDR", m_req->envp);
+ return s ? s : "";
+ }
void clearHeader(const char* name) {
// No need, since we use environment variables.
}
diff --git a/fastcgi/shibresponder.cpp b/fastcgi/shibresponder.cpp
index 159f0f41..012a73e0 100644
--- a/fastcgi/shibresponder.cpp
+++ b/fastcgi/shibresponder.cpp
@@ -123,6 +123,10 @@ public:
const char* s = FCGX_GetParam("REMOTE_ADDR", m_req->envp);
return s ? s : "";
}
+ string getLocalAddr() const {
+ const char* s = FCGX_GetParam("LOCAL_ADDR", m_req->envp);
+ return s ? s : "";
+ }
void log(Priority::PriorityLevel level, const string& msg) const {
AbstractSPRequest::log(level,msg);
if (level <= Priority::SHIB_ERROR)
diff --git a/iis/IIS7Request.cpp b/iis/IIS7Request.cpp
index c8c1fc93..7063c62c 100644
--- a/iis/IIS7Request.cpp
+++ b/iis/IIS7Request.cpp
@@ -278,6 +278,17 @@ string IIS7Request::getRemoteAddr() const
return ret;
}
+string IIS7Request::getLocalAddr() const
+{
+ PCSTR addr;
+ DWORD len;
+ HRESULT hr = m_ctx->GetServerVariable("LOCAL_ADDR", &addr, &len);
+ if (SUCCEEDED(hr)) {
+ return addr;
+ }
+ return "";
+}
+
string IIS7Request::getSecureHeader(const char* name) const
{
if (isUseVariables()) {
diff --git a/shibsp/handler/impl/AbstractHandler.cpp b/shibsp/handler/impl/AbstractHandler.cpp
index f8c07510..ddf10beb 100644
--- a/shibsp/handler/impl/AbstractHandler.cpp
+++ b/shibsp/handler/impl/AbstractHandler.cpp
@@ -144,6 +144,7 @@ DDF AbstractHandler::wrapRequest(const SPRequest& request, const set<string>& he
in.addmember("content_length").longinteger(request.getContentLength());
in.addmember("remote_user").string(request.getRemoteUser().c_str());
in.addmember("remote_addr").string(request.getRemoteAddr().c_str());
+ in.addmember("local_addr").string(request.getLocalAddr().c_str());
in.addmember("method").string(request.getMethod());
in.addmember("uri").unsafe_string(request.getRequestURI());
in.addmember("url").unsafe_string(request.getRequestURL());
diff --git a/shibsp/io/GenericRequest.h b/shibsp/io/GenericRequest.h
index 94e5067a..b1a58b96 100644
--- a/shibsp/io/GenericRequest.h
+++ b/shibsp/io/GenericRequest.h
@@ -144,6 +144,13 @@ namespace shibsp {
*/
virtual std::string getRemoteAddr() const=0;
+ /**
+ * Returns the IP address of the server.
+ *
+ * @return the server's IP address
+ */
+ virtual std::string getLocalAddr() const=0;
+
/**
* Converts a relative URL into an absolute one based on the properties of the request.
*
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list