Squashed commit of the following:
commit
53760dc07886359c1b1cb39b583c4a9bc66ddf26
Author: Sreeja Athirkandathil Narayanan <sathirka@cisco.com>
Date: Wed Sep 2 16:26:58 2020 -0400
appid: Dump user appid configuration on reload detectors
#include "app_info_table.h"
#include <climits>
+#include <fstream>
#include <string>
#include <unistd.h>
fclose(config_file);
}
+void AppInfoManager::dump_appid_configurations(std::string file_path)
+{
+ std::ifstream conf_file(file_path);
+ if (!conf_file.is_open())
+ {
+ ParseError("appid: could not open %s", file_path.c_str());
+ return;
+ }
+
+ LogMessage("AppId: Configuration file %s\n", file_path.c_str());
+ std::string line;
+ while (getline(conf_file, line))
+ LogMessage("%s\n", line.c_str());
+
+ conf_file.close();
+}
+
SnortProtocolId AppInfoManager::add_appid_protocol_reference(const char* protocol,
SnortConfig* sc)
{
void cleanup_appid_info_table();
void dump_app_info_table();
SnortProtocolId add_appid_protocol_reference(const char* protocol, snort::SnortConfig*);
+ void dump_appid_configurations(std::string);
private:
void load_odp_config(OdpContext&, const char* path);
{
odp_ctxt.get_app_info_mgr().cleanup_appid_info_table();
delete &odp_ctxt;
+ AppIdContext& ctxt = inspector.get_ctxt();
+ if (ctxt.config.app_detector_dir)
+ {
+ std::string file_path = std::string(ctxt.config.app_detector_dir) + "/custom/userappid.conf";
+ if (access(file_path.c_str(), F_OK))
+ file_path = std::string(ctxt.config.app_detector_dir) + "/../userappid.conf";
+ ctxt.get_odp_ctxt().get_app_info_mgr().dump_appid_configurations(file_path);
+ }
LogMessage("== reload detectors complete\n");
request.respond("== reload detectors complete\n", from_shell, true);
Swapper::set_reload_in_progress(false);