X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/46b0747592074017ff0ea4b33d4a7194235886e5..c7801cde8b95a9ef8318030e1caaa0be0603fe80:/stargazer/plugins/other/radius/radius.cpp diff --git a/stargazer/plugins/other/radius/radius.cpp b/stargazer/plugins/other/radius/radius.cpp index 45a9d0e1..dcfb4e69 100644 --- a/stargazer/plugins/other/radius/radius.cpp +++ b/stargazer/plugins/other/radius/radius.cpp @@ -22,7 +22,7 @@ #include "stg/store.h" #include "stg/users.h" -#include "stg/plugin_creator.h" +#include "stg/user.h" #include "stg/common.h" #include @@ -41,26 +41,19 @@ using STG::Config; using STG::Conn; -namespace +extern "C" STG::Plugin* GetPlugin() { - -PLUGIN_CREATOR creator; - -} - -extern "C" PLUGIN * GetPlugin() -{ - return creator.GetPlugin(); + static RADIUS plugin; + return &plugin; } RADIUS::RADIUS() - : m_config(), - m_running(false), + : m_running(false), m_stopped(true), m_users(NULL), m_store(NULL), m_listenSocket(0), - m_logger(GetPluginLogger(GetStgLogger(), "radius")) + m_logger(STG::PluginLogger::get("radius")) { } @@ -362,12 +355,12 @@ void RADIUS::acceptTCP() m_logger(m_error); return; } - std::string remote = inet_ntostring(addr.sin_addr.s_addr) + ":" + x2str(ntohs(addr.sin_port)); + std::string remote = inet_ntostring(addr.sin_addr.s_addr) + ":" + std::to_string(ntohs(addr.sin_port)); printfd(__FILE__, "New TCP connection: '%s'\n", remote.c_str()); m_conns.push_back(new Conn(*m_users, m_logger, *this, m_config, res, remote)); } -void RADIUS::authorize(const USER& user) +void RADIUS::authorize(const STG::User& user) { uint32_t ip = 0; const std::string& login(user.GetLogin());