mirror of
https://github.com/php/php-src.git
synced 2026-03-25 16:52:18 +01:00
- WS
This commit is contained in:
@@ -267,63 +267,63 @@ int fcgi_is_fastcgi(void)
|
||||
*/
|
||||
static PACL prepare_named_pipe_acl(PSECURITY_DESCRIPTOR sd, LPSECURITY_ATTRIBUTES sa)
|
||||
{
|
||||
DWORD req_acl_size;
|
||||
char everyone_buf[32], owner_buf[32];
|
||||
PSID sid_everyone, sid_owner;
|
||||
SID_IDENTIFIER_AUTHORITY
|
||||
siaWorld = SECURITY_WORLD_SID_AUTHORITY,
|
||||
siaCreator = SECURITY_CREATOR_SID_AUTHORITY;
|
||||
PACL acl;
|
||||
DWORD req_acl_size;
|
||||
char everyone_buf[32], owner_buf[32];
|
||||
PSID sid_everyone, sid_owner;
|
||||
SID_IDENTIFIER_AUTHORITY
|
||||
siaWorld = SECURITY_WORLD_SID_AUTHORITY,
|
||||
siaCreator = SECURITY_CREATOR_SID_AUTHORITY;
|
||||
PACL acl;
|
||||
|
||||
sid_everyone = (PSID)&everyone_buf;
|
||||
sid_owner = (PSID)&owner_buf;
|
||||
sid_everyone = (PSID)&everyone_buf;
|
||||
sid_owner = (PSID)&owner_buf;
|
||||
|
||||
req_acl_size = sizeof(ACL) +
|
||||
(2 * ((sizeof(ACCESS_ALLOWED_ACE) - sizeof(DWORD)) + GetSidLengthRequired(1)));
|
||||
req_acl_size = sizeof(ACL) +
|
||||
(2 * ((sizeof(ACCESS_ALLOWED_ACE) - sizeof(DWORD)) + GetSidLengthRequired(1)));
|
||||
|
||||
acl = malloc(req_acl_size);
|
||||
acl = malloc(req_acl_size);
|
||||
|
||||
if (acl == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (acl == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!InitializeSid(sid_everyone, &siaWorld, 1)) {
|
||||
goto out_fail;
|
||||
}
|
||||
*GetSidSubAuthority(sid_everyone, 0) = SECURITY_WORLD_RID;
|
||||
if (!InitializeSid(sid_everyone, &siaWorld, 1)) {
|
||||
goto out_fail;
|
||||
}
|
||||
*GetSidSubAuthority(sid_everyone, 0) = SECURITY_WORLD_RID;
|
||||
|
||||
if (!InitializeSid(sid_owner, &siaCreator, 1)) {
|
||||
goto out_fail;
|
||||
}
|
||||
*GetSidSubAuthority(sid_owner, 0) = SECURITY_CREATOR_OWNER_RID;
|
||||
if (!InitializeSid(sid_owner, &siaCreator, 1)) {
|
||||
goto out_fail;
|
||||
}
|
||||
*GetSidSubAuthority(sid_owner, 0) = SECURITY_CREATOR_OWNER_RID;
|
||||
|
||||
if (!InitializeAcl(acl, req_acl_size, ACL_REVISION)) {
|
||||
goto out_fail;
|
||||
}
|
||||
if (!InitializeAcl(acl, req_acl_size, ACL_REVISION)) {
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
if (!AddAccessAllowedAce(acl, ACL_REVISION, FILE_GENERIC_READ | FILE_GENERIC_WRITE, sid_everyone)) {
|
||||
goto out_fail;
|
||||
}
|
||||
if (!AddAccessAllowedAce(acl, ACL_REVISION, FILE_GENERIC_READ | FILE_GENERIC_WRITE, sid_everyone)) {
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
if (!AddAccessAllowedAce(acl, ACL_REVISION, FILE_ALL_ACCESS, sid_owner)) {
|
||||
goto out_fail;
|
||||
}
|
||||
if (!AddAccessAllowedAce(acl, ACL_REVISION, FILE_ALL_ACCESS, sid_owner)) {
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
if (!InitializeSecurityDescriptor(sd, SECURITY_DESCRIPTOR_REVISION)) {
|
||||
goto out_fail;
|
||||
}
|
||||
if (!InitializeSecurityDescriptor(sd, SECURITY_DESCRIPTOR_REVISION)) {
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
if (!SetSecurityDescriptorDacl(sd, TRUE, acl, FALSE)) {
|
||||
goto out_fail;
|
||||
}
|
||||
if (!SetSecurityDescriptorDacl(sd, TRUE, acl, FALSE)) {
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
sa->lpSecurityDescriptor = sd;
|
||||
sa->lpSecurityDescriptor = sd;
|
||||
|
||||
return acl;
|
||||
return acl;
|
||||
|
||||
out_fail:
|
||||
free(acl);
|
||||
return NULL;
|
||||
free(acl);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -960,13 +960,13 @@ int fcgi_accept_request(fcgi_request *req)
|
||||
int n = 0;
|
||||
int allowed = 0;
|
||||
|
||||
while (allowed_clients[n] != INADDR_NONE) {
|
||||
if (allowed_clients[n] == sa.sa_inet.sin_addr.s_addr) {
|
||||
allowed = 1;
|
||||
break;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
while (allowed_clients[n] != INADDR_NONE) {
|
||||
if (allowed_clients[n] == sa.sa_inet.sin_addr.s_addr) {
|
||||
allowed = 1;
|
||||
break;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
if (!allowed) {
|
||||
fprintf(stderr, "Connection from disallowed IP address '%s' is dropped.\n", inet_ntoa(sa.sa_inet.sin_addr));
|
||||
closesocket(req->fd);
|
||||
|
||||
Reference in New Issue
Block a user