mirror of https://github.com/Icinga/icinga2.git
Remove extraneous whitespace
This commit is contained in:
parent
bd20951acd
commit
42744fde5b
|
@ -59,7 +59,7 @@ static HANDLE l_Job;
|
|||
static std::vector<String> GetLogLevelCompletionSuggestions(const String& arg)
|
||||
{
|
||||
std::vector<String> result;
|
||||
|
||||
|
||||
String debugLevel = "debug";
|
||||
if (debugLevel.Find(arg) == 0)
|
||||
result.push_back(debugLevel);
|
||||
|
@ -460,10 +460,10 @@ static int Main(void)
|
|||
} else if (command && command->GetImpersonationLevel() == ImpersonateIcinga) {
|
||||
String group = Application::GetRunAsGroup();
|
||||
String user = Application::GetRunAsUser();
|
||||
|
||||
|
||||
errno = 0;
|
||||
struct group *gr = getgrnam(group.CStr());
|
||||
|
||||
|
||||
if (!gr) {
|
||||
if (errno == 0) {
|
||||
Log(LogCritical, "cli")
|
||||
|
@ -475,7 +475,7 @@ static int Main(void)
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (getgid() != gr->gr_gid) {
|
||||
if (!vm.count("reload-internal") && setgroups(0, NULL) < 0) {
|
||||
Log(LogCritical, "cli")
|
||||
|
@ -484,17 +484,17 @@ static int Main(void)
|
|||
<< "Please re-run this command as a privileged user or using the \"" << user << "\" account.";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
if (setgid(gr->gr_gid) < 0) {
|
||||
Log(LogCritical, "cli")
|
||||
<< "setgid() failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\"";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
errno = 0;
|
||||
struct passwd *pw = getpwnam(user.CStr());
|
||||
|
||||
|
||||
if (!pw) {
|
||||
if (errno == 0) {
|
||||
Log(LogCritical, "cli")
|
||||
|
@ -506,7 +506,7 @@ static int Main(void)
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// also activate the additional groups the configured user is member of
|
||||
if (getuid() != pw->pw_uid) {
|
||||
if (!vm.count("reload-internal") && initgroups(user.CStr(), pw->pw_gid) < 0) {
|
||||
|
@ -516,7 +516,7 @@ static int Main(void)
|
|||
<< "Please re-run this command as a privileged user or using the \"" << user << "\" account.";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
if (setuid(pw->pw_uid) < 0) {
|
||||
Log(LogCritical, "cli")
|
||||
<< "setuid() failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\"";
|
||||
|
@ -780,7 +780,7 @@ static VOID WINAPI ServiceMain(DWORD argc, LPSTR *argv)
|
|||
break;
|
||||
|
||||
DWORD exitStatus;
|
||||
|
||||
|
||||
if (!GetExitCodeProcess(pi.hProcess, &exitStatus))
|
||||
break;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ BEGIN
|
|||
VALUE "ProductVersion", VERSION
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 0x04E4
|
||||
|
|
|
@ -54,7 +54,7 @@ static bool ExecuteCommand(const std::string& app, const std::string& arguments)
|
|||
sei.nShow = SW_HIDE;
|
||||
if (!ShellExecuteEx(&sei))
|
||||
return false;
|
||||
|
||||
|
||||
if (!sei.hProcess)
|
||||
return false;
|
||||
|
||||
|
@ -221,7 +221,7 @@ static int UpgradeNSIS(void)
|
|||
return 1;
|
||||
|
||||
_rmdir(installPath.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -14,57 +14,57 @@
|
|||
MainFormBase::MainFormBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxSize( 800,569 ), wxDefaultSize );
|
||||
|
||||
|
||||
m_MenuBar = new wxMenuBar( 0 );
|
||||
wxMenu* m_FileMenu;
|
||||
m_FileMenu = new wxMenu();
|
||||
wxMenuItem* m_QuitMenuItem;
|
||||
m_QuitMenuItem = new wxMenuItem( m_FileMenu, wxID_EXIT, wxString( wxT("&Quit") ) , wxEmptyString, wxITEM_NORMAL );
|
||||
m_FileMenu->Append( m_QuitMenuItem );
|
||||
|
||||
|
||||
m_MenuBar->Append( m_FileMenu, wxT("&File") );
|
||||
|
||||
|
||||
wxMenu* m_HelpMenu;
|
||||
m_HelpMenu = new wxMenu();
|
||||
wxMenuItem* m_AboutMenuItem;
|
||||
m_AboutMenuItem = new wxMenuItem( m_HelpMenu, wxID_ABOUT, wxString( wxT("&About Icinga Studio...") ) , wxEmptyString, wxITEM_NORMAL );
|
||||
m_HelpMenu->Append( m_AboutMenuItem );
|
||||
|
||||
|
||||
m_MenuBar->Append( m_HelpMenu, wxT("&Help") );
|
||||
|
||||
|
||||
this->SetMenuBar( m_MenuBar );
|
||||
|
||||
|
||||
wxBoxSizer* m_DialogSizer;
|
||||
m_DialogSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
wxBoxSizer* m_ConnectionDetailsSizer;
|
||||
m_ConnectionDetailsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
||||
m_TypesTree = new wxTreeCtrl( this, wxID_ANY, wxDefaultPosition, wxSize( 315,-1 ), wxTR_DEFAULT_STYLE|wxTR_HIDE_ROOT );
|
||||
m_ConnectionDetailsSizer->Add( m_TypesTree, 0, wxALL|wxEXPAND, 2 );
|
||||
|
||||
|
||||
wxBoxSizer* m_ObjectDetailsSizer;
|
||||
m_ObjectDetailsSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
m_ObjectsList = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT );
|
||||
m_ObjectDetailsSizer->Add( m_ObjectsList, 1, wxALL|wxEXPAND, 2 );
|
||||
|
||||
|
||||
m_PropertyGrid = new wxPropertyGrid(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxPG_DEFAULT_STYLE);
|
||||
m_ObjectDetailsSizer->Add( m_PropertyGrid, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
m_ConnectionDetailsSizer->Add( m_ObjectDetailsSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
m_DialogSizer->Add( m_ConnectionDetailsSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
this->SetSizer( m_DialogSizer );
|
||||
this->Layout();
|
||||
m_StatusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
|
||||
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
|
||||
// Connect Events
|
||||
this->Connect( m_QuitMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFormBase::OnQuitClicked ) );
|
||||
this->Connect( m_AboutMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFormBase::OnAboutClicked ) );
|
||||
|
@ -79,89 +79,89 @@ MainFormBase::~MainFormBase()
|
|||
this->Disconnect( wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFormBase::OnAboutClicked ) );
|
||||
m_TypesTree->Disconnect( wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( MainFormBase::OnTypeSelected ), NULL, this );
|
||||
m_ObjectsList->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( MainFormBase::OnObjectSelected ), NULL, this );
|
||||
|
||||
|
||||
}
|
||||
|
||||
ConnectFormBase::ConnectFormBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
|
||||
wxBoxSizer* m_DialogSizer;
|
||||
m_DialogSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
wxPanel* m_ConnectionDetailsPanel;
|
||||
m_ConnectionDetailsPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxStaticBoxSizer* m_DetailsSizer;
|
||||
m_DetailsSizer = new wxStaticBoxSizer( new wxStaticBox( m_ConnectionDetailsPanel, wxID_ANY, wxT("Connection Details") ), wxVERTICAL );
|
||||
|
||||
|
||||
wxStaticText* m_HostLabel;
|
||||
m_HostLabel = new wxStaticText( m_DetailsSizer->GetStaticBox(), wxID_ANY, wxT("Host:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_HostLabel->Wrap( -1 );
|
||||
m_DetailsSizer->Add( m_HostLabel, 0, wxALL, 5 );
|
||||
|
||||
|
||||
m_HostText = new wxTextCtrl( m_DetailsSizer->GetStaticBox(), wxID_OK, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_DetailsSizer->Add( m_HostText, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
wxStaticText* m_PortLabel;
|
||||
m_PortLabel = new wxStaticText( m_DetailsSizer->GetStaticBox(), wxID_ANY, wxT("Port:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_PortLabel->Wrap( -1 );
|
||||
m_DetailsSizer->Add( m_PortLabel, 0, wxALL, 5 );
|
||||
|
||||
|
||||
m_PortText = new wxTextCtrl( m_DetailsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_DetailsSizer->Add( m_PortText, 0, wxALL, 5 );
|
||||
|
||||
|
||||
wxStaticText* m_UserLabel;
|
||||
m_UserLabel = new wxStaticText( m_DetailsSizer->GetStaticBox(), wxID_ANY, wxT("API User:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_UserLabel->Wrap( -1 );
|
||||
m_DetailsSizer->Add( m_UserLabel, 0, wxALL, 5 );
|
||||
|
||||
|
||||
m_UserText = new wxTextCtrl( m_DetailsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_DetailsSizer->Add( m_UserText, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
wxStaticText* m_PasswordLabel;
|
||||
m_PasswordLabel = new wxStaticText( m_DetailsSizer->GetStaticBox(), wxID_ANY, wxT("API Password:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_PasswordLabel->Wrap( -1 );
|
||||
m_DetailsSizer->Add( m_PasswordLabel, 0, wxALL, 5 );
|
||||
|
||||
|
||||
m_PasswordText = new wxTextCtrl( m_DetailsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD );
|
||||
m_DetailsSizer->Add( m_PasswordText, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
wxStaticText* m_InfoLabel;
|
||||
m_InfoLabel = new wxStaticText( m_DetailsSizer->GetStaticBox(), wxID_ANY, wxT("You can find the username and password for the default user in /etc/icinga2/conf.d/api-users.conf."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_InfoLabel->Wrap( 270 );
|
||||
m_DetailsSizer->Add( m_InfoLabel, 0, wxALL, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
m_ConnectionDetailsPanel->SetSizer( m_DetailsSizer );
|
||||
m_ConnectionDetailsPanel->Layout();
|
||||
m_DetailsSizer->Fit( m_ConnectionDetailsPanel );
|
||||
m_DialogSizer->Add( m_ConnectionDetailsPanel, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
||||
wxPanel* m_ButtonsPanel;
|
||||
m_ButtonsPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* m_ButtonsSizer;
|
||||
m_ButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
||||
m_Buttons = new wxStdDialogButtonSizer();
|
||||
m_ButtonsOK = new wxButton( m_ButtonsPanel, wxID_OK );
|
||||
m_Buttons->AddButton( m_ButtonsOK );
|
||||
m_ButtonsCancel = new wxButton( m_ButtonsPanel, wxID_CANCEL );
|
||||
m_Buttons->AddButton( m_ButtonsCancel );
|
||||
m_Buttons->Realize();
|
||||
|
||||
|
||||
m_ButtonsSizer->Add( m_Buttons, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
m_ButtonsPanel->SetSizer( m_ButtonsSizer );
|
||||
m_ButtonsPanel->Layout();
|
||||
m_ButtonsSizer->Fit( m_ButtonsPanel );
|
||||
m_DialogSizer->Add( m_ButtonsPanel, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
this->SetSizer( m_DialogSizer );
|
||||
this->Layout();
|
||||
m_DialogSizer->Fit( this );
|
||||
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
}
|
||||
|
||||
|
@ -172,65 +172,65 @@ ConnectFormBase::~ConnectFormBase()
|
|||
AboutFormBase::AboutFormBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
|
||||
wxBoxSizer* m_DialogSizer;
|
||||
m_DialogSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
wxBoxSizer* m_InfoSizer;
|
||||
m_InfoSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
||||
wxStaticBitmap* m_ProductIcon;
|
||||
m_ProductIcon = new wxStaticBitmap( this, wxID_ANY, wxBitmap( icinga_xpm ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_InfoSizer->Add( m_ProductIcon, 0, wxALL, 5 );
|
||||
|
||||
|
||||
wxBoxSizer* m_AboutInfoSizer;
|
||||
m_AboutInfoSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
wxStaticText* m_ProductNameLabel;
|
||||
m_ProductNameLabel = new wxStaticText( this, wxID_ANY, wxT("Icinga Studio"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ProductNameLabel->Wrap( -1 );
|
||||
m_AboutInfoSizer->Add( m_ProductNameLabel, 0, wxALL, 5 );
|
||||
|
||||
|
||||
m_VersionLabel = new wxStaticText( this, wxID_ANY, wxT("Version"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_VersionLabel->Wrap( -1 );
|
||||
m_AboutInfoSizer->Add( m_VersionLabel, 0, wxALL, 5 );
|
||||
|
||||
|
||||
wxStaticText* m_CopyrightLabel;
|
||||
m_CopyrightLabel = new wxStaticText( this, wxID_ANY, wxT("Copyright (c) 2015 Icinga Development Team"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_CopyrightLabel->Wrap( -1 );
|
||||
m_AboutInfoSizer->Add( m_CopyrightLabel, 0, wxALL, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
m_InfoSizer->Add( m_AboutInfoSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
m_DialogSizer->Add( m_InfoSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
wxPanel* m_ButtonsPanel;
|
||||
m_ButtonsPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* m_ButtonsSizer;
|
||||
m_ButtonsSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
wxStdDialogButtonSizer* m_Buttons;
|
||||
wxButton* m_ButtonsOK;
|
||||
m_Buttons = new wxStdDialogButtonSizer();
|
||||
m_ButtonsOK = new wxButton( m_ButtonsPanel, wxID_OK );
|
||||
m_Buttons->AddButton( m_ButtonsOK );
|
||||
m_Buttons->Realize();
|
||||
|
||||
|
||||
m_ButtonsSizer->Add( m_Buttons, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
m_ButtonsPanel->SetSizer( m_ButtonsSizer );
|
||||
m_ButtonsPanel->Layout();
|
||||
m_ButtonsSizer->Fit( m_ButtonsPanel );
|
||||
m_DialogSizer->Add( m_ButtonsPanel, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
||||
|
||||
|
||||
this->SetSizer( m_DialogSizer );
|
||||
this->Layout();
|
||||
m_DialogSizer->Fit( this );
|
||||
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
}
|
||||
|
||||
|
|
|
@ -42,27 +42,27 @@
|
|||
class MainFormBase : public wxFrame
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
protected:
|
||||
wxMenuBar* m_MenuBar;
|
||||
wxTreeCtrl* m_TypesTree;
|
||||
wxListCtrl* m_ObjectsList;
|
||||
wxPropertyGrid* m_PropertyGrid;
|
||||
wxStatusBar* m_StatusBar;
|
||||
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnQuitClicked( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnAboutClicked( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnTypeSelected( wxTreeEvent& event ) { event.Skip(); }
|
||||
virtual void OnObjectSelected( wxListEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
MainFormBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Icinga Studio"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 800,569 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL );
|
||||
|
||||
|
||||
~MainFormBase();
|
||||
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -71,7 +71,7 @@ class MainFormBase : public wxFrame
|
|||
class ConnectFormBase : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
protected:
|
||||
wxTextCtrl* m_HostText;
|
||||
wxTextCtrl* m_PortText;
|
||||
|
@ -80,12 +80,12 @@ class ConnectFormBase : public wxDialog
|
|||
wxStdDialogButtonSizer* m_Buttons;
|
||||
wxButton* m_ButtonsOK;
|
||||
wxButton* m_ButtonsCancel;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
ConnectFormBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Icinga Studio - Connect"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~ConnectFormBase();
|
||||
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -94,15 +94,15 @@ class ConnectFormBase : public wxDialog
|
|||
class AboutFormBase : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
protected:
|
||||
wxStaticText* m_VersionLabel;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
AboutFormBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("About Icinga Studio"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~AboutFormBase();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif //__FORMS_H__
|
||||
|
|
|
@ -26,7 +26,7 @@ BEGIN
|
|||
VALUE "ProductVersion", VERSION
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 0x04E4
|
||||
|
|
|
@ -45,7 +45,7 @@ MainForm::MainForm(wxWindow *parent, const Url::Ptr& url)
|
|||
SetTitle(title);
|
||||
|
||||
m_ObjectsList->InsertColumn(0, "Name", 0, 300);
|
||||
|
||||
|
||||
m_PropertyGrid->SetColumnCount(3);
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ wxPGProperty *MainForm::ValueToProperty(const String& name, const Value& value)
|
|||
return prop;
|
||||
} else if (value.IsObjectType<Dictionary>()) {
|
||||
wxStringProperty *prop = new wxStringProperty(name.GetData(), wxPG_LABEL);
|
||||
|
||||
|
||||
Dictionary::Ptr dict = value;
|
||||
|
||||
{
|
||||
|
|
|
@ -207,12 +207,12 @@ Array::Ptr Array::ShallowClone(void) const
|
|||
Object::Ptr Array::Clone(void) const
|
||||
{
|
||||
Array::Ptr arr = new Array();
|
||||
|
||||
|
||||
ObjectLock olock(this);
|
||||
for (const Value& val : m_Data) {
|
||||
arr->Add(val.Clone());
|
||||
}
|
||||
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ String Base64::Decode(const String& input)
|
|||
BIO_set_flags(bio64, BIO_FLAGS_BASE64_NO_NL);
|
||||
|
||||
char *outbuf = new char[input.GetLength()];
|
||||
|
||||
|
||||
size_t len = 0;
|
||||
int rc;
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ public:
|
|||
std::vector<String> GetKeys(void) const;
|
||||
|
||||
static Object::Ptr GetPrototype(void);
|
||||
|
||||
|
||||
virtual Object::Ptr Clone(void) const override;
|
||||
|
||||
virtual String ToString(void) const override;
|
||||
|
|
|
@ -291,7 +291,7 @@ static int DecodeEndMapOrArray(void *ctx)
|
|||
static int DecodeStartArray(void *ctx)
|
||||
{
|
||||
JsonContext *context = static_cast<JsonContext *>(ctx);
|
||||
|
||||
|
||||
try {
|
||||
context->Push(new Array());
|
||||
} catch (...) {
|
||||
|
|
|
@ -134,7 +134,7 @@ public:
|
|||
#endif /* I2_DEBUG */
|
||||
|
||||
static Object::Ptr GetPrototype(void);
|
||||
|
||||
|
||||
virtual Object::Ptr Clone(void) const;
|
||||
|
||||
static intrusive_ptr<Type> TypeInstance;
|
||||
|
|
|
@ -115,7 +115,7 @@ static Object::Ptr DeserializeObject(const Object::Ptr& object, const Dictionary
|
|||
return object;
|
||||
|
||||
Object::Ptr instance;
|
||||
|
||||
|
||||
if (object)
|
||||
instance = object;
|
||||
else
|
||||
|
@ -127,7 +127,7 @@ static Object::Ptr DeserializeObject(const Object::Ptr& object, const Dictionary
|
|||
continue;
|
||||
|
||||
int fid = type->GetFieldId(kv.first);
|
||||
|
||||
|
||||
if (fid < 0)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -440,10 +440,10 @@ int MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile,
|
|||
|
||||
X509_REQ_set_version(req, 0);
|
||||
X509_REQ_set_pubkey(req, key);
|
||||
|
||||
|
||||
X509_NAME *name = X509_REQ_get_subject_name(req);
|
||||
X509_NAME_add_entry_by_txt(name, "CN", MBSTRING_ASC, (unsigned char *)cn.CStr(), -1, -1, 0);
|
||||
|
||||
|
||||
if (!ca) {
|
||||
String san = "DNS:" + cn;
|
||||
X509_EXTENSION *subjectAltNameExt = X509V3_EXT_conf_nid(NULL, NULL, NID_subject_alt_name, const_cast<char *>(san.CStr()));
|
||||
|
@ -457,10 +457,10 @@ int MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile,
|
|||
}
|
||||
|
||||
X509_REQ_sign(req, key, EVP_sha256());
|
||||
|
||||
|
||||
Log(LogInformation, "base")
|
||||
<< "Writing certificate signing request to '" << csrfile << "'.";
|
||||
|
||||
|
||||
bio = BIO_new_file(const_cast<char *>(csrfile.CStr()), "w");
|
||||
|
||||
if (!bio) {
|
||||
|
@ -482,7 +482,7 @@ int MakeX509CSR(const String& cn, const String& keyfile, const String& csrfile,
|
|||
}
|
||||
|
||||
BIO_free(bio);
|
||||
|
||||
|
||||
X509_REQ_free(req);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ public:
|
|||
virtual Value GetField(int id) const override;
|
||||
|
||||
virtual std::vector<String> GetLoadDependencies(void) const;
|
||||
|
||||
|
||||
typedef std::function<void (const Object::Ptr&, const Value&)> AttributeHandler;
|
||||
virtual void RegisterAttributeHandler(int fieldId, const AttributeHandler& callback);
|
||||
|
||||
|
@ -125,7 +125,7 @@ public:
|
|||
virtual int GetFieldId(const String& name) const override;
|
||||
virtual Field GetFieldInfo(int id) const override;
|
||||
virtual int GetFieldCount(void) const override;
|
||||
|
||||
|
||||
static Object::Ptr GetPrototype(void);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -35,7 +35,7 @@ static void TypeRegisterAttributeHandler(const String& fieldName, const Function
|
|||
{
|
||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||
Type::Ptr self = static_cast<Type::Ptr>(vframe->Self);
|
||||
|
||||
|
||||
int fid = self->GetFieldId(fieldName);
|
||||
self->RegisterAttributeHandler(fid, std::bind(&InvokeAttributeHandlerHelper, callback, _1, _2));
|
||||
}
|
||||
|
|
|
@ -280,7 +280,7 @@ public:
|
|||
String GetTypeName(void) const;
|
||||
|
||||
Type::Ptr GetReflectionType(void) const;
|
||||
|
||||
|
||||
Value Clone(void) const;
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -68,10 +68,10 @@ void CompatLogger::Start(bool runtimeCreated)
|
|||
Downtime::OnDowntimeTriggered.connect(std::bind(&CompatLogger::TriggerDowntimeHandler, this, _1));
|
||||
Downtime::OnDowntimeRemoved.connect(std::bind(&CompatLogger::RemoveDowntimeHandler, this, _1));
|
||||
Checkable::OnEventCommandExecuted.connect(std::bind(&CompatLogger::EventCommandHandler, this, _1));
|
||||
|
||||
|
||||
Checkable::OnFlappingChanged.connect(std::bind(&CompatLogger::FlappingChangedHandler, this, _1));
|
||||
Checkable::OnEnableFlappingChanged.connect(std::bind(&CompatLogger::EnableFlappingChangedHandler, this, _1));
|
||||
|
||||
|
||||
ExternalCommandProcessor::OnNewExternalCommand.connect(std::bind(&CompatLogger::ExternalCommandHandler, this, _2, _3));
|
||||
|
||||
m_RotationTimer = new Timer();
|
||||
|
@ -315,7 +315,7 @@ void CompatLogger::FlappingChangedHandler(const Checkable::Ptr& checkable)
|
|||
|
||||
String flapping_state_str;
|
||||
String flapping_output;
|
||||
|
||||
|
||||
if (checkable->IsFlapping()) {
|
||||
flapping_output = "Checkable appears to have started flapping (" + Convert::ToString(checkable->GetFlappingCurrent()) + "% change >= " + Convert::ToString(checkable->GetFlappingThresholdHigh()) + "% threshold)";
|
||||
flapping_state_str = "STARTED";
|
||||
|
@ -356,7 +356,7 @@ void CompatLogger::EnableFlappingChangedHandler(const Checkable::Ptr& checkable)
|
|||
|
||||
if (checkable->GetEnableFlapping())
|
||||
return;
|
||||
|
||||
|
||||
String flapping_output = "Flap detection has been disabled";
|
||||
String flapping_state_str = "DISABLED";
|
||||
|
||||
|
|
|
@ -674,7 +674,7 @@ lterm: T_LIBRARY rterm
|
|||
}
|
||||
| rterm_side_effect
|
||||
;
|
||||
|
||||
|
||||
rterm_items: /* empty */
|
||||
{
|
||||
$$ = new std::vector<Expression *>();
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
|
||||
void SetZone(const String& zone);
|
||||
String GetZone(void) const;
|
||||
|
||||
|
||||
void SetPackage(const String& package);
|
||||
String GetPackage(void) const;
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
Dictionary::Ptr GetScope(void) const;
|
||||
|
||||
ConfigObject::Ptr GetObject(void) const;
|
||||
|
||||
|
||||
static ConfigItem::Ptr GetByTypeAndName(const Type::Ptr& type,
|
||||
const String& name);
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ public:
|
|||
BinaryExpression(Expression *operand1, Expression *operand2, const DebugInfo& debugInfo = DebugInfo())
|
||||
: DebuggableExpression(debugInfo), m_Operand1(operand1), m_Operand2(operand2)
|
||||
{ }
|
||||
|
||||
|
||||
~BinaryExpression(void)
|
||||
{
|
||||
delete m_Operand1;
|
||||
|
@ -325,7 +325,7 @@ private:
|
|||
|
||||
friend I2_CONFIG_API void BindToScope(Expression *& expr, ScopeSpecifier scopeSpec);
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API NegateExpression : public UnaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -336,7 +336,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API LogicalNegateExpression : public UnaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -358,7 +358,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API SubtractExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -369,7 +369,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API MultiplyExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -380,7 +380,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API DivideExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -424,7 +424,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API BinaryOrExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -435,7 +435,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API ShiftLeftExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -446,7 +446,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API ShiftRightExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -457,7 +457,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API EqualExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -468,7 +468,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API NotEqualExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -479,7 +479,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API LessThanExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -490,7 +490,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API GreaterThanExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -501,7 +501,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API LessThanOrEqualExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -512,7 +512,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API GreaterThanOrEqualExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -523,7 +523,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API InExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -534,7 +534,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API NotInExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -545,7 +545,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API LogicalAndExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -556,7 +556,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API LogicalOrExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -567,7 +567,7 @@ public:
|
|||
protected:
|
||||
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API FunctionCallExpression : public DebuggableExpression
|
||||
{
|
||||
public:
|
||||
|
@ -590,7 +590,7 @@ public:
|
|||
Expression *m_FName;
|
||||
std::vector<Expression *> m_Args;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API ArrayExpression : public DebuggableExpression
|
||||
{
|
||||
public:
|
||||
|
@ -610,7 +610,7 @@ protected:
|
|||
private:
|
||||
std::vector<Expression *> m_Expressions;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API DictExpression : public DebuggableExpression
|
||||
{
|
||||
public:
|
||||
|
@ -635,7 +635,7 @@ private:
|
|||
|
||||
friend I2_CONFIG_API void BindToScope(Expression *& expr, ScopeSpecifier scopeSpec);
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API SetExpression : public BinaryExpression
|
||||
{
|
||||
public:
|
||||
|
@ -924,7 +924,7 @@ private:
|
|||
std::map<String, Expression *> *m_ClosedVars;
|
||||
std::shared_ptr<Expression> m_Expression;
|
||||
};
|
||||
|
||||
|
||||
class I2_CONFIG_API ForExpression : public DebuggableExpression
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -1182,7 +1182,7 @@ void DbEvents::AddFlappingChangedLogHistory(const Checkable::Ptr& checkable)
|
|||
{
|
||||
String flapping_state_str;
|
||||
String flapping_output;
|
||||
|
||||
|
||||
if (checkable->IsFlapping()) {
|
||||
flapping_output = "Service appears to have started flapping (" + Convert::ToString(checkable->GetFlappingCurrent()) + "% change >= " + Convert::ToString(checkable->GetFlappingThresholdHigh()) + "% threshold)";
|
||||
flapping_state_str = "STARTED";
|
||||
|
@ -1219,7 +1219,7 @@ void DbEvents::AddEnableFlappingChangedLogHistory(const Checkable::Ptr& checkabl
|
|||
{
|
||||
if (!checkable->GetEnableFlapping())
|
||||
return;
|
||||
|
||||
|
||||
String flapping_output = "Flap detection has been disabled";
|
||||
String flapping_state_str = "DISABLED";
|
||||
|
||||
|
@ -1348,7 +1348,7 @@ void DbEvents::AddEnableFlappingChangedHistory(const Checkable::Ptr& checkable)
|
|||
|
||||
if (!checkable->GetEnableFlapping())
|
||||
return;
|
||||
|
||||
|
||||
fields1->Set("event_type", 1001);
|
||||
fields1->Set("reason_type", 2);
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ bool Dependency::EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyR
|
|||
} else if (vinstances.IsObjectType<Dictionary>()) {
|
||||
if (rule.GetFVVar().IsEmpty())
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Array iterator requires value to be an array.", di));
|
||||
|
||||
|
||||
Dictionary::Ptr dict = vinstances;
|
||||
|
||||
for (const String& key : dict->GetKeys()) {
|
||||
|
|
|
@ -91,7 +91,7 @@ void Dependency::OnAllConfigLoaded(void)
|
|||
else
|
||||
m_Child = childHost->GetServiceByShortName(GetChildServiceName());
|
||||
}
|
||||
|
||||
|
||||
if (!m_Child)
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Dependency '" + GetName() + "' references a child host/service which doesn't exist.", GetDebugInfo()));
|
||||
|
||||
|
@ -105,7 +105,7 @@ void Dependency::OnAllConfigLoaded(void)
|
|||
else
|
||||
m_Parent = parentHost->GetServiceByShortName(GetParentServiceName());
|
||||
}
|
||||
|
||||
|
||||
if (!m_Parent)
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Dependency '" + GetName() + "' references a parent host/service which doesn't exist.", GetDebugInfo()));
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ bool Notification::EvaluateApplyRule(const Checkable::Ptr& checkable, const Appl
|
|||
} else if (vinstances.IsObjectType<Dictionary>()) {
|
||||
if (rule.GetFVVar().IsEmpty())
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Array iterator requires value to be an array.", di));
|
||||
|
||||
|
||||
Dictionary::Ptr dict = vinstances;
|
||||
|
||||
for (const String& key : dict->GetKeys()) {
|
||||
|
|
|
@ -134,7 +134,7 @@ bool ScheduledDowntime::EvaluateApplyRule(const Checkable::Ptr& checkable, const
|
|||
} else if (vinstances.IsObjectType<Dictionary>()) {
|
||||
if (rule.GetFVVar().IsEmpty())
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Array iterator requires value to be an array.", di));
|
||||
|
||||
|
||||
Dictionary::Ptr dict = vinstances;
|
||||
|
||||
for (const String& key : dict->GetKeys()) {
|
||||
|
|
|
@ -123,7 +123,7 @@ bool Service::EvaluateApplyRule(const Host::Ptr& host, const ApplyRule& rule)
|
|||
} else if (vinstances.IsObjectType<Dictionary>()) {
|
||||
if (rule.GetFVVar().IsEmpty())
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Array iterator requires value to be an array.", di));
|
||||
|
||||
|
||||
Dictionary::Ptr dict = vinstances;
|
||||
|
||||
for (const String& key : dict->GetKeys()) {
|
||||
|
|
|
@ -49,9 +49,9 @@ public:
|
|||
|
||||
protected:
|
||||
Aggregator(void);
|
||||
|
||||
|
||||
Filter::Ptr GetFilter(void) const;
|
||||
|
||||
|
||||
private:
|
||||
Filter::Ptr m_Filter;
|
||||
};
|
||||
|
|
|
@ -104,7 +104,7 @@ public:
|
|||
typedef std::function<void(boost::exception_ptr, const Value&)> ExecuteScriptCompletionCallback;
|
||||
void ExecuteScript(const String& session, const String& command, bool sandboxed,
|
||||
const ExecuteScriptCompletionCallback& callback) const;
|
||||
|
||||
|
||||
typedef std::function<void(boost::exception_ptr, const Array::Ptr&)> AutocompleteScriptCompletionCallback;
|
||||
void AutocompleteScript(const String& session, const String& command, bool sandboxed,
|
||||
const AutocompleteScriptCompletionCallback& callback) const;
|
||||
|
|
|
@ -91,12 +91,12 @@ public:
|
|||
|
||||
/* filesync */
|
||||
static Value ConfigUpdateHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
||||
|
||||
|
||||
/* configsync */
|
||||
static void ConfigUpdateObjectHandler(const ConfigObject::Ptr& object, const Value& cookie);
|
||||
static Value ConfigUpdateObjectAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
||||
static Value ConfigDeleteObjectAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
||||
|
||||
|
||||
static Value HelloAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
||||
|
||||
static void UpdateObjectAuthority(void);
|
||||
|
|
|
@ -264,7 +264,7 @@ static void AddSuggestions(std::vector<String>& matches, const String& word, con
|
|||
}
|
||||
|
||||
std::vector<String> ConsoleHandler::GetAutocompletionSuggestions(const String& word, ScriptFrame& frame)
|
||||
{
|
||||
{
|
||||
std::vector<String> matches;
|
||||
|
||||
for (const String& keyword : ConfigWriter::GetKeywords()) {
|
||||
|
|
|
@ -58,7 +58,7 @@ Dictionary::Ptr ObjectQueryHandler::SerializeObjectAttrs(const Object::Ptr& obje
|
|||
ObjectLock olock(attrs);
|
||||
for (const String& attr : attrs) {
|
||||
String userAttr;
|
||||
|
||||
|
||||
if (isJoin) {
|
||||
String::SizeType dpos = attr.FindFirstOf(".");
|
||||
if (dpos == String::NPos)
|
||||
|
|
|
@ -51,7 +51,7 @@ INT wmain(INT argc, WCHAR **argv)
|
|||
ret = check_drives(vDrives, printInfo.exclude_drives);
|
||||
else
|
||||
ret = check_drives(vDrives, printInfo);
|
||||
|
||||
|
||||
if (ret != -1)
|
||||
return ret;
|
||||
|
||||
|
@ -165,7 +165,7 @@ static INT parseArguments(INT ac, WCHAR **av, po::variables_map& vm, printInfoSt
|
|||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (vm.count("path"))
|
||||
printInfo.drives = vm["path"].as<std::vector<std::wstring>>();
|
||||
|
||||
|
@ -208,7 +208,7 @@ static INT printOutput(printInfoStruct& printInfo, std::vector<drive>& vDrives)
|
|||
|
||||
if (printInfo.showUsed)
|
||||
output = L"DISK OK - used space:";
|
||||
|
||||
|
||||
double tCap = 0, tFree = 0, tUsed = 0;
|
||||
|
||||
for (std::vector<drive>::iterator it = vDrives.begin(); it != vDrives.end(); it++) {
|
||||
|
@ -249,7 +249,7 @@ static INT printOutput(printInfoStruct& printInfo, std::vector<drive>& vDrives)
|
|||
|
||||
if (state == WARNING) {
|
||||
output = L"DISK WARNING - free space:";
|
||||
|
||||
|
||||
if (printInfo.showUsed)
|
||||
output = L"DISK WARNING - used space:";
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ INT wmain(INT argc, WCHAR **argv)
|
|||
ret = check_network(vInterfaces);
|
||||
if (ret != -1)
|
||||
return ret;
|
||||
|
||||
|
||||
return printOutput(printInfo, vInterfaces, mapNames);
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ INT parseArguments(INT ac, WCHAR **av, po::variables_map& vm, printInfoStruct& p
|
|||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (vm.count("debug"))
|
||||
debug = TRUE;
|
||||
|
||||
|
@ -249,11 +249,11 @@ INT check_network(std::vector <nInterface>& vInterfaces)
|
|||
err = PdhAddEnglishCounter(phQuery, perfIn, NULL, &phCounterIn);
|
||||
if (!SUCCEEDED(err))
|
||||
goto die;
|
||||
|
||||
|
||||
err = PdhAddEnglishCounter(phQuery, perfOut, NULL, &phCounterOut);
|
||||
if (!SUCCEEDED(err))
|
||||
goto die;
|
||||
|
||||
|
||||
if (debug)
|
||||
std::wcout << L"Collecting first batch of query data" << '\n';
|
||||
|
||||
|
@ -275,13 +275,13 @@ INT check_network(std::vector <nInterface>& vInterfaces)
|
|||
|
||||
if (debug)
|
||||
std::wcout << L"Creating formatted counter arrays" << '\n';
|
||||
|
||||
|
||||
err = PdhGetFormattedCounterArray(phCounterIn, PDH_FMT_LONG, &dwBufferSizeIn, &dwItemCount, pDisplayValuesIn);
|
||||
if (err == PDH_MORE_DATA || SUCCEEDED(err))
|
||||
pDisplayValuesIn = reinterpret_cast<PDH_FMT_COUNTERVALUE_ITEM*>(new BYTE[dwItemCount*dwBufferSizeIn]);
|
||||
else
|
||||
goto die;
|
||||
|
||||
|
||||
err = PdhGetFormattedCounterArray(phCounterOut, PDH_FMT_LONG, &dwBufferSizeOut, &dwItemCount, pDisplayValuesOut);
|
||||
if (err == PDH_MORE_DATA || SUCCEEDED(err))
|
||||
pDisplayValuesOut = reinterpret_cast<PDH_FMT_COUNTERVALUE_ITEM*>(new BYTE[dwItemCount*dwBufferSizeIn]);
|
||||
|
|
|
@ -454,7 +454,7 @@ INT check_ping6(CONST printInfoStruct& pi, response& response)
|
|||
std::wcout << L"Dropped: echo reply status " << pEchoReply->Status << '\n';
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
rtt += pEchoReply->RoundTripTime;
|
||||
|
||||
if (debug)
|
||||
|
|
|
@ -292,7 +292,7 @@ INT countProcs(CONST std::wstring user)
|
|||
DomainName = NULL;
|
||||
dwAcctName = 1;
|
||||
dwDomainName = 1;
|
||||
|
||||
|
||||
if (debug)
|
||||
std::wcout << L"Looking up SID" << '\n';
|
||||
|
||||
|
@ -301,7 +301,7 @@ INT countProcs(CONST std::wstring user)
|
|||
(LPDWORD)&dwAcctName, DomainName, (LPDWORD)&dwDomainName, &sidNameUse)
|
||||
&& GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
||||
continue;
|
||||
|
||||
|
||||
AcctName = reinterpret_cast<LPWSTR>(new WCHAR[dwAcctName]);
|
||||
DomainName = reinterpret_cast<LPWSTR>(new WCHAR[dwDomainName]);
|
||||
|
||||
|
@ -316,7 +316,7 @@ INT countProcs(CONST std::wstring user)
|
|||
if (debug)
|
||||
std::wcout << L"Is process of " << wuser << L" (" << numProcs << L")" << '\n';
|
||||
}
|
||||
|
||||
|
||||
delete[] reinterpret_cast<LPWSTR>(AcctName);
|
||||
delete[] reinterpret_cast<LPWSTR>(DomainName);
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ INT parseArguments(INT ac, WCHAR **av, po::variables_map& vm, printInfoStruct& p
|
|||
|
||||
if (vm.count("D"))
|
||||
debug = TRUE;
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ DWORD ServiceStatus(CONST printInfoStruct& printInfo)
|
|||
hService = OpenService(hSCM, printInfo.service.c_str(), SERVICE_QUERY_STATUS);
|
||||
if (hService == NULL)
|
||||
goto die;
|
||||
|
||||
|
||||
QueryServiceStatusEx(hService, SC_STATUS_PROCESS_INFO, NULL, 0, &cbBufSize);
|
||||
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
||||
goto die;
|
||||
|
|
|
@ -40,7 +40,7 @@ INT wmain(INT argc, WCHAR **argv)
|
|||
INT ret = parseArguments(argc, argv, vm, printInfo);
|
||||
if (ret != -1)
|
||||
return ret;
|
||||
|
||||
|
||||
ret = check_update(printInfo);
|
||||
if (ret != -1)
|
||||
return ret;
|
||||
|
|
|
@ -35,7 +35,7 @@ INT wmain(INT argc, WCHAR **argv)
|
|||
po::variables_map vm;
|
||||
printInfoStruct printInfo = { };
|
||||
INT ret = parseArguments(argc, argv, vm, printInfo);
|
||||
|
||||
|
||||
if (ret != -1)
|
||||
return ret;
|
||||
|
||||
|
@ -51,7 +51,7 @@ INT parseArguments(INT ac, WCHAR **av, po::variables_map& vm, printInfoStruct& p
|
|||
WCHAR *progName = PathFindFileName(namePath);
|
||||
|
||||
po::options_description desc;
|
||||
|
||||
|
||||
desc.add_options()
|
||||
("help,h", "Print help message and exit")
|
||||
("version,V", "Print version and exit")
|
||||
|
@ -198,7 +198,7 @@ VOID getUptime(printInfoStruct& printInfo)
|
|||
std::wcout << L"Getting uptime in milliseconds" << '\n';
|
||||
|
||||
boost::chrono::milliseconds uptime = boost::chrono::milliseconds(GetTickCount64());
|
||||
|
||||
|
||||
if (debug)
|
||||
std::wcout << L"Converting requested unit (default: seconds)" << '\n';
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ INT check_users(printInfoStruct& printInfo)
|
|||
|
||||
if (debug)
|
||||
std::wcout << L"Trying to enumerate terminal sessions" << '\n';
|
||||
|
||||
|
||||
if (!WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1, &pSessionInfo, &count)) {
|
||||
std::wcout << L"Failed to enumerate terminal sessions" << '\n';
|
||||
die();
|
||||
|
@ -218,7 +218,7 @@ INT check_users(printInfoStruct& printInfo)
|
|||
|
||||
if (!len)
|
||||
continue;
|
||||
|
||||
|
||||
if (pSessionInfo[index].State == WTSActive || pSessionInfo[index].State == WTSDisconnected) {
|
||||
users++;
|
||||
if (debug)
|
||||
|
|
|
@ -122,7 +122,7 @@ std::wstring threshold::pString(CONST DOUBLE max)
|
|||
.append(upperStr).append(L"]");
|
||||
} else
|
||||
s.append(lowerStr);
|
||||
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue