// take in a DM plugin configuration file, find the DMPlugin descendent matching the value of plugname, and store its class factory funcs for later use
DMPlugin* dm_plugin_load(const char *pluginConfigPath)
{
	ConfigVar cv;

	if (cv.readVar(pluginConfigPath, "=") > 0) {
		if (!is_daemonised) {
			std::cerr << "Unable to load plugin config: " << pluginConfigPath << std::endl;
		}
		syslog(LOG_ERR, "Unable to load plugin config %s", pluginConfigPath);
		return NULL;
	}

	String plugname(cv["plugname"]);

	if (plugname.length() < 1) {
		if (!is_daemonised) {
			std::cerr << "Unable read plugin config plugname variable: " << pluginConfigPath << std::endl;
		}
		syslog(LOG_ERR, "Unable read plugin config plugname variable %s", pluginConfigPath);
		return NULL;
	}

	if (plugname == "default") {
#ifdef DGDEBUG
		std::cout << "Enabling default DM plugin" << std::endl;
#endif
		return defaultdmcreate(cv);
	}
	
#ifdef ENABLE_FANCYDM
	if (plugname == "fancy") {
#ifdef DGDEBUG
		std::cout << "Enabling fancy DM plugin" << std::endl;
#endif
		return fancydmcreate(cv);
	}
#endif

#ifdef ENABLE_TRICKLEDM
	if (plugname == "trickle") {
#ifdef DGDEBUG
		std::cout << "Enabling trickle DM plugin" << std::endl;
#endif
		return trickledmcreate(cv);
	}
#endif

	if (!is_daemonised) {
		std::cerr << "Unable to load plugin: " << plugname << std::endl;
	}
	syslog(LOG_ERR, "Unable to load plugin %s", plugname.toCharArray());
	return NULL;
}
Beispiel #2
0
// take in a configuration file, find the CSPlugin class associated with the plugname variable, and return an instance
CSPlugin *cs_plugin_load(const char *pluginConfigPath)
{
    ConfigVar cv;

    if (cv.readVar(pluginConfigPath, "=") > 0) {
        if (!is_daemonised) {
            std::cerr << "Unable to load plugin config: " << pluginConfigPath << std::endl;
        }
        syslog(LOG_ERR, "Unable to load plugin config %s", pluginConfigPath);
        return NULL;
    }

    String plugname(cv["plugname"]);
    if (plugname.length() < 1) {
        if (!is_daemonised) {
            std::cerr << "Unable read plugin config plugname variable: " << pluginConfigPath << std::endl;
        }
        syslog(LOG_ERR, "Unable read plugin config plugname variable %s", pluginConfigPath);
        return NULL;
    }

#ifdef ENABLE_CLAMD
    if (plugname == "clamdscan") {
#ifdef DGDEBUG
        std::cout << "Enabling ClamDscan CS plugin" << std::endl;
#endif
        return clamdcreate(cv);
    }
#endif

#ifdef ENABLE_AVASTD
    if (plugname == "avastdscan") {
#ifdef DGDEBUG
        std::cout << "Enabling AvastDscan CS plugin" << std::endl;
#endif
        return avastdcreate(cv);
    }
#endif

#ifdef ENABLE_KAVD
    if (plugname == "kavdscan") {
#ifdef DGDEBUG
        std::cout << "Enabling KAVDscan CS plugin" << std::endl;
#endif
        return kavdcreate(cv);
    }
#endif

#ifdef ENABLE_ICAP
    if (plugname == "icapscan") {
#ifdef DGDEBUG
        std::cout << "Enabling ICAPscan CS plugin" << std::endl;
#endif
        return icapcreate(cv);
    }
#endif

#ifdef ENABLE_COMMANDLINE
    if (plugname == "commandlinescan") {
#ifdef DGDEBUG
        std::cout << "Enabling command-line CS plugin" << std::endl;
#endif
        return commandlinecreate(cv);
    }
#endif

    if (!is_daemonised) {
        std::cerr << "Unable to load plugin: " << pluginConfigPath << std::endl;
    }
    syslog(LOG_ERR, "Unable to load plugin %s\n", pluginConfigPath);
    return NULL;
}
Beispiel #3
0
// take in a configuration file, find the AuthPlugin class associated with the plugname variable, and return an instance
AuthPlugin* auth_plugin_load(const char *pluginConfigPath)
{
	ConfigVar cv;

	if (cv.readVar(pluginConfigPath, "=") > 0) {
		if (!is_daemonised) {
			std::cerr << "Unable to load plugin config: " << pluginConfigPath << std::endl;
		}
		syslog(LOG_ERR, "Unable to load plugin config %s", pluginConfigPath);
		return NULL;
	}

	String plugname(cv["plugname"]);
	if (plugname.length() < 1) {
		if (!is_daemonised) {
			std::cerr << "Unable read plugin config plugname variable: " << pluginConfigPath << std::endl;
		}
		syslog(LOG_ERR, "Unable read plugin config plugname variable %s", pluginConfigPath);
		return NULL;
	}

	if (plugname == "proxy-basic") {
#ifdef DGDEBUG
		std::cout << "Enabling proxy-basic auth plugin" << std::endl;
#endif
		return proxycreate(cv);
	}

	if (plugname == "proxy-digest") {
#ifdef DGDEBUG
		std::cout << "Enabling proxy-digest auth plugin" << std::endl;
#endif
		return digestcreate(cv);
	}

	if (plugname == "ident") {
#ifdef DGDEBUG
		std::cout << "Enabling ident server auth plugin" << std::endl;
#endif
		return identcreate(cv);
	}

	if (plugname == "ip") {
#ifdef DGDEBUG
		std::cout << "Enabling IP-based auth plugin" << std::endl;
#endif
		return ipcreate(cv);
	}

#ifdef ENABLE_NTLM
	if (plugname == "proxy-ntlm") {
#ifdef DGDEBUG
		std::cout << "Enabling proxy-NTLM auth plugin" << std::endl;
#endif
		return ntlmcreate(cv);
	}
#endif
#ifdef __SSLCERT
	if (plugname == "ssl") {
#ifdef DGDEBUG
		std::cout << "Enabling SSL login/core auth plugin" << std::endl;
#endif
		return sslcorecreate(cv);
	}

	if (plugname == "core") {
#ifdef DGDEBUG
		std::cout << "Enabling SSL login/core auth plugin" << std::endl;
#endif
		return sslcorecreate(cv);
	}
#endif //__SSLCERT

	if (!is_daemonised) {
		std::cerr << "Unable to load plugin: " << pluginConfigPath << std::endl;
	}
	syslog(LOG_ERR, "Unable to load plugin %s", pluginConfigPath);
	return NULL;
}