if ((osver.dwPlatformId == VER_PLATFORM_WIN32_NT)
&& (osver.dwMajorVersion > 4)
&& (ChangeServiceConfig2)
- && (schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS)))
+ && (schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT)))
{
SC_HANDLE schService = OpenService(schSCManager, mpm_service_name,
- SERVICE_ALL_ACCESS);
+ SERVICE_CHANGE_CONFIG);
if (schService) {
/* Cast is necessary, ChangeServiceConfig2 handles multiple
* object types, some volatile, some not.
{
SC_HANDLE schService;
SC_HANDLE schSCManager;
-
- // TODO: Determine the minimum permissions required for security
+
schSCManager = OpenSCManager(NULL, NULL, /* local, default database */
- SC_MANAGER_ALL_ACCESS);
+ SC_MANAGER_CREATE_SERVICE);
if (!schSCManager) {
rv = apr_get_os_error();
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
if (reconfig) {
/* ###: utf-ize */
schService = OpenService(schSCManager, mpm_service_name,
- SERVICE_ALL_ACCESS);
+ SERVICE_CHANGE_CONFIG);
if (!schService) {
ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_ERR,
apr_get_os_error(), NULL,
fprintf(stderr,"Removing the %s service\n", mpm_display_name);
- // TODO: Determine the minimum permissions required for security
schSCManager = OpenSCManager(NULL, NULL, /* local, default database */
- SC_MANAGER_ALL_ACCESS);
+ SC_MANAGER_CONNECT);
if (!schSCManager) {
rv = apr_get_os_error();
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
}
/* ###: utf-ize */
- schService = OpenService(schSCManager, mpm_service_name, SERVICE_ALL_ACCESS);
+ schService = OpenService(schSCManager, mpm_service_name, DELETE);
if (!schService) {
rv = apr_get_os_error();
SC_HANDLE schService;
SC_HANDLE schSCManager;
- // TODO: Determine the minimum permissions required for security
schSCManager = OpenSCManager(NULL, NULL, /* local, default database */
- SC_MANAGER_ALL_ACCESS);
+ SC_MANAGER_CONNECT);
if (!schSCManager) {
rv = apr_get_os_error();
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
SC_HANDLE schSCManager;
schSCManager = OpenSCManager(NULL, NULL, // default machine & database
- SC_MANAGER_ALL_ACCESS);
+ SC_MANAGER_CONNECT);
if (!schSCManager) {
ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(), NULL,
/* ###: utf-ize */
schService = OpenService(schSCManager, mpm_service_name,
- SERVICE_ALL_ACCESS);
+ SERVICE_INTERROGATE | SERVICE_QUERY_STATUS |
+ SERVICE_START | SERVICE_STOP);
if (schService == NULL) {
/* Could not open the service */