mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-15 17:12:14 +03:00
mujiansu
This commit is contained in:
1
.github/workflows/test-ci-windows.yml
vendored
1
.github/workflows/test-ci-windows.yml
vendored
@@ -224,7 +224,6 @@ jobs:
|
||||
|
||||
$crsRules = @(
|
||||
"Include coreruleset/crs-setup.conf",
|
||||
"Include coreruleset/rules/*.conf",
|
||||
"Include coreruleset/plugins/*-config.conf",
|
||||
"Include coreruleset/plugins/*-before.conf",
|
||||
"Include coreruleset/rules/*.conf",
|
||||
|
||||
@@ -91,40 +91,22 @@ class REQUEST_STORED_CONTEXT : public IHttpStoredContext
|
||||
|
||||
char *GetIpAddr(apr_pool_t *pool, PSOCKADDR pAddr)
|
||||
{
|
||||
if (pAddr == NULL) {
|
||||
return "";
|
||||
}
|
||||
if (pAddr == NULL) {
|
||||
return "";
|
||||
}
|
||||
|
||||
char ipbuf[INET6_ADDRSTRLEN] = {0};
|
||||
const char *res = "";
|
||||
DWORD addrSize = pAddr->sa_family == AF_INET ? sizeof(SOCKADDR_IN) : sizeof(SOCKADDR_IN6);
|
||||
char* buf = (char*)apr_palloc(pool, NI_MAXHOST);
|
||||
if (buf == NULL) {
|
||||
return "";
|
||||
}
|
||||
buf[0] = '\0';
|
||||
|
||||
switch (pAddr->sa_family) {
|
||||
case AF_INET:
|
||||
{
|
||||
SOCKADDR_IN *sin = (SOCKADDR_IN *)pAddr;
|
||||
if (InetNtopA(AF_INET, &sin->sin_addr, ipbuf, sizeof(ipbuf)) != NULL) {
|
||||
res = (const char *)apr_pstrdup(pool, ipbuf);
|
||||
} else {
|
||||
res = "";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AF_INET6:
|
||||
{
|
||||
SOCKADDR_IN6 *sin6 = (SOCKADDR_IN6 *)pAddr;
|
||||
if (InetNtopA(AF_INET6, &sin6->sin6_addr, ipbuf, sizeof(ipbuf)) != NULL) {
|
||||
res = (const char *)apr_pstrdup(pool, ipbuf);
|
||||
} else {
|
||||
res = "";
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
res = "";
|
||||
break;
|
||||
}
|
||||
if (GetNameInfo(pAddr, addrSize, buf, NI_MAXHOST, NULL, 0, NI_NUMERICHOST) != 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return (char *)res;
|
||||
return buf;
|
||||
}
|
||||
|
||||
apr_sockaddr_t *CopySockAddr(apr_pool_t *pool, PSOCKADDR pAddr)
|
||||
|
||||
Reference in New Issue
Block a user