Changeset 5044c09 in nscp
- Timestamp:
- 11/19/07 23:30:41 (6 years ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2, stable
- Children:
- df0ab60
- Parents:
- 23c63eb
- Files:
-
- 26 added
- 5 edited
-
AutoBuild.h (modified) (1 diff)
-
NSClient++-2005.sln (added)
-
NSClient++-2005.vcproj (added)
-
NSClient++-2008.sln (added)
-
NSClient++-2008.vcproj (added)
-
NSClient++.cpp (modified) (8 diffs)
-
NSClient++.h (modified) (2 diffs)
-
changelog (modified) (1 diff)
-
include/REGSettings.h (modified) (2 diffs)
-
modules/CheckDisk/CheckDisk-2005.vcproj (added)
-
modules/CheckDisk/CheckDisk-2008.vcproj (added)
-
modules/CheckEventLog/CheckEventLog-2005.vcproj (added)
-
modules/CheckEventLog/CheckEventLog-2008.vcproj (added)
-
modules/CheckHelpers/CheckHelpers-2005.vcproj (added)
-
modules/CheckHelpers/CheckHelpers-2008.vcproj (added)
-
modules/CheckSystem/CheckSystem-2005.vcproj (added)
-
modules/CheckSystem/CheckSystem-2008.vcproj (added)
-
modules/CheckWMI/CheckWMI-2005.vcproj (added)
-
modules/CheckWMI/CheckWMI-2008.vcproj (added)
-
modules/FileLogger/FileLogger-2005.vcproj (added)
-
modules/FileLogger/FileLogger-2008.vcproj (added)
-
modules/NRPEListener/NRPEListener-2005.vcproj (added)
-
modules/NRPEListener/NRPEListener-2008.vcproj (added)
-
modules/NSCAAgent/NSCAAgent-2005.vcproj (added)
-
modules/NSCAAgent/NSCAAgent-2008.vcproj (added)
-
modules/NSClientListener/NSClientListener-2005.vcproj (added)
-
modules/NSClientListener/NSClientListener-2008.vcproj (added)
-
modules/RemoteConfiguration/RemoteConfiguration-2005.vcproj (added)
-
modules/RemoteConfiguration/RemoteConfiguration-2008.vcproj (added)
-
modules/SysTray/SysTray-2005.vcproj (added)
-
modules/SysTray/SysTray-2008.vcproj (added)
Legend:
- Unmodified
- Added
- Removed
-
AutoBuild.h
r23c63eb r5044c09 3 3 // change the FALSE to TRUE for autoincrement of build number 4 4 #define INCREMENT_VERSION TRUE 5 #define FILEVER 0,2,7,8 36 #define PRODUCTVER 0,2,7,18 17 #define STRFILEVER "0.2.7.8 3"8 #define STRPRODUCTVER "0.2.7.18 1"9 #define STRPRODUCTDATE "2007-11-1 6"5 #define FILEVER 0,2,7,84 6 #define PRODUCTVER 0,2,7,182 7 #define STRFILEVER "0.2.7.84" 8 #define STRPRODUCTVER "0.2.7.182" 9 #define STRPRODUCTDATE "2007-11-18" 10 10 #endif // AUTOBUILD_H -
NSClient++.cpp
rb0ae738 r5044c09 104 104 g_bConsoleLog = true; 105 105 LOG_MESSAGE(SZAPPNAME " Version: " SZVERSION); 106 } else if ( _stricmp( "noboot", argv[1]+1 ) == 0 ) { 107 g_bConsoleLog = true; 108 int nRetCode = -1; 109 if (argc>=4) 110 nRetCode = mainClient.commandLineExec(argv[2], argv[3], argc-4, &argv[4]); 111 else if (argc>=3) 112 nRetCode = mainClient.commandLineExec(argv[2], argv[3], 0, NULL); 113 return nRetCode; 106 114 } else if ( _stricmp( "test", argv[1]+1 ) == 0 ) { 107 115 #ifdef _DEBUG … … 144 152 } else { 145 153 LOG_MESSAGE("Usage: -version, -about, -install, -uninstall, -start, -stop, -encrypt"); 146 LOG_MESSAGE("Usage: <ModuleName> <commnd> [arguments]");154 LOG_MESSAGE("Usage: [-noboot] <ModuleName> <commnd> [arguments]"); 147 155 } 148 156 return nRetCode; … … 151 159 mainClient.InitiateService(); 152 160 if (argc>=3) 153 mainClient.commandLineExec(argv[1], argv[2], argc-3, &argv[3]);161 nRetCode = mainClient.commandLineExec(argv[1], argv[2], argc-3, &argv[3]); 154 162 else 155 mainClient.commandLineExec(argv[1], argv[2], 0, NULL);163 nRetCode = mainClient.commandLineExec(argv[1], argv[2], 0, NULL); 156 164 mainClient.TerminateService(); 157 165 return nRetCode; … … 253 261 int NSClientT::commandLineExec(const char* module, const char* command, const unsigned int argLen, char** args) { 254 262 std::string sModule = module; 255 ReadLock readLock(&m_mutexRW, true, 10000);256 if (!readLock.IsLocked()) {257 LOG_ERROR("FATAL ERROR: Could not get read-mutex.");258 return -1;259 }260 263 std::string moduleList = ""; 261 for (pluginList::size_type i=0;i<plugins_.size();++i) { 262 NSCPlugin *p = plugins_[i]; 263 if (!moduleList.empty()) 264 moduleList += ", "; 265 moduleList += p->getModule(); 266 if (p->getModule() == sModule) { 267 LOG_DEBUG_STD("Found module: " + p->getName() + "..."); 268 try { 269 return p->commandLineExec(command, argLen, args); 270 } catch (NSPluginException e) { 271 LOG_ERROR_STD("Could not execute command: " + e.error_ + " in " + e.file_); 272 return -1; 273 } 274 } 264 { 265 ReadLock readLock(&m_mutexRW, true, 10000); 266 if (!readLock.IsLocked()) { 267 LOG_ERROR("FATAL ERROR: Could not get read-mutex."); 268 return -1; 269 } 270 for (pluginList::size_type i=0;i<plugins_.size();++i) { 271 NSCPlugin *p = plugins_[i]; 272 if (!moduleList.empty()) 273 moduleList += ", "; 274 moduleList += p->getModule(); 275 if (p->getModule() == sModule) { 276 LOG_DEBUG_STD("Found module: " + p->getName() + "..."); 277 try { 278 return p->commandLineExec(command, argLen, args); 279 } catch (NSPluginException e) { 280 LOG_ERROR_STD("Could not execute command: " + e.error_ + " in " + e.file_); 281 return -1; 282 } 283 } 284 } 285 } 286 LOG_MESSAGE_STD("Module was not loaded, attempt to load it"); 287 try { 288 plugin_type plugin = loadPlugin(getBasePath() + "modules\\" + module); 289 LOG_DEBUG_STD("Loading plugin: " + plugin->getName() + "..."); 290 plugin->load_plugin(); 291 return plugin->commandLineExec(command, argLen, args); 292 } catch (NSPluginException e) { 293 LOG_MESSAGE_STD("Module (" + e.file_ + ") was not found: " + e.error_); 294 } 295 try { 296 plugin_type plugin = loadPlugin(getBasePath() + "modules\\" + module + ".dll"); 297 LOG_DEBUG_STD("Loading plugin: " + plugin->getName() + "..."); 298 plugin->load_plugin(); 299 return plugin->commandLineExec(command, argLen, args); 300 } catch (NSPluginException e) { 301 LOG_MESSAGE_STD("Module (" + e.file_ + ") was not found: " + e.error_); 275 302 } 276 303 LOG_ERROR_STD("Module not found: " + module + " available modules are: " + moduleList); … … 348 375 * @param file The DLL file 349 376 */ 350 voidNSClientT::loadPlugin(const std::string file) {351 addPlugin(new NSCPlugin(file));377 NSClientT::plugin_type NSClientT::loadPlugin(const std::string file) { 378 return addPlugin(new NSCPlugin(file)); 352 379 } 353 380 /** … … 355 382 * @param *plugin The plug-ininstance to load. The pointer is managed by the 356 383 */ 357 voidNSClientT::addPlugin(plugin_type plugin) {384 NSClientT::plugin_type NSClientT::addPlugin(plugin_type plugin) { 358 385 plugin->load_dll(); 359 386 { … … 361 388 if (!writeLock.IsLocked()) { 362 389 LOG_ERROR("FATAL ERROR: Could not get read-mutex."); 363 return ;390 return plugin; 364 391 } 365 392 plugins_.insert(plugins_.end(), plugin); … … 369 396 messageHandlers_.insert(messageHandlers_.end(), plugin); 370 397 } 371 398 return plugin; 372 399 } 373 400 -
NSClient++.h
rb749b8d r5044c09 92 92 93 93 void addPlugins(const std::list<std::string> plugins); 94 voidloadPlugin(const std::string plugin);94 plugin_type loadPlugin(const std::string plugin); 95 95 void loadPlugins(void); 96 96 void unloadPlugins(void); … … 99 99 100 100 private: 101 voidaddPlugin(plugin_type plugin);101 plugin_type addPlugin(plugin_type plugin); 102 102 103 103 }; -
changelog
r23c63eb r5044c09 5 5 * Add module for relaying events 6 6 * Add API for rehashing the daemon (or implement it the API is there but does nothing) 7 8 2007-11-19 MickeM 9 * Fixed a minor issue in reading registry keys 10 + Added -noboot option to startup used for running command line utilities without booting the client 11 "nsclient++ -noboot RemoteConfigruation ini2reg" for instance 12 + Added fallback to try <module> and <module>.dll if the module was nhot loaded (when running command lines) 13 * Migrated 2008 project files to new name and backported to 2005 project files. 7 14 8 15 2007-11-16 MickeM -
include/REGSettings.h
r860f310 r5044c09 5 5 #include <TSettings.h> 6 6 #include <msvc_wrappers.h> 7 #include <error.hpp> 7 8 #define BUFF_LEN 4096 8 9 … … 126 127 std::cout << "getString_::Unsupported type: " << lpszPath << "." << lpszKey << ": " << type << std::endl; 127 128 } 129 } else if (lRet == ERROR_FILE_NOT_FOUND) { 130 return def; 128 131 } else { 129 std::cout << "getString_::Error: " << lpszPath << "." << lpszKey << ": " << lRet<< std::endl;132 std::cout << "getString_::Error: " << lpszPath << "." << lpszKey << ": " << error::format::from_system(lRet) << std::endl; 130 133 } 131 134 RegCloseKey(hTemp);
Note: See TracChangeset
for help on using the changeset viewer.








