Changeset ba63b95 in nscp


Ignore:
Timestamp:
01/13/12 06:52:23 (16 months ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2
Children:
35254d1
Parents:
7354aa1
Message:
  • Fixed issue with --submit command line option erroneusly reported missing optien (when it is not supported)
  • Added settings store "dummy" for people who dont want to store settings (long term use is for unit tests)
  • Added new option to NSCClient --source-host for settings the host name of the caller (your machine).
  • Change so enryption algorithms are case insensitevie (ie. 3DES and 3des both work)
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • changelog

    r7354aa1 rba63b95  
    55 * Fixa dependonservice LanManWorkStation (old win) 
    66 * Fix RtlStringFromGUID problem on NT4 
     7 
     82012-01-12 MickeM 
     9 * Fixed issue with --submit command line option erroneusly reported missing optien (when it is not supported) 
     10 * Added settings store "dummy" for people who dont want to store settings (long term use is for unit tests) 
     11 * Added new option to NSCClient --source-host for settings the host name of the caller (your machine). 
     12 * Change so enryption algorithms are case insensitevie (ie. 3DES and 3des both work) 
    713 
    8142012-01-09 MickeM 
  • helpers/settings_manager/CMakeLists.txt

    r04ef932 rba63b95  
    2525    ${NSCP_INCLUDEDIR}/settings/macros.h 
    2626    ${NSCP_INCLUDEDIR}/settings/settings_ini.hpp 
     27    ${NSCP_INCLUDEDIR}/settings/settings_dummy.hpp 
    2728    ${NSCP_INCLUDEDIR}/settings/settings_old.hpp 
    2829    ${NSCP_INCLUDEDIR}/settings/settings_registry.hpp 
  • helpers/settings_manager/settings_manager_impl.cpp

    rf085f9b rba63b95  
    44 
    55#include <settings/settings_ini.hpp> 
     6#include <settings/settings_dummy.hpp> 
    67#include <settings/settings_http.hpp> 
    78#ifdef WIN32 
     
    9192      return settings::instance_raw_ptr(new settings::INISettings(this, key)); 
    9293    } 
     94    if (url.protocol == _T("dummy")) { 
     95      return settings::instance_raw_ptr(new settings::settings_dummy(this, key)); 
     96    } 
    9397    if (url.protocol == _T("http")) { 
    9498      return settings::instance_raw_ptr(new settings::settings_http(this, key)); 
     
    128132    if (url.protocol == _T("ini")) 
    129133      return settings::INISettings::context_exists(this, key); 
     134    if (url.protocol == _T("dummy")) 
     135      return true; 
    130136    if (url.protocol == _T("http")) 
    131137      return true; 
  • include/nsca/nsca_enrypt.hpp

    r96c1461 rba63b95  
    22 
    33#include <algorithm> 
     4#include <boost/algorithm/string.hpp> 
    45 
    56#ifdef HAVE_LIBCRYPTOPP 
     
    7172    }; 
    7273    struct helpers { 
    73       static int encryption_to_int(std::string encryption) { 
     74      static int encryption_to_int(std::string encryption_raw) { 
     75        std::string encryption = boost::algorithm::to_lower_copy(encryption_raw); 
    7476        if ( 
    7577          (encryption.size() == 1 && std::isdigit(encryption[0]))  
  • include/nsca/nsca_packet.hpp

    ra87ce04 rba63b95  
    135135 
    136136    std::string to_string() const { 
    137       return "service: " + service + ", " +  
     137      return "host: " + host + ", " +  
     138        "service: " + service + ", " +  
    138139        "code: " + nstr::to_string(code) + ", " +  
    139140        "time: " + nstr::to_string(time) + ", " +  
  • include/nscapi/functions.hpp

    r7354aa1 rba63b95  
    229229      } 
    230230      void set_string_data(std::string key, std::string value) { 
    231         data[key] = value; 
     231        if (key == "host") 
     232          host = value; 
     233        else 
     234          data[key] = value; 
    232235      } 
    233236      void set_int_data(std::string key, int value) { 
  • include/nscapi/nscapi_plugin_wrapper.cpp

    r40fca56 rba63b95  
    3131#include <strEx.h> 
    3232 
     33#include <boost/algorithm/string.hpp> 
    3334#include <boost/foreach.hpp> 
    3435#include <boost/tokenizer.hpp> 
     
    9394  nscapi::functions::decoded_simple_command_data data = nscapi::functions::parse_simple_query_request(char_command, request); 
    9495  std::wstring msg, perf; 
    95   NSCAPI::nagiosReturn ret = handleCommand(data.target, data.command, data.args, msg, perf); 
     96 
     97  NSCAPI::nagiosReturn ret = handleCommand(data.target, boost::algorithm::to_lower_copy(data.command), data.args, msg, perf); 
    9698  nscapi::functions::create_simple_query_response(data.command, ret, msg, perf, response); 
    9799  return ret; 
  • modules/DistributedClient/DistributedClient.cpp

    rf33c12f rba63b95  
    200200  setup(config); 
    201201  if (!client::command_line_parser::is_command(cmd)) 
    202     return client::command_line_parser::do_execute_command_as_query(config, cmd, data.args, result); 
     202    return client::command_line_parser::do_execute_command_as_query(config, cmd, data.args, request, result); 
    203203  return commands.exec_simple(config, data.target, char_command, data.args, result); 
    204204} 
  • modules/NSCAClient/NSCAClient.cpp

    r7354aa1 rba63b95  
    271271    "Password") 
    272272 
     273    ("source-host", po::value<std::string>()->notifier(boost::bind(&nscapi::functions::destination_container::set_string_data, &data->host_self, "host", _1)),  
     274    "Source/sender host name (default is auto which means use the name of the actual host)") 
     275 
     276    ("sender-host", po::value<std::string>()->notifier(boost::bind(&nscapi::functions::destination_container::set_string_data, &data->host_self, "host", _1)),  
     277    "Source/sender host name (default is auto which means use the name of the actual host)") 
     278 
    273279    ("time-offset", po::value<std::string>()->notifier(boost::bind(&nscapi::functions::destination_container::set_string_data, &data->recipient, "time offset", _1)),  
    274280    "") 
  • modules/PythonScript/PythonScript.cpp

    r9c06054 rba63b95  
    375375    nscapi::functions::create_simple_exec_response<std::wstring>(_T("help"), ret, result, response); 
    376376    return ret; 
    377   } else if (command == _T("execute-and-load-python") || command == _T("execute-python") || command == _T("run") || command == _T("execute") || command == _T("exec")|| command == _T("")) { 
     377  } else if (command == _T("execute-and-load-python") || command == _T("execute-python") || command == _T("python-script") 
     378    || command == _T("run") || command == _T("execute") || command == _T("exec") || command == _T("")) { 
    378379    nscapi::functions::decoded_simple_command_data data = nscapi::functions::parse_simple_exec_request(char_command, request); 
    379380    if (data.command == _T("") && data.args.size() == 0) 
  • scripts/python/lib/test_helper.py

    rf7a074d rba63b95  
    126126  def shutdown(self): 
    127127    None 
     128 
     129  def require_boot(self): 
     130    return False 
    128131     
    129132     
     
    273276       
    274277  def install(self, arguments = []): 
     278    boot = False 
    275279    for suite in self.suites: 
    276280      instance = suite.getInstance() 
    277281      instance.install(arguments) 
    278        
     282      if instance.require_boot(): 
     283        boot = True 
     284 
     285    #core = Core.get() 
     286    #(code, msg, perf) = core.simple_query('py_unittest', []) 
     287     
    279288    log('-+---==(TEST INSTALLER)==---------------------------------------------------+-') 
    280289    log(' | Setup nessecary configuration for running test                           |') 
    281290    log(' | This includes: Loading the PythonScript module at startup                |') 
    282291    log(' | To use this please run nsclient++ in "test mode" like so:                |') 
    283     log(' | nscp --test                                                              |') 
    284     log(' | Then start the py_unittest command by typing it and press enter like so: |') 
    285     log(' | test_eventlog                                                            |') 
    286     log(' | Lastly exit by typing exit like so:                                      |') 
    287     log(' | exit                                                                     |') 
     292    if boot: 
     293      log(' | nscp client --boot --query py_unittest                                   |') 
     294    else: 
     295      log(' | nscp client --query py_unittest                                          |') 
    288296    log('-+--------------------------------------------------------==(DAS ENDE!)==---+-') 
    289297       
  • scripts/python/test_nrpe.py

    ra87ce04 rba63b95  
    247247    None 
    248248 
     249  def require_boot(self): 
     250    return True 
     251 
    249252setup_singleton(NRPEServerTest) 
    250253 
  • scripts/python/test_nsca.py

    r7354aa1 rba63b95  
    252252  def shutdown(self): 
    253253    None 
     254     
     255  def require_boot(self): 
     256    return True 
     257     
    254258 
    255259setup_singleton(NSCAServerTest) 
  • scripts/python/test_python.py

    r9c06054 rba63b95  
    44from time import time 
    55 
    6 install_checks = 10 
     6install_checks = 1000 
    77 
    88class PythonTest(BasicTest): 
  • service/NSClient++.cpp

    ra87ce04 rba63b95  
    11781178int exec_helper(NSClientT::plugin_type plugin, std::wstring command, std::vector<std::wstring> arguments, std::string request, std::list<std::string> *responses) { 
    11791179  std::string response; 
     1180  if (!plugin || !plugin->has_command_line_exec()) 
     1181    return -1; 
    11801182  int ret = plugin->commandLineExec(command.c_str(), request, response); 
    11811183  if (ret != NSCAPI::returnIgnored && !response.empty()) 
  • service/cli_parser.hpp

    ra87ce04 rba63b95  
    7979      ("query,q", po::value<std::wstring>(), "Run a query with a given name") 
    8080      ("submit,s", po::value<std::wstring>(), "Name of query to ask") 
     81      ("settings", po::value<std::wstring>(), "Override (temporarily) settings subsystem to use") 
    8182      ("module,M", po::value<std::wstring>(), "Name of module to load (if not specified all modules in ini file will be loaded)") 
    8283      ("argument,a", po::wvalue<std::vector<std::wstring> >(), "List of arguments (gets -- prefixed automatically)") 
     
    399400        mainClient.log_info(__FILE__, __LINE__, _T("Arguments: ") + args); 
    400401      } 
     402      if (vm.count("settings")) 
     403        core_->set_settings_context(vm["settings"].as<std::wstring>()); 
     404 
    401405      core_->boot_init(); 
    402406      if (module.empty()) 
     
    420424          mainClient.simple_exec(module, _T("help"), arguments, resp); 
    421425        } 
     426      } else if (mode == submit) { 
     427        std::wcerr << _T("--submit is currently not supported (but you can use --exec submit which is technically the same)") << std::endl; 
    422428      } else { 
    423429        std::wcerr << _T("Need to specify one of --exec, --query or --submit") << std::endl; 
  • version.hpp

    ra87ce04 rba63b95  
    11#ifndef VERSION_HPP 
    22#define VERSION_HPP 
    3 #define PRODUCTVER     0,4,0,118 
    4 #define STRPRODUCTVER  "0,4,0,118" 
    5 #define STRPRODUCTDATE "2011-12-16" 
     3#define PRODUCTVER     0,4,0,121 
     4#define STRPRODUCTVER  "0,4,0,121" 
     5#define STRPRODUCTDATE "2012-01-12" 
    66#endif // VERSION_HPP 
  • version.txt

    ra87ce04 rba63b95  
    11version=0.4.0 
    2 build=118 
    3 date=2011-12-16 
     2build=121 
     3date=2012-01-12 
Note: See TracChangeset for help on using the changeset viewer.