Pass NULL instead of a "null ACL"

Submitted By: Ivan Zhakov



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1889037 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eric Covener
2021-04-21 01:03:46 +00:00
parent 6141d5aa3f
commit 5c1380bcb6
3 changed files with 2 additions and 54 deletions

View File

@ -94,9 +94,6 @@ typedef enum {
FARPROC ap_load_dll_func(ap_dlltoken_e fnLib, char* fnName, int ordinal);
PSECURITY_ATTRIBUTES GetNullACL(void);
void CleanNullACL(void *sa);
#define AP_DECLARE_LATE_DLL_FUNC(lib, rettype, calltype, fn, ord, args, names) \
typedef rettype (calltype *ap_winapi_fpt_##fn) args; \
static ap_winapi_fpt_##fn ap_winapi_pfn_##fn = NULL; \

View File

@ -101,48 +101,3 @@ FARPROC ap_load_dll_func(ap_dlltoken_e fnLib, char* fnName, int ordinal)
else
return GetProcAddress(lateDllHandle[fnLib], fnName);
}
/* To share the semaphores with other processes, we need a NULL ACL
* Code from MS KB Q106387
*/
PSECURITY_ATTRIBUTES GetNullACL(void)
{
PSECURITY_DESCRIPTOR pSD;
PSECURITY_ATTRIBUTES sa;
sa = (PSECURITY_ATTRIBUTES) LocalAlloc(LPTR, sizeof(SECURITY_ATTRIBUTES));
sa->nLength = sizeof(SECURITY_ATTRIBUTES);
pSD = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
sa->lpSecurityDescriptor = pSD;
if (pSD == NULL || sa == NULL) {
return NULL;
}
apr_set_os_error(0);
if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION)
|| apr_get_os_error()) {
LocalFree( pSD );
LocalFree( sa );
return NULL;
}
if (!SetSecurityDescriptorDacl(pSD, TRUE, (PACL) NULL, FALSE)
|| apr_get_os_error()) {
LocalFree( pSD );
LocalFree( sa );
return NULL;
}
sa->bInheritHandle = FALSE;
return sa;
}
void CleanNullACL(void *sa)
{
if (sa) {
LocalFree(((PSECURITY_ATTRIBUTES)sa)->lpSecurityDescriptor);
LocalFree(sa);
}
}

View File

@ -1574,7 +1574,6 @@ static int winnt_post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pt
/* This code should be run once in the parent and not run
* across a restart
*/
PSECURITY_ATTRIBUTES sa = GetNullACL(); /* returns NULL if invalid (Win95?) */
setup_signal_names(apr_psprintf(pconf, "ap%lu", parent_pid));
ap_log_pid(pconf, ap_pid_fname);
@ -1582,26 +1581,23 @@ static int winnt_post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pt
/* Create shutdown event, apPID_shutdown, where PID is the parent
* Apache process ID. Shutdown is signaled by 'apache -k shutdown'.
*/
shutdown_event = CreateEvent(sa, FALSE, FALSE, signal_shutdown_name);
shutdown_event = CreateEvent(NULL, FALSE, FALSE, signal_shutdown_name);
if (!shutdown_event) {
ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf, APLOGNO(00448)
"Parent: Cannot create shutdown event %s", signal_shutdown_name);
CleanNullACL((void *)sa);
return HTTP_INTERNAL_SERVER_ERROR;
}
/* Create restart event, apPID_restart, where PID is the parent
* Apache process ID. Restart is signaled by 'apache -k restart'.
*/
restart_event = CreateEvent(sa, FALSE, FALSE, signal_restart_name);
restart_event = CreateEvent(NULL, FALSE, FALSE, signal_restart_name);
if (!restart_event) {
CloseHandle(shutdown_event);
ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf, APLOGNO(00449)
"Parent: Cannot create restart event %s", signal_restart_name);
CleanNullACL((void *)sa);
return HTTP_INTERNAL_SERVER_ERROR;
}
CleanNullACL((void *)sa);
/* Create the start mutex, as an unnamed object for security.
* The start mutex is used during a restart to prevent more than