mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-16 09:31:53 +03:00
iis: fixies the Installer.cpp coding style
This commit is contained in:
committed by
Felipe Zimmerle
parent
91738f93bc
commit
79875b1af8
@@ -5,7 +5,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#include "targetver.h"
|
|
||||||
#include "XUnzip.h"
|
#include "XUnzip.h"
|
||||||
|
|
||||||
// Logging level definition.
|
// Logging level definition.
|
||||||
@@ -58,7 +58,8 @@ class Iis7Config
|
|||||||
WORD windows_event_type;
|
WORD windows_event_type;
|
||||||
if (event_level == EVENT_ERROR) {
|
if (event_level == EVENT_ERROR) {
|
||||||
windows_event_type = EVENTLOG_ERROR_TYPE;
|
windows_event_type = EVENTLOG_ERROR_TYPE;
|
||||||
} else { // if (event_level == EVENT_CRITICAL)
|
}
|
||||||
|
else { // if (event_level == EVENT_CRITICAL)
|
||||||
windows_event_type = EVENTLOG_INFORMATION_TYPE;
|
windows_event_type = EVENTLOG_INFORMATION_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +132,8 @@ class Iis7Config
|
|||||||
WORD windows_event_type;
|
WORD windows_event_type;
|
||||||
if (event_level == EVENT_ERROR) {
|
if (event_level == EVENT_ERROR) {
|
||||||
windows_event_type = EVENTLOG_ERROR_TYPE;
|
windows_event_type = EVENTLOG_ERROR_TYPE;
|
||||||
} else { // if (event_level == EVENT_CRITICAL)
|
}
|
||||||
|
else { // if (event_level == EVENT_CRITICAL)
|
||||||
windows_event_type = EVENTLOG_INFORMATION_TYPE;
|
windows_event_type = EVENTLOG_INFORMATION_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,9 +298,11 @@ if (FAILED(_hr)) { \
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define CHECK_BOOL(expression, msg) \
|
#define CHECK_BOOL(expression, msg) \
|
||||||
|
{ \
|
||||||
if (!expression) {\
|
if (!expression) {\
|
||||||
Log(EVENT_ERROR, msg); \
|
Log(EVENT_ERROR, msg); \
|
||||||
break; \
|
break; \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Iis7Config::Load() {
|
bool Iis7Config::Load() {
|
||||||
@@ -740,7 +744,8 @@ bool Iis7Config::AddToGlobalModules(IAppHostWritableAdminManager* manager,
|
|||||||
if (FAILED(hresult)) {
|
if (FAILED(hresult)) {
|
||||||
Log(EVENT_ERROR, "Unable to access globalModules configuration.");
|
Log(EVENT_ERROR, "Unable to access globalModules configuration.");
|
||||||
break;
|
break;
|
||||||
} else if (&parent == NULL) {
|
}
|
||||||
|
else if (&parent == NULL) {
|
||||||
Log(EVENT_ERROR, "Unable to get globalModules configuration.");
|
Log(EVENT_ERROR, "Unable to get globalModules configuration.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -750,7 +755,8 @@ bool Iis7Config::AddToGlobalModules(IAppHostWritableAdminManager* manager,
|
|||||||
if (FAILED(hresult)) {
|
if (FAILED(hresult)) {
|
||||||
Log(EVENT_ERROR, "Unable to access globalModules child collection.");
|
Log(EVENT_ERROR, "Unable to access globalModules child collection.");
|
||||||
break;
|
break;
|
||||||
} else if (&collection == NULL) {
|
}
|
||||||
|
else if (&collection == NULL) {
|
||||||
Log(EVENT_ERROR, "Unable to get globalModules child collection.");
|
Log(EVENT_ERROR, "Unable to get globalModules child collection.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -825,7 +831,8 @@ bool Iis7Config::AddToModules(IAppHostWritableAdminManager* manager) {
|
|||||||
if (FAILED(hresult)) {
|
if (FAILED(hresult)) {
|
||||||
Log(EVENT_ERROR, "Unable to access modules configuration.");
|
Log(EVENT_ERROR, "Unable to access modules configuration.");
|
||||||
break;
|
break;
|
||||||
} else if (&parent == NULL) {
|
}
|
||||||
|
else if (&parent == NULL) {
|
||||||
Log(EVENT_ERROR, "Unable to get modules configuration.");
|
Log(EVENT_ERROR, "Unable to get modules configuration.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -835,7 +842,8 @@ bool Iis7Config::AddToModules(IAppHostWritableAdminManager* manager) {
|
|||||||
if (FAILED(hresult)) {
|
if (FAILED(hresult)) {
|
||||||
Log(EVENT_ERROR, "Unable to access modules child collection.");
|
Log(EVENT_ERROR, "Unable to access modules child collection.");
|
||||||
break;
|
break;
|
||||||
} else if (&collection == NULL) {
|
}
|
||||||
|
else if (&collection == NULL) {
|
||||||
Log(EVENT_ERROR, "Unable to get modules child collection.");
|
Log(EVENT_ERROR, "Unable to get modules child collection.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -901,7 +909,8 @@ bool Iis7Config::RemoveFromCollection(IAppHostWritableAdminManager* manager,
|
|||||||
if (FAILED(hresult)) {
|
if (FAILED(hresult)) {
|
||||||
Log(EVENT_ERROR, "Unable to access section to remove module.");
|
Log(EVENT_ERROR, "Unable to access section to remove module.");
|
||||||
break;
|
break;
|
||||||
} else if (&parent == NULL) {
|
}
|
||||||
|
else if (&parent == NULL) {
|
||||||
Log(EVENT_ERROR, "Unable to get section to remove module.");
|
Log(EVENT_ERROR, "Unable to get section to remove module.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -911,7 +920,8 @@ bool Iis7Config::RemoveFromCollection(IAppHostWritableAdminManager* manager,
|
|||||||
if (FAILED(hresult)) {
|
if (FAILED(hresult)) {
|
||||||
Log(EVENT_ERROR, "Unable to access collection to remove module.");
|
Log(EVENT_ERROR, "Unable to access collection to remove module.");
|
||||||
break;
|
break;
|
||||||
} else if (&collection == NULL) {
|
}
|
||||||
|
else if (&collection == NULL) {
|
||||||
Log(EVENT_ERROR, "Unable to get collection to remove module.");
|
Log(EVENT_ERROR, "Unable to get collection to remove module.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -939,7 +949,8 @@ bool Iis7Config::RemoveFromCollection(IAppHostWritableAdminManager* manager,
|
|||||||
if (FAILED(hresult)) {
|
if (FAILED(hresult)) {
|
||||||
Log(EVENT_ERROR, "Failed to remove ModSecurity module.");
|
Log(EVENT_ERROR, "Failed to remove ModSecurity module.");
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Log(EVENT_IMPORTANT, "No ModSecurity module is found.");
|
Log(EVENT_IMPORTANT, "No ModSecurity module is found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1174,10 +1185,12 @@ bool Iis7Config::GetFromCollection(IAppHostElementCollection* collection,
|
|||||||
if (FAILED(hresult)) {
|
if (FAILED(hresult)) {
|
||||||
Log(EVENT_ERROR, "Failed to get element from collection.");
|
Log(EVENT_ERROR, "Failed to get element from collection.");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
*element = NULL;
|
*element = NULL;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1278,12 +1291,14 @@ int Iis7Config::GetNativeSystemInfo(SYSTEM_INFO* system_info) {
|
|||||||
if (proc == NULL) {
|
if (proc == NULL) {
|
||||||
if (GetLastError() == ERROR_PROC_NOT_FOUND) {
|
if (GetLastError() == ERROR_PROC_NOT_FOUND) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Log(EVENT_ERROR, "Failed to GetProcAddress (%d).", GetLastError());
|
Log(EVENT_ERROR, "Failed to GetProcAddress (%d).", GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
proc(system_info);
|
proc(system_info);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1298,9 +1313,11 @@ Iis7Config::AppMode Iis7Config::GetAppMode() {
|
|||||||
|
|
||||||
if (sys_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) {
|
if (sys_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) {
|
||||||
return MODE_X86;
|
return MODE_X86;
|
||||||
} else if (sys_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
|
}
|
||||||
|
else if (sys_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
|
||||||
return MODE_X64;
|
return MODE_X64;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return MODE_UNKNOWN;
|
return MODE_UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1672,10 +1689,12 @@ bool Iis7Config::GetFromChildren(IAppHostChildElementCollection* children,
|
|||||||
if (FAILED(hresult)) {
|
if (FAILED(hresult)) {
|
||||||
Log(EVENT_ERROR, "Failed to get element from children.");
|
Log(EVENT_ERROR, "Failed to get element from children.");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
*element = NULL;
|
*element = NULL;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user