Ignore:
Timestamp:
10/26/06 07:03:39 (7 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2, stable
Children:
7aef770
Parents:
70f2d7b
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/NRPEListener/NRPEListener.cpp

    rf42280d r76aafc4  
    2828  return ret; 
    2929} 
     30bool getCacheAllowedHosts() { 
     31  int val = NSCModuleHelper::getSettingsInt(NRPE_SECTION_TITLE, MAIN_ALLOWED_HOSTS_CACHE, -1); 
     32  if (val == -1) 
     33    val = NSCModuleHelper::getSettingsInt(MAIN_SECTION_TITLE, MAIN_ALLOWED_HOSTS_CACHE, MAIN_ALLOWED_HOSTS_CACHE_DEFAULT); 
     34  return val==1?true:false; 
     35} 
    3036 
    3137bool NRPEListener::loadModule() { 
     
    3339  timeout = NSCModuleHelper::getSettingsInt(NRPE_SECTION_TITLE, NRPE_SETTINGS_TIMEOUT ,NRPE_SETTINGS_TIMEOUT_DEFAULT); 
    3440  std::list<std::string> commands = NSCModuleHelper::getSettingsSection(NRPE_HANDLER_SECTION_TITLE); 
    35   std::list<std::string>::iterator it; 
    36   for (it = commands.begin(); it != commands.end(); it++) { 
    37     strEx::token t = strEx::getToken(*it, '='); 
    38     if (t.first.substr(0,7) == "command") { 
    39       strEx::token t2 = strEx::getToken(t.first, '['); 
    40       t2 = strEx::getToken(t2.second, ']'); 
    41       t.first = t2.first; 
    42     } 
    43     if (t.first.empty() || t.second.empty()) { 
     41  std::list<std::string>::const_iterator it; 
     42  for (it = commands.begin(); it != commands.end(); ++it) { 
     43    std::string command_name; 
     44    if (((*it).length() > 7)&&((*it).substr(0,7) == "command")) { 
     45      strEx::token t = strEx::getToken((*it), '['); 
     46      t = strEx::getToken(t.second, ']'); 
     47      command_name = t.first; 
     48    } else { 
     49      command_name = (*it); 
     50    } 
     51    std::string s = NSCModuleHelper::getSettingsString(NRPE_HANDLER_SECTION_TITLE, (*it), ""); 
     52    if (command_name.empty() || s.empty()) { 
    4453      NSC_LOG_ERROR_STD("Invalid command definition: " + (*it)); 
    4554    } else { 
    46       addCommand(t.first.c_str(), t.second); 
    47     } 
    48   } 
    49  
    50   allowedHosts.setAllowedHosts(strEx::splitEx(getAllowedHosts(), ",")); 
     55      addCommand(command_name.c_str(), s); 
     56    } 
     57  } 
     58 
     59  allowedHosts.setAllowedHosts(strEx::splitEx(getAllowedHosts(), ","), getCacheAllowedHosts()); 
    5160  try { 
    5261    unsigned short port = NSCModuleHelper::getSettingsInt(NRPE_SECTION_TITLE, NRPE_SETTINGS_PORT, NRPE_SETTINGS_PORT_DEFAULT); 
Note: See TracChangeset for help on using the changeset viewer.