Changeset 261

Show
Ignore:
Timestamp:
03/08/10 22:02:22 (5 months ago)
Author:
mickem
Message:

+ Added new option append-filter-<key>=<value> to CheckEventLog to allow "and" of filter rules.

CheckEventLog file=application file=system filter=out MaxWarn=1 MaxCrit=1 filter-eventID=ne:1 filter-eventID=eq:1 append-filter-eventSource==SecurityCenter? truncate=1023 unique descriptions "syntax=%source%: %id% (%count%)"

+ Added debug option to CheckEventLog (to allow settingdebug on per-check)
+ Added obfuscated_password to NSCA section
+ Added so "global" ([Settings] password=...) passwords are read from the NSCA module

Also various changes to make it build with latest version of boost build.

Location:
branches/stable
Files:
29 modified

Legend:

Unmodified
Added
Removed
  • branches/stable/AutoBuild.h

    r240 r261  
    33// change the FALSE to TRUE for autoincrement of build number 
    44#define INCREMENT_VERSION TRUE 
    5 #define FILEVER        0,3,8,10 
    6 #define PRODUCTVER     0,3,8,10 
    7 #define STRFILEVER     _T("0.3.8.10") 
    8 #define STRPRODUCTVER  _T("0.3.8.10") 
    9 #define STRPRODUCTDATE  _T("2010-01-24") 
     5#define FILEVER        0,3,8,27 
     6#define PRODUCTVER     0,3,8,27 
     7#define STRFILEVER     _T("0.3.8.27") 
     8#define STRPRODUCTVER  _T("0.3.8.27") 
     9#define STRPRODUCTDATE  _T("2010-03-08") 
    1010#endif // AUTOBUILD_H 
  • branches/stable/Jamroot

    r193 r261  
    1313feature.compose <character-set>multibyte : <define>_MBCS ; 
    1414 
     15path-constant TOP : . ; 
    1516 
    1617local toolset = [ MATCH "^--toolset=(.*)" : [ modules.peek : ARGV ] ] ; 
     
    5152path-constant BOOST_STAGE_LOCATE : $(stage-locate) ; 
    5253 
    53 if $(toolset) = "msvc" { 
     54if ( $(toolset) = "msvc" || $(toolset) = "msvc-8.0" ) { 
    5455  using bjam/openssl : : $(TOP)/lib-source/openssl-0.9.8g/include $(TOP)/lib ; 
    5556  using bjam/boost : : $(TOP)/lib-source/boost_1_35_0 $(TOP)/lib ; 
     
    172173    ; 
    173174 
    174 # all-modules = NSCAAgent ; 
     175# all-modules = CheckEventLog CheckExternalScripts CheckHelpers CheckSystem CheckTaskSched ; 
     176# all-modules = CheckWMI DebugLogMetrics FileLogger LUAScript ; 
     177# all-modules = NRPEClient NSCAAgent NSClientListener SysTray ;  
     178# all-modules = NRPEClient NRPEListener NSCAAgent NSClientListener SysTray;  
    175179 
    176180all-scripts = 
  • branches/stable/NSClient++-2005.vcproj

    r170 r261  
    35273527          <Tool 
    35283528            Name="VCCustomBuildTool" 
    3529             CommandLine="echo Copying $(InputFileName)...&#x0D;&#x0A;cmd /c &quot;copy &quot;$(InputDir)\$(InputFileName)&quot; &quot;$(InputDir)\$(OutDir)&quot;&quot;&#x0D;&#x0A;" 
     3529            CommandLine="echo Copying $(InputFileName) [cmd /c &quot;copy &quot;$(InputDir)\$(InputFileName)&quot; &quot;$(InputDir)\$(OutDir)&quot;&quot;]...&#x0D;&#x0A;cmd /c &quot;copy &quot;$(InputDir)\$(InputFileName)&quot; &quot;$(InputDir)\$(OutDir)&quot;&quot;&#x0D;&#x0A;" 
    35303530            Outputs="$(InputDir)\$(OutDir)\$(InputFileName)" 
    35313531          /> 
  • branches/stable/bjam/openssl.jam

    r180 r261  
    147147{ 
    148148  local result ; 
     149  result += <source>$(TOP)/include/Socket.cpp ; 
    149150  if ( $(.enabled) = true ) { 
    150151    result += <define>USE_OPENSSL ; 
     
    161162  : # default-build 
    162163  : # usage-requirements 
     164    <conditional>@socket-usage-requirements 
    163165  ; 
    164166 
     
    166168{ 
    167169  local result ; 
    168   result += <source>include/Socket.cpp ; 
     170  result += <source>$(TOP)/include/Socket.cpp ; 
    169171  if ( $(.enabled) = true ) { 
    170     result += <source>include/sslSocket.cpp ; 
     172    result += <source>$(TOP)/include/sslSocket.cpp ; 
    171173    result += <source>openssl ; 
    172174  } 
     
    174176} 
    175177 
     178rule socket-usage-requirements ( properties * ) 
     179{ 
     180  local result ; 
     181  result += <source>$(TOP)/include/Socket.cpp ; 
     182  if ( $(.enabled) = true ) { 
     183    result += <source>$(TOP)/include/sslSocket.cpp ; 
     184    result += <source>openssl ; 
     185  } 
     186  return $(result) ; 
     187} 
     188 
  • branches/stable/build.bat

    r191 r261  
    33 
    44echo :: %jam% --toolset=msvc --with-lua=%LUA_SOURCE% --with-openssl --include-path=%NSCP_INCLUDE% --with-boost --with-cryptopp=%CRYPTOPP_SOURCE% runtime-link=static warnings=off --with-psdk="%PLATTFORM_SDK_INCLUDE%" %* build-binaries >> build.log 
    5 %jam% --toolset=msvc --with-lua=%LUA_SOURCE% --with-openssl --include-path=%NSCP_INCLUDE% --with-boost --with-cryptopp=%CRYPTOPP_SOURCE% runtime-link=static warnings=off --with-psdk="%PLATTFORM_SDK_INCLUDE%" %* build-binaries 
     5        %jam% --toolset=msvc --with-lua=%LUA_SOURCE% --with-openssl --include-path=%NSCP_INCLUDE% --with-boost --with-cryptopp=%CRYPTOPP_SOURCE% runtime-link=static warnings=off --with-psdk="%PLATTFORM_SDK_INCLUDE%" %* build-binaries 
    66if %ERRORLEVEL% == 1 goto :error 
    77echo :: Result: %ERRORLEVEL% >> build.log 
    88 
    99echo :: %jam% --toolset=msvc warnings=off %* build-archives >> build.log 
    10 %jam% --toolset=msvc warnings=off %* build-archives 
     10        %jam% --toolset=msvc warnings=off %* build-archives 
    1111if %ERRORLEVEL% == 1 goto :error 
    1212echo :: Result: %ERRORLEVEL% >> build.log 
    1313 
    1414echo :: %jam% --toolset=wix "--wix=%WIX_PATH%" %1=%2 %3=%4 build-installer >> build.log 
    15 %jam% --toolset=wix "--wix=%WIX_PATH%" %1=%2 %3=%4 build-installer 
     15        %jam% --toolset=wix "--wix=%WIX_PATH%" %1=%2 %3=%4 build-installer 
    1616if %ERRORLEVEL% == 1 goto :error 
    1717echo :: Result: %ERRORLEVEL% >> build.log 
  • branches/stable/changelog

    r240 r261  
    66 * Fix depend onservice LanManWorkStation (old win) 
    77 * Fix RtlStringFromGUID problem on NT4 
     8 
     92009-03-08 MickeM 
     10 + Added new option append-filter-<key>=<value> to CheckEventLog to allow "and" of filter rules. 
     11   CheckEventLog file=application file=system filter=out MaxWarn=1 MaxCrit=1 filter-eventID=ne:1 filter-eventID=eq:1 append-filter-eventSource==SecurityCenter truncate=1023 unique descriptions "syntax=%source%: %id% (%count%)" 
     12 + Added debug option to CheckEventLog (to allow settingdebug on per-check) 
     13 + Added obfuscated_password to NSCA section 
     14 + Added so "global" ([Settings] password=...) passwords are read from the NSCA module 
     15  
     162009-02-26 MickeM 
     17 * Changed fo missing files and such generate an error 
     18 * Added option to return error messages to the client [CheckDisk] show_errors=1 (defauilt is off 0) 
     19 * Added warning message ewhen numerical filters evaluate to zero (and are not 0) 
     20 * Fixed major issue with date mathing in CheckFile* which was not working at all. 
    821 
    9222009-01-24 MickeM 
  • branches/stable/env.bat

    r199 r261  
    66rem SET jam=C:\src\tools\boost-jam-3.1.17\bin.ntx86\bjam.exe 
    77rem SET jam=D:\source\tools\bjam.exe 
    8 set jam=C:\src\tools\nightly\boost-build\jam_src\bin.ntx86\bjam.exe 
     8set jam=C:\source\libraries\boost_1_42_0\bjam.exe 
    99 
    1010rem # 
     
    1414rem # 
    1515rem SET BOOST_BUILD_PATH=D:\tools\boost-build 
    16  SET BOOST_BUILD_PATH=C:\src\lib-src\boost_1_39_0\tools\build\v2 
    17 rem  SET BOOST_BUILD_PATH=C:\src\tools\beta\boost-build 
     16rem SET BOOST_BUILD_PATH=C:\src\lib-src\boost_1_39_0\tools\build\v2 
     17SET BOOST_BUILD_PATH=C:\source\libraries\boost_1_42_0\tools\build\v2 
    1818rem set BOOST_BUILD_PATH=D:\source\boost-build 
    1919rem set BOOST_BUILD_PATH=C:\src\tools\nightly\boost-build\ 
     
    2424rem # Set the path to your extra include directpy (openssl/boost/*) 
    2525rem # 
    26 SET TARGET_INC_DIR=C:\src\include 
     26SET TARGET_INC_DIR=C:\source\include 
     27SET BOOST_INCLUDE_DIR=%TARGET_INC_DIR%\boost-1_42\ 
    2728rem set TARGET_INC_DIR=d:\source\include 
    2829SET NSCP_INCLUDE=%TARGET_INC_DIR% 
     
    3233rem # Set the path to your extra library directory (openssl/boost/*) 
    3334rem # 
    34 SET TARGET_LIB_DIR=c:\src\lib 
     35SET TARGET_LIB_DIR=c:\source\lib 
    3536rem SET TARGET_LIB_DIR=D:\source\lib 
    3637rem # 
     
    4647rem # 
    4748rem set LUA_SOURCE=D:\source\NSCP-stable\lib-source\LUA\src\lua-5.1.2 
    48 set LUA_SOURCE=C:\src\lib-src\lua-5.1.4 
     49set LUA_SOURCE=C:\source\libraries\lua-5.1.4 
    4950rem # 
    5051rem ######################## 
     
    5354rem # 
    5455rem SET PLATTFORM_SDK=D:\Program\Microsoft Platform SDK for Windows Server 2003 R2 
    55 SET PLATTFORM_SDK=c:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2 
     56rem SET PLATTFORM_SDK=c:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2 
     57SET PLATTFORM_SDK=c:\Program Files\Microsoft Platform SDK 
    5658rem # 
    5759rem # Setup various relative paths (might need to tweak) 
     
    6769rem # Set the path to your WiX installation 
    6870rem # 
    69 SET WIX_PATH=C:\Program Files\Windows Installer XML 
     71SET WIX_PATH=c:\source\tools\wix-2.0 
    7072rem # 
    7173rem ######################## 
     
    7476rem # 
    7577rem SET CRYPTOPP_SOURCE=D:\source\libs-c\crypto++-5.6.0 
    76 SET CRYPTOPP_SOURCE="C:\src\lib-src\Crypto++5.6.0" 
     78SET CRYPTOPP_SOURCE=C:\source\libraries\cryptopp-5.6.0 
    7779rem ######################## 
    7880rem # 
    7981rem # 
    8082rem # 
     83SET ZIP7_PATH=C:\Program Files\7-Zip 
     84SET PERL_PATH=C:\Perl64\bin 
     85SET TOOLS_DIR=c:\source\tools 
     86SET PUTTY_DIR="c:\Program Files (x86)\PuTTY" 
    8187 
    82 SET TOOLS_DIR=c:\src\tools\;%ProgramFiles%\7-Zip\ 
    83  
    84  
    85 set PATH=%PATH%;%TOOLS_DIR% 
     88set PATH=%PATH%;%ZIP7_PATH%;%PERL_PATH%;%TOOLS_DIR%;%PUTTY_DIR% 
    8689 
    8790rem # Used for building "other" stuff as "I do it". 
  • branches/stable/helpers/XAutoBuild

    • Property svn:ignore
      •  

        old new  
        11Debug 
        22obj 
         3AutoBuild.h.bak 
  • branches/stable/helpers/XAutoBuild/AutoBuild.h

    r66 r261  
    33// change the FALSE to TRUE for autoincrement of build number 
    44#define INCREMENT_VERSION TRUE 
    5 #define FILEVER        1,0,0,13 
    6 #define PRODUCTVER     1,0,0,13 
    7 #define STRFILEVER     "1.0.0.13" 
    8 #define STRPRODUCTVER  "1.0.0.13" 
    9 #define STRPRODUCTDATE  "2007-11-03" 
     5#define FILEVER        1,0,0,14 
     6#define PRODUCTVER     1,0,0,14 
     7#define STRFILEVER     _T("1.0.0.14") 
     8#define STRPRODUCTVER  _T("1.0.0.14") 
     9#define STRPRODUCTDATE  _T("2010-02-27") 
    1010#endif // AUTOBUILD_H 
  • branches/stable/helpers/installer

    • Property svn:ignore
      •  

        old new  
        11bin.v2 
         2bin 
         3obj 
  • branches/stable/helpers/installer_dll

    • Property svn:ignore
      •  

        old new  
        22installer_dll.ncb 
        33installer_dll.vcproj.DESKTOP.mickem.user 
         4*.user 
  • branches/stable/helpers/installer_dll_fw/installer_dll_fw.vcproj

    r184 r261  
    4444        Optimization="0" 
    4545        AdditionalIncludeDirectories="..\..\include" 
     46        PreprocessorDefinitions="USE_PSDK" 
    4647        MinimalRebuild="true" 
    4748        BasicRuntimeChecks="3" 
     
    119120        Optimization="0" 
    120121        AdditionalIncludeDirectories="..\..\include" 
     122        PreprocessorDefinitions="USE_PSDK" 
    121123        MinimalRebuild="true" 
    122124        BasicRuntimeChecks="3" 
     
    138140        Name="VCLinkerTool" 
    139141        AdditionalDependencies="Msi.lib" 
    140         ModuleDefinitionFile="main_dll.def" 
     142        ModuleDefinitionFile="firewall.def" 
    141143        GenerateDebugInformation="true" 
    142144        TargetMachine="17" 
     
    193195        Name="VCCLCompilerTool" 
    194196        AdditionalIncludeDirectories="..\..\include" 
     197        PreprocessorDefinitions="USE_PSDK" 
    195198        RuntimeLibrary="2" 
    196199        WarningLevel="3" 
     
    210213        Name="VCLinkerTool" 
    211214        AdditionalDependencies="Msi.lib" 
    212         ModuleDefinitionFile="main_dll.def" 
     215        ModuleDefinitionFile="firewall.def" 
    213216        GenerateDebugInformation="true" 
    214217        OptimizeReferences="2" 
     
    268271        Name="VCCLCompilerTool" 
    269272        AdditionalIncludeDirectories="..\..\include" 
     273        PreprocessorDefinitions="USE_PSDK" 
    270274        RuntimeLibrary="2" 
    271275        WarningLevel="3" 
     
    286290        AdditionalDependencies="Msi.lib" 
    287291        OutputFile="$(OutDir)\$(ProjectName).dll" 
    288         ModuleDefinitionFile="main_dll.def" 
     292        ModuleDefinitionFile="firewall.def" 
    289293        GenerateDebugInformation="false" 
    290294        OptimizeReferences="2" 
  • branches/stable/include/checkHelpers.hpp

    r228 r261  
    329329    } 
    330330    static TType parse(std::wstring s) { 
    331       return strEx::stoi64_as_BKMG(s); 
     331      TType val = strEx::stoi64_as_BKMG(s); 
     332      if (val == 0 && s.length() > 1 && s[0] != L'0') 
     333        NSC_LOG_MESSAGE_STD(_T("Maybe this is not what you want: ") + s + _T(" = ") + strEx::itos(val)); 
     334      return val; 
    332335    } 
    333336    static TType parse_percent(std::wstring s) { 
     
    364367  public: 
    365368    static TType parse(std::wstring s) { 
    366       return strEx::stoi64_as_time(s); 
     369      TType val = strEx::stoi64_as_time(s); 
     370      if (val == 0 && s.length() > 1 && s[0] != L'0') 
     371        NSC_LOG_MESSAGE_STD(_T("Maybe this is not what you want: ") + s + _T(" = 0")); 
     372      return val; 
    367373    } 
    368374    static TType parse_percent(std::wstring s) { 
     
    397403  public: 
    398404    static int parse(std::wstring s) { 
    399       return strEx::stoi(s); 
     405      int val = strEx::stoi(s); 
     406      if (val == 0 && s.length() > 1 && s[0] != L'0') 
     407        NSC_LOG_MESSAGE_STD(_T("Maybe this is not what you want: ") + s + _T(" = 0")); 
     408      return val; 
    400409    } 
    401410    static int parse_percent(std::wstring s) { 
     
    427436  public: 
    428437    static __int64 parse(std::wstring s) { 
    429       return strEx::stoi64(s); 
     438      __int64 val = strEx::stoi64(s); 
     439      if (val == 0 && s.length() > 1 && s[0] != L'0') 
     440        NSC_LOG_MESSAGE_STD(_T("Maybe this is not what you want: ") + s + _T(" = 0")); 
     441      return val; 
    430442    } 
    431443    static __int64 parse_percent(std::wstring s) { 
     
    852864        return true; 
    853865      } else { 
    854         NSC_DEBUG_MSG_STD(_T("Missing bounds for check: ") + lable); 
     866        NSC_LOG_MESSAGE_STD(_T("Missing bounds for check: ") + lable); 
    855867        //std::cout << "No bounds specified..." << std::endl; 
    856868      } 
     
    927939        return min.gatherPerfData(alias, value, warn.min.getPerfBound(value), crit.min.getPerfBound(value)); 
    928940      } else { 
    929         NSC_DEBUG_MSG_STD(_T("Missing bounds for maxmin-bounds check: ") + alias); 
     941        NSC_LOG_MESSAGE_STD(_T("Missing bounds for maxmin-bounds check: ") + alias); 
    930942        return min.gatherPerfData(alias, value, 0, 0); 
    931943      } 
     
    10251037        return eq.gatherPerfData(alias, value, warn.eq.getPerfBound(value), crit.eq.getPerfBound(value)); 
    10261038      } else { 
    1027         NSC_DEBUG_MSG_STD(_T("Missing bounds for: ") + alias); 
     1039        NSC_LOG_MESSAGE_STD(_T("Missing bounds for: ") + alias); 
    10281040      } 
    10291041    } 
  • branches/stable/include/config.h

    r240 r261  
    157157#define C_SYSTEM_ENUMPROC_METHOD_DEFAULT C_SYSTEM_ENUMPROC_METHOD_AUTO 
    158158 
     159#define CHECK_DISK_SECTION_TITLE _T("Check Disk") 
     160#define CHECK_DISK_SHOW_ERRORS _T("show_errors") 
     161#define CHECK_DISK_SHOW_ERRORS_DEFAULT 0 
    159162 
    160163#define EVENTLOG_SECTION_TITLE _T("Eventlog") 
  • branches/stable/include/filter_framework.hpp

    r228 r261  
    6868    struct numeric_max_filter { 
    6969      static bool filter(TType filter, TType value) { 
     70        //std::wcout << filter << _T(" >= ") << value << std::endl; 
    7071        return value >= filter; 
    7172      } 
     
    113114      static std::wstring parse(std::wstring str) { 
    114115        return str; 
     116      } 
     117      static std::wstring print(std::wstring value) { 
     118        return value; 
    115119      } 
    116120    }; 
     
    194198  template <typename TFilterType, typename TValueType, class THandler, class TFilter> 
    195199  struct filter_one { 
    196     TFilterType filter; 
     200    TFilterType filter_; 
    197201    bool hasFilter_; 
    198202    std::wstring value_; 
    199203    filter_one() : hasFilter_(false) {} 
    200     filter_one(const filter_one &other) : hasFilter_(other.hasFilter_), filter(other.filter), value_(other.value_) { 
     204    filter_one(const filter_one &other) : hasFilter_(other.hasFilter_), filter_(other.filter_), value_(other.value_) { 
    201205    } 
    202206 
     
    205209    } 
    206210    bool matchFilter(const TValueType value) const { 
    207       return TFilter::filter(filter, value); 
     211      return TFilter::filter(filter_, value); 
    208212    } 
    209213    const filter_one & operator=(std::wstring value) { 
     
    211215      hasFilter_ = false; 
    212216      try { 
    213         filter = THandler::parse(value); 
     217        filter_ = THandler::parse(value); 
    214218        hasFilter_ = true; 
    215219      } catch (handlers::handler_exception e) { 
     
    366370      return *this; 
    367371    } 
    368 #define NSCP_FF_DEBUG_NUM(key) if (key.hasFilter()) return _T( # key ) + key.value_; 
     372#define NSCP_FF_DEBUG_NUM(key) if (key.hasFilter()) strEx::append_list(str, std::wstring(_T( # key )) + _T(" ") + key.getValue(), _T(",")); 
    369373    std::wstring to_string() const { 
     374      std::wstring str; 
    370375      NSCP_FF_DEBUG_NUM(max); 
    371376      NSCP_FF_DEBUG_NUM(min); 
    372377      NSCP_FF_DEBUG_NUM(eq); 
    373378      NSCP_FF_DEBUG_NUM(neq); 
    374       //NSCP_FF_DEBUG_NUM(inList); 
    375       return _T(" MISSING! "); 
     379      NSCP_FF_DEBUG_NUM(inList); 
     380      return str; 
    376381    } 
    377382    std::wstring getValue() const { 
  • branches/stable/modules/CheckDisk/CheckDisk.cpp

    r240 r261  
    3636} 
    3737 
    38 CheckDisk::CheckDisk() { 
     38CheckDisk::CheckDisk() : show_errors_(false) { 
    3939} 
    4040CheckDisk::~CheckDisk() { 
     
    5050    NSCModuleHelper::registerCommand(_T("CheckDriveSize"), _T("Check the size (free-space) of a drive or volume.")); 
    5151    NSCModuleHelper::registerCommand(_T("CheckFile"), _T("Check various aspects of a file and/or folder.")); 
     52 
     53    show_errors_ = NSCModuleHelper::getSettingsInt(CHECK_DISK_SECTION_TITLE, CHECK_DISK_SHOW_ERRORS, CHECK_DISK_SHOW_ERRORS_DEFAULT)==1; 
    5254  } catch (NSCModuleHelper::NSCMHExcpetion &e) { 
    5355    NSC_LOG_ERROR_STD(_T("Failed to register command: ") + e.msg_); 
     
    7274  virtual void report_error(std::wstring error) = 0; 
    7375  virtual void report_warning(std::wstring error) = 0; 
     76  virtual bool has_error() = 0; 
     77  virtual std::wstring get_error() = 0; 
    7478}; 
    7579 
     
    8690struct get_size : public baseFinderFunction 
    8791{ 
    88   bool error; 
    89   get_size() : size(0), error(false) { } 
     92  get_size() : size(0) { } 
    9093  result_type operator()(argument_type ffd) { 
    9194    if (!is_directory(ffd.wfd.dwFileAttributes)) { 
     
    97100    return size; 
    98101  } 
    99   inline const bool hasError() const { 
    100     return error; 
    101   } 
    102102  inline void setError(error_reporter *errors, std::wstring msg) { 
    103103    if (errors != NULL) 
    104104      errors->report_error(msg); 
    105     error = true; 
    106105  } 
    107106private:   
     
    110109 
    111110template <class finder_function> 
    112 void recursive_scan(std::wstring dir, std::wstring pattern, int current_level, int max_level, finder_function & f, error_reporter * errors, bool debug) { 
     111void recursive_scan(std::wstring dir, std::wstring pattern, int current_level, int max_level, finder_function & f, error_reporter * errors, bool debug, bool recursive = false) { 
    113112  if ((max_level != -1) && (current_level > max_level)) 
    114113    return; 
     
    116115 
    117116  DWORD fileAttr = GetFileAttributes(dir.c_str()); 
     117  if ((fileAttr == INVALID_FILE_ATTRIBUTES)&&(!recursive)) { 
     118    errors->report_error(_T("Invalid file specified: ") + dir); 
     119  } else if (fileAttr == INVALID_FILE_ATTRIBUTES) { 
     120    errors->report_warning(_T("Invalid file specified: ") + dir); 
     121  } 
    118122  if (debug) NSC_DEBUG_MSG_STD(_T("Input is: ") + dir + _T(" / ") + strEx::ihextos(fileAttr)); 
    119123 
     
    127131      f(file_finder_data(wfd, single_path.first, errors)); 
    128132      FindClose(hFind); 
     133    } else { 
     134      NSC_DEBUG_MSG_STD(_T("File was NOT found!")); 
    129135    } 
    130136    return; 
     
    147153      if (is_directory(wfd.dwFileAttributes)) { 
    148154        if ( (wcscmp(wfd.cFileName, _T(".")) != 0) && (wcscmp(wfd.cFileName, _T("..")) != 0) ) 
    149           recursive_scan<finder_function>(dir + _T("\\") + wfd.cFileName, pattern, current_level+1, max_level, f, errors, debug); 
     155          recursive_scan<finder_function>(dir + _T("\\") + wfd.cFileName, pattern, current_level+1, max_level, f, errors, debug, true); 
    150156      } 
    151157    } while (FindNextFile(hFind, &wfd)); 
     
    355361 
    356362class NSC_error : public error_reporter { 
     363  int error_count_; 
     364  int warning_count_; 
     365  std::wstring first_error_; 
     366  std::wstring last_error_; 
     367public: 
     368  NSC_error() : error_count_(0), warning_count_(0) {} 
    357369  void report_error(std::wstring error) { 
     370    if (error_count_==0) 
     371      first_error_ = error; 
     372    else 
     373      last_error_ = error; 
     374    error_count_++; 
    358375    NSC_LOG_ERROR(error); 
    359376  } 
    360377  void report_warning(std::wstring error) { 
    361378    NSC_LOG_MESSAGE(error); 
     379  } 
     380  std::wstring get_error() { 
     381    return strEx::itos(error_count_) + _T(" errors and ") + strEx::itos(warning_count_) + _T(" warnings where returned: ") + first_error_; 
     382  } 
     383  bool has_error() { 
     384    return error_count_ > 0; 
    362385  } 
    363386}; 
     
    431454    pattern_type splitpath = split_pattern(path.data); 
    432455    recursive_scan<get_size>(splitpath.first, splitpath.second, -1, -1, sizeFinder, &errors, debug); 
    433     if (sizeFinder.hasError()) { 
    434       message = _T("File not found check log for details"); 
     456    if (errors.has_error()) { 
     457      if (show_errors_) 
     458        message = errors.get_error(); 
     459      else 
     460        message = _T("Check contains error. Check log for details (or enable show_errors in nsc.ini)"); 
    435461      return NSCAPI::returnUNKNOWN; 
    436462    } 
     
    454480  bool has_error; 
    455481 
    456   static file_info get(std::wstring path, std::wstring file) { 
    457     return get_2(path, file); 
    458   } 
    459   static file_info get(file_finder_data data) { 
    460     return file_info(data.wfd, data.path, data.wfd.cFileName); 
    461   } 
    462  
    463   static file_info get_2(std::wstring path, std::wstring file) { 
     482  static file_info get(__int64 now, std::wstring path, std::wstring file) { 
     483    return get_2(now, path, file); 
     484  } 
     485  static file_info get(__int64 now, file_finder_data data) { 
     486    return file_info(now, data.wfd, data.path, data.wfd.cFileName); 
     487  } 
     488 
     489  static file_info get_2(__int64 now, std::wstring path, std::wstring file) { 
    464490    WIN32_FILE_ATTRIBUTE_DATA data; 
    465491    if (!GetFileAttributesEx((path + _T("\\") + file).c_str(), GetFileExInfoStandard, reinterpret_cast<LPVOID>(&data))) { 
     
    468494      return ret; 
    469495    } 
    470     return file_info(data, path, file); 
    471   } 
    472   static file_info get_1(std::wstring path, std::wstring file) { 
     496    return file_info(now, data, path, file); 
     497  } 
     498  static file_info get_1(__int64 now, std::wstring path, std::wstring file) { 
    473499    HANDLE hFile = CreateFile((path + _T("\\") + file).c_str(), FILE_READ_ATTRIBUTES, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); 
    474500    if (hFile == INVALID_HANDLE_VALUE) { 
     
    480506    GetFileInformationByHandle(hFile, &_info); 
    481507    CloseHandle(hFile); 
    482     return file_info(_info, path, file); 
     508    return file_info(now, _info, path, file); 
    483509  } 
    484510 
     
    488514    , ullLastWriteTime(0) 
    489515    , ullSize(0) 
     516    , ullNow(0) 
    490517    , cached_version(false, _T(""))  
    491518    , cached_count(false, 0) 
    492519  {} 
    493   file_info(const WIN32_FILE_ATTRIBUTE_DATA info, std::wstring path_, std::wstring filename_)  
     520  file_info(__int64 now, const WIN32_FILE_ATTRIBUTE_DATA info, std::wstring path_, std::wstring filename_)  
    494521    : path(path_) 
    495522    , filename(filename_) 
     
    498525    , ullLastWriteTime(0) 
    499526    , ullSize(0) 
     527    , ullNow(now) 
    500528    , cached_version(false, _T(""))  
    501529    , cached_count(false, 0) 
     
    506534    ullLastWriteTime = ((info.ftLastWriteTime.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)info.ftLastWriteTime.dwLowDateTime); 
    507535  }; 
    508   file_info(const BY_HANDLE_FILE_INFORMATION info, std::wstring path_, std::wstring filename_)  
     536  file_info(__int64 now, const BY_HANDLE_FILE_INFORMATION info, std::wstring path_, std::wstring filename_)  
    509537    : path(path_) 
    510538    , filename(filename_) 
     
    513541    , ullLastWriteTime(0) 
    514542    , ullSize(0) 
     543    , ullNow(now) 
    515544    , cached_version(false, _T(""))  
    516545    , cached_count(false, 0) 
     
    521550    ullLastWriteTime = ((info.ftLastWriteTime.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)info.ftLastWriteTime.dwLowDateTime); 
    522551  }; 
    523   file_info(const WIN32_FIND_DATA info, std::wstring path_, std::wstring filename_)  
     552  file_info(__int64 now, const WIN32_FIND_DATA info, std::wstring path_, std::wstring filename_)  
    524553    : path(path_) 
    525554    , filename(filename_) 
     
    528557    , ullLastWriteTime(0) 
    529558    , ullSize(0) 
     559    , ullNow(now) 
    530560    , cached_version(false, _T(""))  
    531561    , cached_count(false, 0) 
     
    536566    ullLastWriteTime = ((info.ftLastWriteTime.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)info.ftLastWriteTime.dwLowDateTime); 
    537567  }; 
    538   file_info(std::wstring path_, std::wstring filename_)  
     568  file_info(__int64 now, std::wstring path_, std::wstring filename_)  
    539569    : path(path_) 
    540570    , filename(filename_) 
     
    543573    , ullLastWriteTime(0) 
    544574    , ullSize(0) 
     575    , ullNow(now) 
    545576    , cached_version(false, _T(""))  
    546577    , cached_count(false, 0) 
     
    575606    strEx::replace(syntax, _T("%access%"), strEx::format_filetime(ullLastAccessTime, DATE_FORMAT)); 
    576607    strEx::replace(syntax, _T("%write%"), strEx::format_filetime(ullLastWriteTime, DATE_FORMAT)); 
     608    strEx::replace(syntax, _T("%creation-raw%"), strEx::itos(ullCreationTime)); 
     609    strEx::replace(syntax, _T("%access-raw%"), strEx::itos(ullLastAccessTime)); 
     610    strEx::replace(syntax, _T("%write-raw%"), strEx::itos(ullLastWriteTime)); 
     611    strEx::replace(syntax, _T("%now-raw%"), strEx::itos(ullNow)); 
    577612/* 
    578613    strEx::replace(syntax, _T("%creation-d%"), strEx::format_filetime(ullCreationTime, DATE_FORMAT)); 
     
    692727{ 
    693728  file_info info; 
    694   bool error; 
     729  __int64 now_; 
    695730//  std::wstring message; 
    696   find_first_file_info() : error(false) {} 
     731  find_first_file_info() : now_(0) { 
     732    FILETIME now; 
     733    GetSystemTimeAsFileTime(&now); 
     734    now_ = ((now.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)now.dwLowDateTime); 
     735  } 
    697736  result_type operator()(argument_type ffd) { 
    698737    if (is_directory(ffd.wfd.dwFileAttributes)) 
    699738      return true; 
    700739 
    701     file_info info = file_info::get(ffd); 
     740    file_info info = file_info::get(now_, ffd); 
    702741    if (!info.error.empty()) { 
    703742      setError(ffd.errors, info.error); 
     
    720759    */ 
    721760  } 
    722   inline const bool hasError() const { 
    723     return error; 
    724   } 
    725761  inline void setError(error_reporter *errors, std::wstring msg) { 
    726762    if (errors != NULL) 
    727763      errors->report_error(msg); 
    728     error = true; 
    729764  } 
    730765}; 
     
    735770  bool bFilterAll; 
    736771  bool bFilterIn; 
    737   bool error; 
    738772  std::wstring message; 
    739773  std::wstring syntax; 
     
    741775  unsigned long long now; 
    742776  unsigned int hit_count; 
    743  
    744   file_filter_function() : hit_count(0), error(false), bFilterIn(true), bFilterAll(true) {} 
     777  __int64 now_; 
     778 
     779  file_filter_function() : now_(0), hit_count(0), bFilterIn(true), bFilterAll(true) { 
     780    FILETIME now; 
     781    GetSystemTimeAsFileTime(&now); 
     782    now_ = ((now.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)now.dwLowDateTime); 
     783  } 
    745784  result_type operator()(argument_type ffd) { 
    746785    if (is_directory(ffd.wfd.dwFileAttributes)) 
    747786      return true; 
    748787 
    749     file_info info = file_info::get(ffd); 
     788    file_info info = file_info::get(now, ffd); 
    750789    if (!info.error.empty()) { 
    751790      setError(ffd.errors, info.error); 
     
    792831    return true; 
    793832  } 
    794   inline const bool hasError() const { 
    795     return error; 
    796   } 
    797833  inline void setError(error_reporter *errors, std::wstring msg) { 
    798834    if (errors != NULL) 
    799835      errors->report_error(msg); 
    800     error = true; 
    801836  } 
    802837}; 
     
    815850  bool bFilterAll; 
    816851  bool bFilterIn; 
    817   bool error; 
    818852  bool debug_; 
    819853  std::wstring message; 
    820854  std::wstring syntax; 
    821855  //std::wstring alias; 
    822   unsigned long long now; 
     856  unsigned long long now_; 
    823857  unsigned int hit_count; 
    824858  unsigned int file_count; 
    825   std::wstring last_error; 
    826   unsigned int error_count; 
    827  
    828   file_filter_function_ex() : hit_count(0), file_count(0), error(false), debug_(false), bFilterIn(true), bFilterAll(true), error_count(0) {} 
     859 
     860  file_filter_function_ex() : hit_count(0), file_count(0), debug_(false), bFilterIn(true), bFilterAll(true), now_(0) { 
     861    FILETIME now; 
     862    GetSystemTimeAsFileTime(&now); 
     863    now_ = ((now.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)now.dwLowDateTime); 
     864  } 
    829865  result_type operator()(argument_type ffd) { 
    830866    if (is_directory(ffd.wfd.dwFileAttributes)) 
    831867      return true; 
    832868 
    833     file_info info = file_info::get(ffd); 
     869    file_info info = file_info::get(now_, ffd); 
    834870    if (!info.error.empty()) { 
    835871      setError(ffd.errors, info.error); 
     
    889925    return true; 
    890926  } 
    891   inline const bool hasError() const { 
    892     return error; 
    893   } 
    894927  inline void setError(error_reporter *errors, std::wstring msg) { 
    895928    if (errors != NULL) 
    896929      errors->report_error(msg); 
    897     last_error = msg; 
    898     error_count++; 
    899     error = true; 
    900930  } 
    901931 
     
    941971  pattern_type splitpath = split_pattern(path); 
    942972  recursive_scan<find_first_file_info>(splitpath.first, splitpath.second, -1, -1, finder, &errors, debug); 
    943   if (finder.hasError()) { 
    944     message = _T("File not found (check log for details)"); 
    945     return NSCAPI::returnUNKNOWN; 
    946   } 
    947   FILETIME now_; 
    948   GetSystemTimeAsFileTime(&now_); 
    949   unsigned long long now = ((now_.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)now_.dwLowDateTime); 
    950   time_t value = (now-finder.info.ullLastWriteTime)/10000000; 
     973  if (errors.has_error()) { 
     974    if (show_errors_) 
     975      message = errors.get_error(); 
     976    else 
     977      message = _T("Check contains error. Check log for details (or enable show_errors in nsc.ini)"); 
     978    return NSCAPI::returnUNKNOWN; 
     979  } 
     980  time_t value = (finder.now_-finder.info.ullLastWriteTime)/10000000; 
    951981  message = strEx::itos(value/60) + _T("&") + strEx::format_time_delta(gmtime(&value), format); 
    952982  return NSCAPI::returnOK; 
     
    9991029    return NSCAPI::returnUNKNOWN; 
    10001030  } 
    1001   FILETIME now; 
    1002   GetSystemTimeAsFileTime(&now); 
    1003   finder.now = ((now.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)now.dwLowDateTime); 
    10041031  finder.syntax = syntax; 
    10051032  NSC_error errors; 
     
    10071034    pattern_type path = split_pattern(*pit); 
    10081035    recursive_scan<file_filter_function>(path.first, path.second, 0, max_dir_depth, finder, &errors, debug); 
    1009     if (finder.hasError()) { 
    1010       message = _T("File not found: ") + (*pit) + _T(" check log for details."); 
     1036    if (errors.has_error()) { 
     1037      if (show_errors_) 
     1038        message = errors.get_error(); 
     1039      else 
     1040        message = _T("Check contains error. Check log for details (or enable show_errors in nsc.ini)"); 
    10111041      return NSCAPI::returnUNKNOWN; 
    10121042    } 
    10131043  } 
    10141044  message = finder.message; 
    1015   if (finder.error) 
    1016     return NSCAPI::returnUNKNOWN; 
    10171045  if (!alias.empty()) 
    10181046    query.alias = alias; 
     
    11201148    return NSCAPI::returnUNKNOWN; 
    11211149  } 
    1122   FILETIME now; 
    1123   GetSystemTimeAsFileTime(&now); 
    11241150  finder.debug_ = debug; 
    1125   finder.now = ((now.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)now.dwLowDateTime); 
    11261151  if (debug) 
    1127     NSC_DEBUG_MSG_STD(_T("NOW: ") + strEx::format_filetime(finder.now)); 
     1152    NSC_DEBUG_MSG_STD(_T("NOW: ") + strEx::format_filetime(finder.now_)); 
    11281153  finder.syntax = syntax; 
    11291154  NSC_error errors; 
    11301155  for (std::list<std::wstring>::const_iterator pit = paths.begin(); pit != paths.end(); ++pit) { 
    11311156    recursive_scan<file_filter_function_ex>(*pit, pattern, 0, max_dir_depth, finder, &errors, debug); 
    1132     if (!ignoreError && finder.hasError()) { 
    1133       message = _T("Error when scanning: ") + (*pit) + _T(" check log for details (") + strEx::itos(finder.error_count) + _T(": ") + finder.last_error + _T(")"); 
     1157    if (!ignoreError && errors.has_error()) { 
     1158      if (show_errors_) 
     1159        message = errors.get_error(); 
     1160      else 
     1161        message = _T("Check contains error. Check log for details (or enable show_errors in nsc.ini)"); 
    11341162      return NSCAPI::returnUNKNOWN; 
    11351163    } 
     
    11591187      0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); 
    11601188    if (hFile == INVALID_HANDLE_VALUE) { 
    1161       return file_container(file, _T("Could not open file: ") + file); 
     1189      return file_container(now, file, _T("Could not open file: ") + file); 
    11621190    } 
    11631191    GetFileInformationByHandle(hFile, &_info); 
    11641192    CloseHandle(hFile); 
    1165     file_container info(_info, file); 
    1166     info.ullNow = now; 
     1193    file_container info(now, _info, file); 
     1194    //info.ullNow = now; 
    11671195    return info; 
    11681196  } 
    11691197 
    11701198 
    1171   file_container(const BY_HANDLE_FILE_INFORMATION info, std::wstring file) : file_info(info, file_helpers::meta::get_path(file), file_helpers::meta::get_filename(file)) {} 
    1172   file_container(std::wstring file, std::wstring error) : error_(error), file_info(file_helpers::meta::get_path(file), file_helpers::meta::get_filename(file)) {} 
     1199  file_container(__int64 now, const BY_HANDLE_FILE_INFORMATION info, std::wstring file) : file_info(now, info, file_helpers::meta::get_path(file), file_helpers::meta::get_filename(file)) {} 
     1200  file_container(__int64 now, std::wstring file, std::wstring error) : error_(error), file_info(now, file_helpers::meta::get_path(file), file_helpers::meta::get_filename(file)) {} 
    11731201 
    11741202  bool has_errors() { 
  • branches/stable/modules/CheckDisk/CheckDisk.h

    r227 r261  
    2727class CheckDisk { 
    2828private: 
     29  bool show_errors_; 
    2930 
    3031public: 
  • branches/stable/modules/CheckEventLog/CheckEventLog-2005.vcproj

    r175 r261  
    214214        MinimalRebuild="true" 
    215215        BasicRuntimeChecks="3" 
    216         RuntimeLibrary="3" 
     216        RuntimeLibrary="1" 
    217217        UsePrecompiledHeader="2" 
    218218        WarningLevel="3" 
     
    297297        MinimalRebuild="true" 
    298298        BasicRuntimeChecks="3" 
    299         RuntimeLibrary="3" 
     299        RuntimeLibrary="1" 
    300300        UsePrecompiledHeader="2" 
    301301        WarningLevel="3" 
  • branches/stable/modules/CheckEventLog/CheckEventLog.cpp

    r228 r261  
    2323#include "CheckEventLog.h" 
    2424#include <filter_framework.hpp> 
     25#include <boost/foreach.hpp> 
    2526 
    2627#include <strEx.h> 
     
    446447      timeWritten.hasFilter() || timeGenerated.hasFilter(); 
    447448  } 
    448   std::wstring getValue() const { 
    449     if (eventSource.hasFilter()) 
    450       return _T("event-source: ") + eventSource.getValue(); 
    451     if (eventType.hasFilter()) 
    452       return _T("event-type: ") + eventType.getValue(); 
    453     if (eventSeverity.hasFilter()) 
    454       return _T("severity: ") + eventSeverity.getValue(); 
    455     if (eventID.hasFilter()) 
    456       return _T("event-id: ") + eventID.getValue(); 
    457     if (message.hasFilter()) 
    458       return _T("message: ") + message.getValue(); 
    459     if (timeWritten.hasFilter()) 
    460       return _T("time-written: ") + timeWritten.getValue(); 
    461     if (timeGenerated.hasFilter()) 
    462       return _T("time-generated: ") + timeGenerated.getValue(); 
    463     return _T("UNknown..."); 
     449 
     450#define NSCP_EL_DEBUG(key) if (key.hasFilter()) strEx::append_list(str, std::wstring(_T( # key )) + _T(" ") + key.to_string(), _T(",")); 
     451  std::wstring to_string() const { 
     452    std::wstring str; 
     453    NSCP_EL_DEBUG(eventSource); 
     454    NSCP_EL_DEBUG(eventType); 
     455    NSCP_EL_DEBUG(eventSeverity); 
     456    NSCP_EL_DEBUG(eventID); 
     457    NSCP_EL_DEBUG(message); 
     458    NSCP_EL_DEBUG(timeWritten); 
     459    NSCP_EL_DEBUG(timeGenerated); 
     460    return str; 
    464461  } 
    465462  bool matchFilter(const EventLogRecord &value) const { 
     463    bool ret = false; 
    466464    if ((eventSource.hasFilter())&&(eventSource.matchFilter(value.eventSource()))) 
    467       return true; 
     465      ret = true; 
     466    else if (eventSource.hasFilter()) 
     467      return false; 
    468468    else if ((eventType.hasFilter())&&(eventType.matchFilter(value.eventType()))) 
    469       return true; 
     469      ret = true; 
     470    else if (eventType.hasFilter()) 
     471      return false; 
    470472    else if ((eventSeverity.hasFilter())&&(eventSeverity.matchFilter(value.severity()))) 
    471       return true; 
     473      ret = true; 
     474    else if (eventSeverity.hasFilter()) 
     475      return false; 
    472476    else if ((eventID.hasFilter())&&(eventID.matchFilter(value.eventID())))  
    473       return true; 
     477      ret = true; 
     478    else if (eventID.hasFilter()) 
     479      return false; 
    474480    else if ((message.hasFilter())&&(message.matchFilter(value.enumStrings()))) 
    475       return true; 
     481      ret = true; 
     482    else if (message.hasFilter()) 
     483      return false; 
    476484    else if ((timeWritten.hasFilter())&&(timeWritten.matchFilter(value.timeWritten()))) 
    477       return true; 
     485      ret = true; 
     486    else if (timeWritten.hasFilter()) 
     487      return false; 
    478488    else if ((timeGenerated.hasFilter())&&(timeGenerated.matchFilter(value.timeGenerated()))) 
    479       return true; 
    480     return false; 
     489      ret = true; 
     490    else if (timeGenerated.hasFilter()) 
     491      return false; 
     492    return ret; 
    481493  } 
    482494}; 
     
    484496 
    485497#define MAP_FILTER(value, obj, filtermode) \ 
    486       else if (p__.first == value) { eventlog_filter filter; filter.obj = p__.second; filter_chain.push_back(filteritem_type(filtermode, filter)); } 
     498      else if (p__.first == value) { filter.obj = p__.second; if (bPush) { filter_chain.push_back(filteritem_type(filtermode, filter)); filter = eventlog_filter(); } } 
     499#define MAP_FILTER_LAST(value, obj) \ 
     500      else if (p__.first == value) { filter_chain.front().second.obj = p__.second; } 
    487501 
    488502struct event_log_buffer { 
     
    532546  const int filter_compat = 3; 
    533547  event_log_buffer buffer(buffer_length_); 
     548  bool bPush = true; 
     549  bool bDebug = debug_; 
     550  eventlog_filter filter; 
    534551  /* 
    535552  try { 
     
    553570      MAP_OPTIONS_BOOL_EX(_T("filter"), bFilterIn, _T("in"), _T("out")) 
    554571      MAP_OPTIONS_BOOL_EX(_T("filter"), bFilterAll, _T("all"), _T("any")) 
     572      MAP_OPTIONS_BOOL_EX(_T("auto-push"), bPush, _T("true"), _T("false")) 
     573      MAP_OPTIONS_BOOL_EX(_T("debug"), bDebug, _T("true"), _T("false")) 
    555574      MAP_OPTIONS_STR(_T("syntax"), syntax) 
    556575      /* 
     
    587606      MAP_FILTER(_T("filter-message"), message, filter_minus) 
    588607 
     608      MAP_FILTER_LAST(_T("append-filter-eventType"), eventType) 
     609      MAP_FILTER_LAST(_T("append-filter-severity"), eventSeverity) 
     610      MAP_FILTER_LAST(_T("append-filter-eventID"), eventID) 
     611      MAP_FILTER_LAST(_T("append-filter-eventSource"), eventSource) 
     612      MAP_FILTER_LAST(_T("append-filter-generated"), timeGenerated) 
     613      MAP_FILTER_LAST(_T("append-filter-written"), timeWritten) 
     614      MAP_FILTER_LAST(_T("append-filter-message"), message) 
     615 
     616 
    589617      MAP_OPTIONS_MISSING(message, _T("Unknown argument: ")) 
    590618      MAP_OPTIONS_END() 
     
    609637  } 
    610638  bool buffer_error_reported = false; 
    611  
     639  if (bDebug) { 
     640    std::wstring str; 
     641    BOOST_FOREACH(filteritem_type item, filter_chain) { 
     642      if (item.first == filter_normal) 
     643        str += _T(". {"); 
     644      else if (item.first == filter_plus) 
     645        str += _T("+ {"); 
     646      else if (item.first == filter_minus) 
     647        str += _T("- {"); 
     648      else  
     649        str += _T("? {"); 
     650 
     651      str += item.second.to_string() + _T(" }"); 
     652    } 
     653    NSC_DEBUG_MSG_STD(_T("Filter: ") + str); 
     654  } 
     655 
     656  bDebug = false; 
    612657  for (std::list<std::wstring>::const_iterator cit2 = files.begin(); cit2 != files.end(); ++cit2) { 
    613658    std::wstring name = *cit2; 
     
    684729            if ((mode == filter_minus)&&(bTmpMatched)) { 
    685730              // a -<filter> hit so thrash item and bail out! 
    686               if (debug_) 
    687                 NSC_DEBUG_MSG_STD(_T("Matched: - ") + (*cit3).second.getValue() + _T(" for: ") + record.render(bShowDescriptions, syntax)); 
     731              if (bDebug) 
     732                NSC_DEBUG_MSG_STD(_T("Matched: - ") + (*cit3).second.to_string() + _T(" for: ") + record.render(bShowDescriptions, syntax)); 
    688733              bMatch = false; 
    689734              break; 
    690735            } else if ((mode == filter_plus)&&(!bTmpMatched)) { 
    691736              // a +<filter> missed hit so thrash item and bail out! 
    692               if (debug_) 
    693                 NSC_DEBUG_MSG_STD(_T("Matched: + ") + (*cit3).second.getValue() + _T(" for: ") + record.render(bShowDescriptions, syntax)); 
     737              if (bDebug) 
     738                NSC_DEBUG_MSG_STD(_T("Matched: + ") + (*cit3).second.to_string() + _T(" for: ") + record.render(bShowDescriptions, syntax)); 
    694739              bMatch = false; 
    695740              break; 
    696741            } else if (bTmpMatched) { 
    697               if (debug_) 
    698                 NSC_DEBUG_MSG_STD(_T("Matched: . (contiunue): ") + (*cit3).second.getValue() + _T(" for: ") + record.render(bShowDescriptions, syntax)); 
     742              if (bDebug) 
     743                NSC_DEBUG_MSG_STD(_T("Matched: . (contiunue): ") + (*cit3).second.to_string() + _T(" for: ") + record.render(bShowDescriptions, syntax)); 
    699744              bMatch = true; 
    700745            } 
  • branches/stable/modules/CheckWMI/Jamfile

    r187 r261  
    55  : requirements 
    66  <find-static-library>Wbemuuid 
     7  <find-static-library>atls 
    78  ; 
    89 
  • branches/stable/modules/LUAScript/LUAScript-2005.vcproj

    r189 r261  
    6969      <Tool 
    7070        Name="VCLinkerTool" 
    71         AdditionalDependencies="lua.lib" 
     71        AdditionalDependencies="liblua.lib" 
    7272        OutputFile="$(OutDir)\$(ProjectName).dll" 
    7373        LinkIncremental="2" 
     
    153153      <Tool 
    154154        Name="VCLinkerTool" 
    155         AdditionalDependencies="lua.lib" 
     155        AdditionalDependencies="liblua.lib" 
    156156        OutputFile="$(OutDir)\$(ProjectName).dll" 
    157157        LinkIncremental="2" 
     
    233233      <Tool 
    234234        Name="VCLinkerTool" 
    235         AdditionalDependencies="lua.lib" 
     235        AdditionalDependencies="liblua.lib" 
    236236        OutputFile="$(OutDir)\$(ProjectName).dll" 
    237237        LinkIncremental="1" 
     
    315315      <Tool 
    316316        Name="VCLinkerTool" 
    317         AdditionalDependencies="lua.lib" 
     317        AdditionalDependencies="liblua.lib" 
    318318        OutputFile="$(OutDir)\$(ProjectName).dll" 
    319319        LinkIncremental="1" 
     
    396396      <Tool 
    397397        Name="VCLinkerTool" 
    398         AdditionalDependencies="lua.lib" 
     398        AdditionalDependencies="liblua.lib" 
    399399        OutputFile="$(OutDir)\$(ProjectName).dll" 
    400400        LinkIncremental="1" 
     
    478478      <Tool 
    479479        Name="VCLinkerTool" 
    480         AdditionalDependencies="lua.lib" 
     480        AdditionalDependencies="liblua.lib" 
    481481        OutputFile="$(OutDir)\$(ProjectName).dll" 
    482482        LinkIncremental="1" 
     
    557557      <Tool 
    558558        Name="VCLinkerTool" 
    559         AdditionalDependencies="lua.lib" 
     559        AdditionalDependencies="liblua.lib" 
    560560        OutputFile="$(OutDir)\$(ProjectName).dll" 
    561561        LinkIncremental="1" 
     
    636636      <Tool 
    637637        Name="VCLinkerTool" 
    638         AdditionalDependencies="lua.lib" 
     638        AdditionalDependencies="liblua.lib" 
    639639        OutputFile="$(OutDir)\$(ProjectName).dll" 
    640640        LinkIncremental="1" 
     
    719719      <Tool 
    720720        Name="VCLinkerTool" 
    721         AdditionalDependencies="lua.lib" 
     721        AdditionalDependencies="liblua.lib" 
    722722        OutputFile="$(OutDir)\$(ProjectName).dll" 
    723723        LinkIncremental="2" 
     
    803803      <Tool 
    804804        Name="VCLinkerTool" 
    805         AdditionalDependencies="lua.lib" 
     805        AdditionalDependencies="liblua.lib" 
    806806        OutputFile="$(OutDir)\$(ProjectName).dll" 
    807807        LinkIncremental="2" 
     
    881881      <Tool 
    882882        Name="VCLinkerTool" 
    883         AdditionalDependencies="lua.lib" 
     883        AdditionalDependencies="liblua.lib" 
    884884        OutputFile="$(OutDir)\$(ProjectName).dll" 
    885885        LinkIncremental="1" 
     
    960960      <Tool 
    961961        Name="VCLinkerTool" 
    962         AdditionalDependencies="lua.lib" 
     962        AdditionalDependencies="liblua.lib" 
    963963        OutputFile="$(OutDir)\$(ProjectName).dll" 
    964964        LinkIncremental="1" 
  • branches/stable/modules/NRPEClient/Jamfile

    r172 r261  
    1414  ../../include/arrayBuffer.cpp 
    1515  ../../include/utils.cpp 
     16  ../../include/Socket.cpp 
     17  ../../include/sslSocket.cpp 
     18  /openssl//socket 
    1619 
    1720  : # requirements 
    1821  <def-file>$(source).def 
    19   <source>/openssl//socket 
    2022  <runtime-link>static 
    2123  <source>/boost//regexp 
  • branches/stable/modules/NRPEListener/Jamfile

    r172 r261  
    1515  ../../include/b64/b64.c 
    1616  ../../include/utils.cpp 
     17  ../../include/Socket.cpp 
     18  ../../include/sslSocket.cpp 
     19  /openssl//socket 
    1720 
    1821  : # requirements 
    1922  <def-file>$(source).def 
    20   <source>/openssl//socket 
    2123  <runtime-link>static 
    2224 
  • branches/stable/modules/NSCAAgent/NSCAAgent-2005.vcproj

    r170 r261  
    6969      <Tool 
    7070        Name="VCLinkerTool" 
    71         AdditionalDependencies="ws2_32.lib Crypto++.lib" 
     71        AdditionalDependencies="ws2_32.lib libcryptopp.lib" 
    7272        OutputFile="$(OutDir)\$(ProjectName).dll" 
    7373        LinkIncremental="2" 
     
    153153      <Tool 
    154154        Name="VCLinkerTool" 
    155         AdditionalDependencies="ws2_32.lib Crypto++.lib" 
     155        AdditionalDependencies="ws2_32.lib libcryptopp.lib" 
    156156        OutputFile="$(OutDir)\$(ProjectName).dll" 
    157157        LinkIncremental="2" 
     
    233233      <Tool 
    234234        Name="VCLinkerTool" 
    235         AdditionalDependencies="ws2_32.lib Crypto++.lib" 
     235        AdditionalDependencies="ws2_32.lib libcryptopp.lib" 
    236236        OutputFile="$(OutDir)\$(ProjectName).dll" 
    237237        LinkIncremental="1" 
     
    315315      <Tool 
    316316        Name="VCLinkerTool" 
    317         AdditionalDependencies="ws2_32.lib Crypto++.lib" 
     317        AdditionalDependencies="ws2_32.lib libcryptopp.lib" 
    318318        OutputFile="$(OutDir)\$(ProjectName).dll" 
    319319        LinkIncremental="1" 
     
    396396      <Tool 
    397397        Name="VCLinkerTool" 
    398         AdditionalDependencies="ws2_32.lib Crypto++.lib" 
     398        AdditionalDependencies="ws2_32.lib libcryptopp.lib" 
    399399        OutputFile="$(OutDir)\$(ProjectName).dll" 
    400400        LinkIncremental="1" 
     
    478478      <Tool 
    479479        Name="VCLinkerTool" 
    480         AdditionalDependencies="ws2_32.lib Crypto++.lib" 
     480        AdditionalDependencies="ws2_32.lib libcryptopp.lib" 
    481481        OutputFile="$(OutDir)\$(ProjectName).dll" 
    482482        LinkIncremental="1" 
     
    559559      <Tool 
    560560        Name="VCLinkerTool" 
    561         AdditionalDependencies="ws2_32.lib Crypto++.lib" 
     561        AdditionalDependencies="ws2_32.lib libcryptopp.lib" 
    562562        OutputFile="$(OutDir)\$(ProjectName).dll" 
    563563        LinkIncremental="1" 
     
    641641      <Tool 
    642642        Name="VCLinkerTool" 
    643         AdditionalDependencies="ws2_32.lib Crypto++.lib" 
     643        AdditionalDependencies="ws2_32.lib libcryptopp.lib" 
    644644        OutputFile="$(OutDir)\$(ProjectName).dll" 
    645645        LinkIncremental="1" 
     
    725725      <Tool 
    726726        Name="VCLinkerTool" 
    727         AdditionalDependencies="ws2_32.lib Crypto++.lib" 
     727        AdditionalDependencies="ws2_32.lib libcryptopp.lib" 
    728728        OutputFile="$(OutDir)\$(ProjectName).dll" 
    729729        LinkIncremental="2" 
     
    809809      <Tool 
    810810        Name="VCLinkerTool" 
    811         AdditionalDependencies="ws2_32.lib Crypto++.lib" 
     811        AdditionalDependencies="ws2_32.lib libcryptopp.lib" 
    812812        OutputFile="$(OutDir)\$(ProjectName).dll" 
    813813        LinkIncremental="2" 
     
    889889      <Tool 
    890890        Name="VCLinkerTool" 
    891         AdditionalDependencies="ws2_32.lib Crypto++.lib" 
     891        AdditionalDependencies="ws2_32.lib libcryptopp.lib" 
    892892        OutputFile="$(OutDir)\$(ProjectName).dll" 
    893893        LinkIncremental="1" 
     
    971971      <Tool 
    972972        Name="VCLinkerTool" 
    973         AdditionalDependencies="ws2_32.lib Crypto++.lib" 
     973        AdditionalDependencies="ws2_32.lib libcryptopp.lib" 
    974974        OutputFile="$(OutDir)\$(ProjectName).dll" 
    975975        LinkIncremental="1" 
  • branches/stable/modules/NSCAAgent/NSCAThread.cpp

    r188 r261  
    8787   
    8888  encryption_method_ = NSCModuleHelper::getSettingsInt(NSCA_AGENT_SECTION_TITLE, NSCA_ENCRYPTION, NSCA_ENCRYPTION_DEFAULT); 
    89   password_ = strEx::wstring_to_string(NSCModuleHelper::getSettingsString(NSCA_AGENT_SECTION_TITLE, NSCA_PASSWORD, NSCA_PASSWORD_DEFAULT)); 
     89  std::wstring password = NSCModuleHelper::getSettingsString(NSCA_AGENT_SECTION_TITLE, MAIN_OBFUSCATED_PASWD, MAIN_OBFUSCATED_PASWD_DEFAULT); 
     90  if (!password.empty()) 
     91    password = NSCModuleHelper::Decrypt(password); 
     92  if (password.empty()) 
     93    password = NSCModuleHelper::getSettingsString(NSCA_AGENT_SECTION_TITLE, NSCA_PASSWORD, NSCA_PASSWORD_DEFAULT); 
     94  if (password.empty()) { 
     95    // read main password if no NSCA one is found 
     96    password = NSCModuleHelper::getSettingsString(MAIN_SECTION_TITLE, MAIN_OBFUSCATED_PASWD, MAIN_OBFUSCATED_PASWD_DEFAULT); 
     97    if (!password.empty()) 
     98      password = NSCModuleHelper::Decrypt(password); 
     99    if (password.empty()) 
     100      password = NSCModuleHelper::getSettingsString(MAIN_SECTION_TITLE, MAIN_SETTINGS_PWD, MAIN_SETTINGS_PWD_DEFAULT); 
     101  } 
     102  password_ = strEx::wstring_to_string(password); 
     103 
    90104  cacheNscaHost_ = NSCModuleHelper::getSettingsInt(NSCA_AGENT_SECTION_TITLE, NSCA_CACHE_HOST, NSCA_CACHE_HOST_DEFAULT) == 1; 
    91105  std::list<std::wstring> items = NSCModuleHelper::getSettingsSection(NSCA_CMD_SECTION_TITLE); 
  • branches/stable/release-build.bat

    r191 r261  
    66 
    77echo %jam% --toolset=msvc --with-cryptopp=%CRYPTOPP_SOURCE% --with-cryptopp-target=%NSCP_INCLUDE%\cryptopp cryptopp-headers >> build.log 
    8 %jam% --toolset=msvc --with-cryptopp=%CRYPTOPP_SOURCE% --with-cryptopp-target=%NSCP_INCLUDE%\cryptopp cryptopp-headers 
     8     %jam% --toolset=msvc --with-cryptopp=%CRYPTOPP_SOURCE% --with-cryptopp-target=%NSCP_INCLUDE%\cryptopp cryptopp-headers 
    99if %ERRORLEVEL% == -1 goto :error 
    1010echo :: Result: %ERRORLEVEL% >> build.log 
    1111 
    1212echo %jam% --toolset=msvc source-archive >> build.log 
    13 %jam% --toolset=msvc source-archive 
     13     %jam% --toolset=msvc source-archive 
    1414if %ERRORLEVEL% == -1 goto :error 
    1515echo :: Result: %ERRORLEVEL% >> build.log 
  • branches/stable/wix.jam

    r185 r261  
    4848  local wix-location = [ MATCH "^--wix=(.*)" : [ modules.peek : ARGV ] ] ; 
    4949  if $(wix-location) { 
    50     prefix = $(wix-location)\\bin\\ ; 
     50# MIME FIX!!!   prefix = $(wix-location)\\bin\\ ; 
     51    prefix = $(wix-location)\\ ; 
    5152  } else { 
    5253    command = [ common.get-invocation-command wix : candle.exe : $(command) ] ; 
  • branches/stable/x64-build.bat

    r191 r261  
    2222 
    2323:build_hdrs 
    24 echo %jam% --toolset=msvc --with-cryptopp=%CRYPTOPP_SOURCE% --with-cryptopp-target=%NSCP_INCLUDE%\cryptopp cryptopp-headers >> build.log 
    25 %jam% --toolset=msvc --with-cryptopp=%CRYPTOPP_SOURCE% --with-cryptopp-target=%NSCP_INCLUDE%\cryptopp cryptopp-headers 
     24echo %jam% --toolset=msvc-8.0 --with-cryptopp=%CRYPTOPP_SOURCE% --with-cryptopp-target=%NSCP_INCLUDE%\cryptopp cryptopp-headers >> build.log 
     25     %jam% --toolset=msvc-8.0 --with-cryptopp=%CRYPTOPP_SOURCE% --with-cryptopp-target=%NSCP_INCLUDE%\cryptopp cryptopp-headers 
    2626if %ERRORLEVEL% == -1 goto :error_one 
    2727echo :: Result: %ERRORLEVEL% >> build.log 
     
    2929 
    3030:build_src 
    31 echo %jam% --toolset=msvc source-archive >> build.log 
    32 %jam% --toolset=msvc source-archive 
     31echo %jam% --toolset=msvc-8.0 source-archive >> build.log 
     32     %jam% --toolset=msvc-8.0 source-archive 
    3333if %ERRORLEVEL% == -1 goto :error_one 
    3434echo :: Result: %ERRORLEVEL% >> build.log 
  • branches/stable/x86-build.bat

    r191 r261  
    2222 
    2323:build_hdrs 
    24 echo %jam% --toolset=msvc --with-cryptopp=%CRYPTOPP_SOURCE% --with-cryptopp-target=%NSCP_INCLUDE%\cryptopp cryptopp-headers >> build.log 
    25 %jam% --toolset=msvc --with-cryptopp=%CRYPTOPP_SOURCE% --with-cryptopp-target=%NSCP_INCLUDE%\cryptopp cryptopp-headers 
     24echo %jam% --toolset=msvc-8.0 --with-cryptopp=%CRYPTOPP_SOURCE% --with-cryptopp-target=%NSCP_INCLUDE%\cryptopp cryptopp-headers >> build.log 
     25     %jam% --toolset=msvc --with-cryptopp=%CRYPTOPP_SOURCE% --with-cryptopp-target=%NSCP_INCLUDE%\cryptopp cryptopp-headers 
    2626if %ERRORLEVEL% == -1 goto :error_one 
    2727echo :: Result: %ERRORLEVEL% >> build.log 
     
    2929 
    3030:build_src 
    31 echo %jam% --toolset=msvc source-archive >> build.log 
    32 %jam% --toolset=msvc source-archive 
     31echo %jam% --toolset=msvc-8.0 source-archive >> build.log 
     32     %jam% --toolset=msvc-8.0 source-archive 
    3333if %ERRORLEVEL% == -1 goto :error_one 
    3434echo :: Result: %ERRORLEVEL% >> build.log