Changeset 35254d1 in nscp


Ignore:
Timestamp:
01/15/12 23:32:36 (17 months ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2
Children:
89838be
Parents:
ba63b95
Message:
  • Fixed installer "back" issues
  • Fixed payload truncation for NRPe and NSCA
  • Improved the installer target tagging functions in the python installer
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • build/python/postbuild.py

    rd48afa1 r35254d1  
    1616vstring = version.version() 
    1717 
     18targets = None 
     19 
     20def build_targets(str): 
     21  targets = {} 
     22  for itm in str.split(';'): 
     23    tmp = itm.split('=') 
     24    if len(tmp) == 0: 
     25      continue 
     26    elif len(tmp) == 1: 
     27      targets['nscp'] = tmp[0] 
     28    else: 
     29      targets[tmp[0]] = tmp[1] 
     30  return targets 
     31       
     32   
     33     
     34def find_target(key=None): 
     35  global targets 
     36  if not targets: 
     37    targets = build_targets(TARGET_SITE) 
     38  if not key: 
     39    key = 'nscp' 
     40  if not key in targets: 
     41    return None 
     42  return targets[key] 
     43 
     44 
    1845def scp_file(file): 
    1946  tfile = os.path.basename(file) 
     
    2249  if '_' in name: 
    2350    (name, tag) = name.split('_') 
    24     if globals().has_key('TARGET_SITE_%s'%tag): 
    25       target = globals().get('TARGET_SITE_%s'%tag) 
     51    target = find_target(tag) 
     52    if target: 
    2653      print 'Found tagged installer %s for %s'%(tfile, tag) 
    2754    else: 
     
    2956  else: 
    3057    print 'Found normal installer %s'%tfile 
    31     target = TARGET_SITE 
     58    target = find_target() 
    3259  if target: 
    3360    print 'Uploading name: %s to %s'%(tfile, target) 
  • changelog

    rba63b95 r35254d1  
    55 * Fixa dependonservice LanManWorkStation (old win) 
    66 * Fix RtlStringFromGUID problem on NT4 
     7 
     82012-01-15 MickeM 
     9 * Fixed installer "back" issues 
     10 * Fixed payload truncation for NRPe and NSCA 
     11 * Improved the installer target tagging functions in the python installer 
     12 
     132012-01-13 MickeM 
     14 * Fixed some issues with the trac configuration generator 
    715 
    8162012-01-12 MickeM 
  • helpers/installers/ui/WixUI_MondoNSCP.wxs

    r53c1a6e r35254d1  
    9898      <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">WixUI_InstallMode = "Change"</Publish> 
    9999      <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallCustom"</Publish> 
    100       <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="InvalidConfigureationDlg" Order="4">CONF_HAS_ERRORS = "1"</Publish> 
    101       <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="SelectConfigurationDlg" Order="3">CONF_OLD_FOUND="0"</Publish> 
    102       <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ConfigureDlg" Order="2">CONF_CAN_CHANGE = "1"</Publish> 
    103       <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="1">1</Publish> 
     100      <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="3">1</Publish> 
     101      <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ConfigureDlg" Order="4">CONF_CAN_CHANGE = "1"</Publish> 
     102      <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="SelectConfigurationDlg" Order="5">CONF_OLD_FOUND="0"</Publish> 
     103      <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="InvalidConfigureationDlg" Order="6">CONF_HAS_ERRORS = "1"</Publish> 
    104104 
    105105      <Publish Dialog="InvalidConfigureationDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "Change" OR WixUI_InstallMode = "InstallCustom"</Publish> 
     
    107107      <Publish Dialog="InvalidConfigureationDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="3">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish> 
    108108      <Publish Dialog="InvalidConfigureationDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="4">WixUI_InstallMode = "Update"</Publish> 
    109       <Publish Dialog="InvalidConfigureationDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> 
     109      <Publish Dialog="InvalidConfigureationDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="5">1</Publish> 
    110110 
    111111      <Publish Dialog="SelectConfigurationDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "Change" OR WixUI_InstallMode = "InstallCustom"</Publish> 
     
    113113      <Publish Dialog="SelectConfigurationDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="3">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish> 
    114114      <Publish Dialog="SelectConfigurationDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="4">WixUI_InstallMode = "Update"</Publish> 
    115       <Publish Dialog="SelectConfigurationDlg" Control="Next" Event="NewDialog" Value="ConfigureDlg">1</Publish> 
     115      <Publish Dialog="SelectConfigurationDlg" Control="Next" Event="NewDialog" Value="ConfigureDlg" Order="5">1</Publish> 
    116116 
    117       <Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="SelectConfigurationDlg" Order="1">CONF_OLD_FOUND="0"</Publish> 
    118       <Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="2">WixUI_InstallMode = "Change" OR WixUI_InstallMode = "InstallCustom"</Publish> 
    119       <Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="3">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish> 
    120       <Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="4">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish> 
    121       <Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="5">WixUI_InstallMode = "Update"</Publish> 
    122       <Publish Dialog="ConfigureDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish> 
     117      <Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "Change" OR WixUI_InstallMode = "InstallCustom"</Publish> 
     118      <Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish> 
     119      <Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="3">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish> 
     120      <Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="4">WixUI_InstallMode = "Update"</Publish> 
     121      <Publish Dialog="ConfigureDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="5">1</Publish> 
     122      <Publish Dialog="ConfigureDlg" Control="Back" Event="NewDialog" Value="SelectConfigurationDlg" Order="6">CONF_OLD_FOUND="0"</Publish> 
    123123 
    124124      <!-- END: Modified to handle configuration dialog --> 
    125       <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InvalidConfigureationDlg" Order="1">CONF_HAS_ERRORS = "1"</Publish> 
    126       <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ConfigureDlg" Order="2">CONF_OLD_FOUND="0" OR CONF_CAN_CHANGE="1"</Publish> 
    127       <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="3">WixUI_InstallMode = "Change" OR WixUI_InstallMode = "InstallCustom"</Publish> 
    128       <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="4">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish> 
    129       <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="5">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish> 
    130       <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="6">WixUI_InstallMode = "Update"</Publish> 
     125      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "Change" OR WixUI_InstallMode = "InstallCustom"</Publish> 
     126      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish> 
     127      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="3">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish> 
     128      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="4">WixUI_InstallMode = "Update"</Publish> 
     129      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ConfigureDlg" Order="5">CONF_OLD_FOUND="0" OR CONF_CAN_CHANGE="1"</Publish> 
     130      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InvalidConfigureationDlg" Order="6">CONF_HAS_ERRORS = "1"</Publish> 
    131131 
    132132      <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish> 
  • include/nsca/nsca_packet.hpp

    rba63b95 r35254d1  
    162162        throw nsca::nsca_exception("Invalid crc: " + nstr::to_string(crc32) + " != " + nstr::to_string(calculated_crc32)); 
    163163    } 
    164  
    165     void get_buffer(std::string &buffer) const { 
    166       // FIXME: This is crap and needs rewriting. No std::string and beetter zero handling... 
     164    void validate_lengths() const { 
    167165      if (service.length() >= nsca::length::desc_length) 
    168166        throw nsca::nsca_exception("Description field to long: " + nstr::to_string(service.length()) + " > " + nstr::to_string(nsca::length::desc_length)); 
     
    171169      if (result.length() >= get_payload_length()) 
    172170        throw nsca::nsca_exception("Result field to long: " + nstr::to_string(result.length()) + " > " + nstr::to_string(get_payload_length())); 
     171    } 
     172 
     173    static void copy_string(char* data, const std::string &value, std::string::size_type max_length) { 
     174      memset(data, 0, max_length); 
     175      value.copy(data, value.size()>max_length?max_length:value.size()); 
     176    } 
     177 
     178    void get_buffer(std::string &buffer) const { 
     179      nsca::data::data_packet *data = reinterpret_cast<nsca::data::data_packet*>(&*buffer.begin()); 
    173180      if (buffer.size() < get_packet_length()) 
    174181        throw nsca::nsca_exception("Buffer is to short: " + nstr::to_string(buffer.length()) + " > " + nstr::to_string(get_packet_length())); 
    175  
    176       nsca::data::data_packet *data = reinterpret_cast<nsca::data::data_packet*>(&*buffer.begin()); 
    177182 
    178183      data->packet_version=swap_bytes::hton<int16_t>(nsca::data::version3); 
     
    181186      data->crc32_value= swap_bytes::hton<u_int32_t>(0); 
    182187 
    183       memset(data->get_host_ptr(), 0, host.size()+1); 
    184       host.copy(data->get_host_ptr(), host.size()); 
    185       memset(data->get_desc_ptr(nsca::length::host_length), 0, service.size()+1); 
    186       service.copy(data->get_desc_ptr(nsca::length::host_length), service.size()); 
    187       memset(data->get_result_ptr(nsca::length::host_length, nsca::length::desc_length), 0, result.size()+1); 
    188       result.copy(data->get_result_ptr(nsca::length::host_length, nsca::length::desc_length), result.size()); 
     188      copy_string(data->get_host_ptr(), host, nsca::length::host_length); 
     189      copy_string(data->get_desc_ptr(nsca::length::host_length), service, nsca::length::desc_length); 
     190      copy_string(data->get_result_ptr(nsca::length::host_length, nsca::length::desc_length), result, get_payload_length()); 
    189191 
    190192      unsigned int calculated_crc32=calculate_crc32(buffer.c_str(),buffer.size()); 
  • modules/NRPEServer/handler_impl.cpp

    ra78a985 r35254d1  
    2828    } 
    2929  } 
    30   //TODO REMOVE THIS 
    31   //return NRPEPacket(NRPEPacket::responsePacket, NRPEPacket::version2, NSCAPI::returnUNKNOWN, _T("TEST TEST TEST"), buffer_length_); 
    3230 
    3331  NSCAPI::nagiosReturn ret = -3; 
     
    5250    return nrpe::packet::create_response(NSCAPI::returnUNKNOWN, _T("UNKNOWN: Internal error."), p.get_payload_length()); 
    5351  } 
    54   std::wstring data = msg; 
    55   if (!perf.empty()&&!noPerfData_) { 
    56     data += _T("|") + perf; 
    57   } 
    58   if (data.length() >= p.get_payload_length()-1) { 
    59     //NSC_LOG_ERROR(_T("Truncating returndata as it is bigger then NRPE allowes :(")); 
    60     data = data.substr(0,p.get_payload_length()-2); 
     52  std::wstring data; 
     53  if (msg.length() > p.get_payload_length()) { 
     54    data = msg.substr(0, p.get_payload_length()-1); 
     55  } else if (perf.empty() || noPerfData_) { 
     56    data = msg; 
     57  } else if (msg.length() + perf.length() + 1 > p.get_payload_length()) { 
     58    data = msg; 
     59  } else { 
     60    data = msg + _T("|") + perf; 
    6161  } 
    6262  return nrpe::packet::create_response(ret, data, p.get_payload_length()); 
  • service/NSClient++.cpp

    rba63b95 r35254d1  
    938938 
    939939NSCAPI::errorReturn NSClientT::reload(const wchar_t *module) { 
    940   { 
     940  if (module == _T("service")) { 
     941    boot_start_plugins() 
     942 
     943  } else { 
    941944    std::wstring m = module; 
    942945    boost::unique_lock<boost::shared_mutex> writeLock(m_mutexRW, boost::get_system_time() + boost::posix_time::seconds(10)); 
  • service/cli_parser.hpp

    rba63b95 r35254d1  
    5151 
    5252    settings.add_options() 
     53      ("settings", po::value<std::wstring>(), "Override (temporarily) settings subsystem to use") 
    5354      ("migrate-to", po::value<std::wstring>(), "Migrate (copy) settings from current store to target store") 
    5455      ("migrate-from", po::value<std::wstring>(), "Migrate (copy) settings from current store to target store") 
     
    246247      if (vm.count("switch")) { 
    247248        client.switch_context(vm["switch"].as<std::wstring>()); 
     249        ret = 0; 
     250      } 
     251      if (vm.count("settings")) { 
     252        client.set_current(vm["settings"].as<std::wstring>()); 
    248253        ret = 0; 
    249254      } 
  • service/settings_client.hpp

    r9c06054 r35254d1  
    9797          BOOST_FOREACH(std::wstring path, s) { 
    9898            std::wcout << _T("== ") << path << _T(" ==") << std::endl; 
     99            settings::settings_core::path_description desc = settings_manager::get_core()->get_registred_path(path); 
     100            if (!desc.description.empty()) 
     101              std::wcout << desc.description << std::endl; 
     102            std::wcout << std::endl; 
    99103            settings::string_list k = settings_manager::get_core()->get_reg_keys(path); 
    100104            bool first = true; 
     
    105109                  std::wcout << _T("'''Normal settings'''") << std::endl; 
    106110                first = false; 
     111                strEx::replace(desc.description, _T("\n"), _T("\n|| || ||")); 
     112                if (desc.defValue.empty()) 
     113                  desc.defValue = _T(" "); 
    107114                std::wcout << _T("||") << key << _T("||") << desc.defValue << _T("||") << desc.title << _T(": ") << desc.description << std::endl; 
    108115              } 
Note: See TracChangeset for help on using the changeset viewer.