Changeset 76aafc4 in nscp for modules/NRPEListener/NRPEListener.cpp
- Timestamp:
- 10/26/06 07:03:39 (7 years ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2, stable
- Children:
- 7aef770
- Parents:
- 70f2d7b
- File:
-
- 1 edited
-
modules/NRPEListener/NRPEListener.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
modules/NRPEListener/NRPEListener.cpp
rf42280d r76aafc4 28 28 return ret; 29 29 } 30 bool 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 } 30 36 31 37 bool NRPEListener::loadModule() { … … 33 39 timeout = NSCModuleHelper::getSettingsInt(NRPE_SECTION_TITLE, NRPE_SETTINGS_TIMEOUT ,NRPE_SETTINGS_TIMEOUT_DEFAULT); 34 40 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()) { 44 53 NSC_LOG_ERROR_STD("Invalid command definition: " + (*it)); 45 54 } 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()); 51 60 try { 52 61 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.








