minor fixes
authorVictor Kirhenshtein <victor@netxms.org>
Thu, 27 Jan 2011 21:21:09 +0000 (21:21 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Thu, 27 Jan 2011 21:21:09 +0000 (21:21 +0000)
include/nxclapi.h
include/nxtools.h
src/client/windows/nxcon/nxcon.vcproj
src/libnxcl/objtools.cpp
src/libnxcl/server.cpp
src/server/core/session.cpp

index d766447..9ab0bb4 100644 (file)
@@ -2134,6 +2134,7 @@ DWORD LIBNXCL_EXPORTABLE NXCGenerateObjectToolId(NXC_SESSION hSession, DWORD *pd
 DWORD LIBNXCL_EXPORTABLE NXCUpdateObjectTool(NXC_SESSION hSession,
                                              NXC_OBJECT_TOOL_DETAILS *pData);
 BOOL LIBNXCL_EXPORTABLE NXCIsAppropriateTool(NXC_OBJECT_TOOL *pTool, NXC_OBJECT *pObject);
+DWORD LIBNXCL_EXPORTABLE NXCExecuteServerCommand(NXC_SESSION hSession, DWORD nodeId, const TCHAR *command);
 
 /** Script library **/
 DWORD LIBNXCL_EXPORTABLE NXCGetScriptList(NXC_SESSION hSession, DWORD *pdwNumScrpts,
index 3b460e0..b3e292b 100644 (file)
@@ -34,7 +34,7 @@
 #define TOOL_TYPE_TABLE_AGENT       3
 #define TOOL_TYPE_URL               4
 #define TOOL_TYPE_COMMAND           5
-#define TOOL_TYPE_SERVER_SCRIPT     6
+#define TOOL_TYPE_SERVER_COMMAND    6
 
 
 //
index dade784..5255f13 100644 (file)
                        />\r
                </Configuration>\r
                <Configuration\r
-                       Name="Release|Win32"\r
-                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
-                       IntermediateDirectory="$(ConfigurationName)"\r
+                       Name="Debug|x64"\r
+                       OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"\r
+                       IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
                        ConfigurationType="1"\r
                        UseOfMFC="2"\r
                        CharacterSet="1"\r
-                       WholeProgramOptimization="1"\r
                        >\r
                        <Tool\r
                                Name="VCPreBuildEventTool"\r
                        />\r
                        <Tool\r
                                Name="VCMIDLTool"\r
+                               TargetEnvironment="3"\r
                        />\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
                                AdditionalIncludeDirectories="..\..\..\..\include"\r
                                PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS;WINDOWS_ONLY"\r
-                               RuntimeLibrary="2"\r
+                               MinimalRebuild="true"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="3"\r
                                UsePrecompiledHeader="2"\r
                                WarningLevel="3"\r
                                Detect64BitPortabilityProblems="false"\r
                        <Tool\r
                                Name="VCLinkerTool"\r
                                AdditionalDependencies="libeay32.lib dbghelp.lib"\r
-                               LinkIncremental="1"\r
+                               LinkIncremental="2"\r
                                GenerateDebugInformation="true"\r
                                SubSystem="2"\r
-                               OptimizeReferences="2"\r
-                               EnableCOMDATFolding="2"\r
-                               TargetMachine="1"\r
+                               TargetMachine="17"\r
                        />\r
                        <Tool\r
                                Name="VCALinkTool"\r
                        />\r
                </Configuration>\r
                <Configuration\r
-                       Name="Debug|x64"\r
-                       OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"\r
-                       IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+                       IntermediateDirectory="$(ConfigurationName)"\r
                        ConfigurationType="1"\r
                        UseOfMFC="2"\r
                        CharacterSet="1"\r
+                       WholeProgramOptimization="1"\r
                        >\r
                        <Tool\r
                                Name="VCPreBuildEventTool"\r
                        />\r
                        <Tool\r
                                Name="VCMIDLTool"\r
-                               TargetEnvironment="3"\r
                        />\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
-                               Optimization="0"\r
                                AdditionalIncludeDirectories="..\..\..\..\include"\r
                                PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS;WINDOWS_ONLY"\r
-                               MinimalRebuild="true"\r
-                               BasicRuntimeChecks="3"\r
-                               RuntimeLibrary="3"\r
+                               RuntimeLibrary="2"\r
                                UsePrecompiledHeader="2"\r
                                WarningLevel="3"\r
                                Detect64BitPortabilityProblems="false"\r
                        <Tool\r
                                Name="VCLinkerTool"\r
                                AdditionalDependencies="libeay32.lib dbghelp.lib"\r
-                               LinkIncremental="2"\r
+                               LinkIncremental="1"\r
                                GenerateDebugInformation="true"\r
                                SubSystem="2"\r
-                               TargetMachine="17"\r
+                               OptimizeReferences="2"\r
+                               EnableCOMDATFolding="2"\r
+                               TargetMachine="1"\r
                        />\r
                        <Tool\r
                                Name="VCALinkTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Release|Win32"\r
+                                       Name="Debug|x64"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                        />\r
                                </FileConfiguration>\r
                                <FileConfiguration\r
-                                       Name="Debug|x64"\r
+                                       Name="Release|Win32"\r
                                        >\r
                                        <Tool\r
                                                Name="VCCLCompilerTool"\r
                                RelativePath="..\..\..\..\include\nxcpapi.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\..\..\..\include\nxtools.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\..\..\..\include\nxwinui.h"\r
                                >\r
index 261e241..3fadf71 100644 (file)
@@ -1,7 +1,7 @@
 /* 
 ** NetXMS - Network Management System
 ** Client Library
-** Copyright (C) 2003-2010 Victor Kirhenshtein
+** Copyright (C) 2003-2011 Victor Kirhenshtein
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -353,3 +353,27 @@ BOOL LIBNXCL_EXPORTABLE NXCIsAppropriateTool(NXC_OBJECT_TOOL *pTool, NXC_OBJECT
    }
    return bResult;
 }
+
+
+//
+// Run server script for object
+//
+
+DWORD LIBNXCL_EXPORTABLE NXCExecuteServerCommand(NXC_SESSION hSession, DWORD nodeId, const TCHAR *command)
+{
+   CSCPMessage msg;
+   DWORD dwRqId;
+
+   dwRqId = ((NXCL_Session *)hSession)->CreateRqId();
+
+   // Build request message
+       msg.SetCode(CMD_EXECUTE_SERVER_COMMAND);
+   msg.SetId(dwRqId);
+       msg.SetVariable(VID_OBJECT_ID, name);
+       msg.SetVariable(VID_COMMAND, value);
+
+   // Send request
+   ((NXCL_Session *)hSession)->SendMsg(&msg);
+   
+   return ((NXCL_Session *)hSession)->WaitForRCC(dwRqId);
+}
index d9617d4..331cea7 100644 (file)
@@ -321,27 +321,3 @@ DWORD LIBNXCL_EXPORTABLE NXCSetServerConfigCLOB(NXC_SESSION hSession, const TCHA
    
    return ((NXCL_Session *)hSession)->WaitForRCC(dwRqId);
 }
-
-
-//
-// Run server script for object
-//
-
-DWORD LIBNXCL_EXPORTABLE NXCExecuteServerCommand(NXC_SESSION hSession, DWORD nodeId, const TCHAR *command)
-{
-   CSCPMessage msg;
-   DWORD dwRqId;
-
-   dwRqId = ((NXCL_Session *)hSession)->CreateRqId();
-
-   // Build request message
-       msg.SetCode(CMD_EXECUTE_SERVER_COMMAND);
-   msg.SetId(dwRqId);
-       msg.SetVariable(VID_OBJECT_ID, name);
-       msg.SetVariable(VID_COMMAND, value);
-
-   // Send request
-   ((NXCL_Session *)hSession)->SendMsg(&msg);
-   
-   return ((NXCL_Session *)hSession)->WaitForRCC(dwRqId);
-}
index 95eea18..ebc795e 100644 (file)
@@ -257,6 +257,7 @@ ClientSession::ClientSession(SOCKET hSocket, DWORD dwHostAddr)
    m_dwHostAddr = dwHostAddr;
        IpToStr(dwHostAddr, m_szWorkstation);
    _tcscpy(m_szUserName, _T("<not logged in>"));
+       _tcscpy(m_szClientInfo, _T("n/a"));
    m_dwUserId = INVALID_INDEX;
    m_dwOpenDCIListSize = 0;
    m_pOpenDCIList = NULL;
@@ -10915,6 +10916,7 @@ void ClientSession::listLibraryImages(CSCPMessage *request)
 
 static THREAD_RESULT THREAD_CALL RunCommand(void *arg)
 {
+       DbgPrintf(5, _T("Running server-side command: %s\n"), (TCHAR *)arg);
        _tsystem((TCHAR *)arg);
        free(arg);
        return THREAD_OK;
@@ -10936,6 +10938,7 @@ void ClientSession::executeServerCommand(CSCPMessage *request)
                        if (object->Type() == OBJECT_NODE)
                        {
                                TCHAR *cmd = request->GetVariableStr(VID_COMMAND);
+                               WriteAuditLog(AUDIT_OBJECTS, TRUE, m_dwUserId, m_szWorkstation, nodeId, _T("Server command executed: %s"), cmd);
                                ThreadCreate(RunCommand, 0, cmd);
                                msg.SetVariable(VID_RCC, RCC_SUCCESS);
                        }
@@ -10947,6 +10950,7 @@ void ClientSession::executeServerCommand(CSCPMessage *request)
                else
                {
                        msg.SetVariable(VID_RCC, RCC_ACCESS_DENIED);
+                       WriteAuditLog(AUDIT_OBJECTS, FALSE, m_dwUserId, m_szWorkstation, nodeId, _T("Access denied on server command execution"));
                }
        }
        else