diff options
Diffstat (limited to 'src/Server/RequestHandlers')
7 files changed, 27 insertions, 17 deletions
diff --git a/src/Server/RequestHandlers/CMakeLists.txt b/src/Server/RequestHandlers/CMakeLists.txt deleted file mode 100644 index cb44105..0000000 --- a/src/Server/RequestHandlers/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -include_directories(${INCLUDES}) - -add_library(ServerRequestHandlers STATIC - ConnectionRequestHandlerGroup.cpp ConnectionRequestHandlerGroup.h - DaemonRequestHandlerGroup.cpp DaemonRequestHandlerGroup.h - UserRequestHandlerGroup.cpp UserRequestHandlerGroup.h -) -#target_link_libraries(ServerRequestHandlers ${KRB5_LIBRARIES}) diff --git a/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp b/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp index 0de73f9..e94853f 100644 --- a/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp +++ b/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.cpp @@ -23,6 +23,8 @@ #include <Core/LogManager.h> +#include <boost/date_time/posix_time/posix_time.hpp> + namespace Mad { namespace Server { namespace RequestHandlers { @@ -56,17 +58,27 @@ void ConnectionRequestHandlerGroup::handleIdentifyRequest(boost::shared_ptr<cons void ConnectionRequestHandlerGroup::handleLogRequest(boost::shared_ptr<const Common::XmlPacket> packet, Common::XmlPacket *ret, Common::Connection *connection) { // TODO Require authentication + + boost::posix_time::ptime timestamp(boost::posix_time::not_a_date_time); + + const std::string ×tr = packet->get<const std::string&>("timestamp"); + if(!timestr.empty()) { + try { + timestamp = boost::posix_time::from_iso_string(timestr); + } + catch(...) {} + } try { application->getLogManager()->log( - packet->get<Core::LoggerBase::MessageCategory>("category"), - packet->get<Core::LoggerBase::MessageLevel>("level"), - packet->get<time_t>("timestamp"), + static_cast<Core::LoggerBase::MessageCategory>(packet->get<long>("category")), + static_cast<Core::LoggerBase::MessageLevel>(packet->get<long>("level")), + timestamp, packet->get<const std::string&>("message"), application->getConnectionManager()->getDaemonName(connection)); } catch(Core::Exception &e) { - application->logf(Core::LoggerBase::ERROR, "Can't determine daemon name: %s", e.strerror().c_str()); + application->logf(Core::LoggerBase::LOG_ERROR, "Can't determine daemon name: %s", e.strerror().c_str()); } ret->setType("OK"); diff --git a/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.h b/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.h index c3deed1..7f6b17c 100644 --- a/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.h +++ b/src/Server/RequestHandlers/ConnectionRequestHandlerGroup.h @@ -20,6 +20,8 @@ #ifndef MAD_SERVER_REQUESTHANDLERS_CONNECTIONREQUESTHANDLERGROUP_H_ #define MAD_SERVER_REQUESTHANDLERS_CONNECTIONREQUESTHANDLERGROUP_H_ +#include "../export.h" + #include <Common/RequestHandlers/SimpleRequestHandlerGroup.h> namespace Mad { @@ -29,7 +31,7 @@ class Application; namespace RequestHandlers { -class ConnectionRequestHandlerGroup : public Common::RequestHandlers::SimpleRequestHandlerGroup { +class MAD_SERVER_EXPORT ConnectionRequestHandlerGroup : public Common::RequestHandlers::SimpleRequestHandlerGroup { private: Application *application; diff --git a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp index 4b2dd0c..0345d7b 100644 --- a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp +++ b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.cpp @@ -32,7 +32,7 @@ namespace RequestHandlers { void DaemonRequestHandlerGroup::DaemonRequestHandler::handlePacket(boost::shared_ptr<const Common::XmlPacket> packet) { if(packet->getType() != type) { - getApplication()->log(Core::LoggerBase::ERROR, "Received an unexpected packet."); + getApplication()->log(Core::LoggerBase::LOG_ERROR, "Received an unexpected packet."); Common::XmlPacket ret; ret.setType("Error"); diff --git a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h index b32005f..086bf16 100644 --- a/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h +++ b/src/Server/RequestHandlers/DaemonRequestHandlerGroup.h @@ -20,6 +20,8 @@ #ifndef MAD_SERVER_REQUESTHANDLERS_DAEMONREQUESTHANDLERGROUP_H_ #define MAD_SERVER_REQUESTHANDLERS_DAEMONREQUESTHANDLERGROUP_H_ +#include "../export.h" + #include <Common/RequestHandlerGroup.h> #include <Core/Exception.h> @@ -29,7 +31,7 @@ class ConnectionManager; namespace RequestHandlers { -class DaemonRequestHandlerGroup : public Common::RequestHandlerGroup { +class MAD_SERVER_EXPORT DaemonRequestHandlerGroup : public Common::RequestHandlerGroup { private: class DaemonRequestHandler : public Common::RequestHandler { private: diff --git a/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp b/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp index a1aa829..873815a 100644 --- a/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp +++ b/src/Server/RequestHandlers/UserRequestHandlerGroup.cpp @@ -236,7 +236,7 @@ void UserRequestHandlerGroup::handleFullUserGroupListRequest(boost::shared_ptr<c if(userGroups) { Common::XmlPacket::List *list = ret->createList("userGroupList"); - for(std::map<unsigned long, unsigned long>::const_iterator userGroup = userGroups->begin(); userGroup != userGroups->end(); ++userGroup) { + for(std::multimap<unsigned long, unsigned long>::const_iterator userGroup = userGroups->begin(); userGroup != userGroups->end(); ++userGroup) { Common::XmlPacket::List::iterator entry = list->addEntry(); entry->set("uid", userGroup->first); diff --git a/src/Server/RequestHandlers/UserRequestHandlerGroup.h b/src/Server/RequestHandlers/UserRequestHandlerGroup.h index ee4b7f4..aed585f 100644 --- a/src/Server/RequestHandlers/UserRequestHandlerGroup.h +++ b/src/Server/RequestHandlers/UserRequestHandlerGroup.h @@ -20,6 +20,8 @@ #ifndef MAD_SERVER_REQUESTHANDLERS_USERREQUESTHANDLERGROUP_H_ #define MAD_SERVER_REQUESTHANDLERS_USERREQUESTHANDLERGROUP_H_ +#include "../export.h" + #include <Common/RequestHandlers/SimpleRequestHandlerGroup.h> namespace Mad { @@ -29,7 +31,7 @@ class Application; namespace RequestHandlers { -class UserRequestHandlerGroup : public Common::RequestHandlers::SimpleRequestHandlerGroup { +class MAD_SERVER_EXPORT UserRequestHandlerGroup : public Common::RequestHandlers::SimpleRequestHandlerGroup { private: Application *application; |