summaryrefslogtreecommitdiffstats
path: root/src/Server/RequestHandlers
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-04-29 19:57:50 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-04-29 19:57:50 +0200
commit7c8a134b082e1224a6ece26cefdf939753088e2c (patch)
tree2400eb68900ff6f6be1e1b808b00c23a76a04877 /src/Server/RequestHandlers
parent5a61159a11e1db775a2b5dfebc46c12ff2616b5a (diff)
downloadmad-7c8a134b082e1224a6ece26cefdf939753088e2c.tar
mad-7c8a134b082e1224a6ece26cefdf939753088e2c.zip
Core in Server umbenannt
Diffstat (limited to 'src/Server/RequestHandlers')
-rw-r--r--src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp85
-rw-r--r--src/Server/RequestHandlers/DaemonCommandRequestHandler.h47
-rw-r--r--src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp83
-rw-r--r--src/Server/RequestHandlers/DaemonFSInfoRequestHandler.h47
-rw-r--r--src/Server/RequestHandlers/DaemonListRequestHandler.cpp65
-rw-r--r--src/Server/RequestHandlers/DaemonListRequestHandler.h42
-rw-r--r--src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp85
-rw-r--r--src/Server/RequestHandlers/DaemonStatusRequestHandler.h47
-rw-r--r--src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp134
-rw-r--r--src/Server/RequestHandlers/GSSAPIAuthRequestHandler.h48
-rw-r--r--src/Server/RequestHandlers/IdentifyRequestHandler.cpp67
-rw-r--r--src/Server/RequestHandlers/IdentifyRequestHandler.h42
-rw-r--r--src/Server/RequestHandlers/LogRequestHandler.cpp63
-rw-r--r--src/Server/RequestHandlers/LogRequestHandler.h42
-rw-r--r--src/Server/RequestHandlers/Makefile.am6
-rw-r--r--src/Server/RequestHandlers/Makefile.in542
-rw-r--r--src/Server/RequestHandlers/UserInfoRequestHandler.cpp70
-rw-r--r--src/Server/RequestHandlers/UserInfoRequestHandler.h48
-rw-r--r--src/Server/RequestHandlers/UserListRequestHandler.cpp76
-rw-r--r--src/Server/RequestHandlers/UserListRequestHandler.h48
20 files changed, 1687 insertions, 0 deletions
diff --git a/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp b/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp
new file mode 100644
index 0000000..7c1efb9
--- /dev/null
+++ b/src/Server/RequestHandlers/DaemonCommandRequestHandler.cpp
@@ -0,0 +1,85 @@
+/*
+ * DaemonCommandRequestHandler.cpp
+ *
+ * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "DaemonCommandRequestHandler.h"
+#include "../ConnectionManager.h"
+#include "../Requests/CommandRequest.h"
+
+#include <Common/Logger.h>
+
+namespace Mad {
+namespace Server {
+namespace RequestHandlers {
+
+void DaemonCommandRequestHandler::handlePacket(const Common::XmlPacket &packet) {
+ if(packet.getType() != "DaemonCommand") {
+ Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
+
+ Common::XmlPacket ret;
+ ret.setType("Error");
+ ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET);
+
+ sendPacket(ret);
+
+ signalFinished().emit();
+ return;
+ }
+
+ // TODO Require authentication
+
+ std::string command = packet["command"];
+
+ try {
+ Common::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(packet["daemon"]);
+ Common::RequestManager::get()->sendRequest<Requests::CommandRequest>(daemonCon,
+ sigc::mem_fun(this, &DaemonCommandRequestHandler::requestFinished), command == "reboot");
+ }
+ catch(Common::Exception &e) {
+ Common::XmlPacket ret;
+ ret.setType("Error");
+ ret.add("ErrorCode", e.getErrorCode());
+ ret.add("SubCode", e.getSubCode());
+ ret.add("SubSubCode", e.getSubSubCode());
+ ret.add("Where", e.getWhere());
+
+ sendPacket(ret);
+ }
+}
+
+void DaemonCommandRequestHandler::requestFinished(const Common::Request &request) {
+ try {
+ sendPacket(request.getResult());
+ }
+ catch(Common::Exception &e) {
+ Common::XmlPacket ret;
+ ret.setType("Error");
+ ret.add("ErrorCode", e.getErrorCode());
+ ret.add("SubCode", e.getSubCode());
+ ret.add("SubSubCode", e.getSubSubCode());
+ ret.add("Where", e.getWhere());
+
+ sendPacket(ret);
+ }
+
+ signalFinished().emit();
+}
+
+}
+}
+}
diff --git a/src/Server/RequestHandlers/DaemonCommandRequestHandler.h b/src/Server/RequestHandlers/DaemonCommandRequestHandler.h
new file mode 100644
index 0000000..6bd1278
--- /dev/null
+++ b/src/Server/RequestHandlers/DaemonCommandRequestHandler.h
@@ -0,0 +1,47 @@
+/*
+ * DaemonCommandRequestHandler.h
+ *
+ * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MAD_SERVER_REQUESTHANDLERS_DAEMONCOMMANDREQUESTHANDLER_H_
+#define MAD_SERVER_REQUESTHANDLERS_DAEMONCOMMANDREQUESTHANDLER_H_
+
+#include <Common/RequestHandler.h>
+#include <Common/Request.h>
+#include <stdint.h>
+
+namespace Mad {
+namespace Server {
+namespace RequestHandlers {
+
+class DaemonCommandRequestHandler : public Common::RequestHandler {
+ private:
+ void requestFinished(const Common::Request &request);
+
+ protected:
+ virtual void handlePacket(const Common::XmlPacket &packet);
+
+ public:
+ DaemonCommandRequestHandler(Common::Connection *connection, uint16_t requestId)
+ : RequestHandler(connection, requestId) {}
+};
+
+}
+}
+}
+
+#endif /* MAD_SERVER_REQUESTHANDLERS_DAEMONCOMMANDREQUESTHANDLER_H_ */
diff --git a/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp b/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp
new file mode 100644
index 0000000..9ccca40
--- /dev/null
+++ b/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.cpp
@@ -0,0 +1,83 @@
+/*
+ * DaemonFSInfoRequestHandler.cpp
+ *
+ * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "DaemonFSInfoRequestHandler.h"
+#include "../ConnectionManager.h"
+#include <Common/Logger.h>
+#include <Common/Requests/FSInfoRequest.h>
+
+
+namespace Mad {
+namespace Server {
+namespace RequestHandlers {
+
+void DaemonFSInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) {
+ if(packet.getType() != "DaemonFSInfo") {
+ Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
+
+ Common::XmlPacket ret;
+ ret.setType("Error");
+ ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET);
+
+ sendPacket(ret);
+
+ signalFinished().emit();
+ return;
+ }
+
+ // TODO Require authentication
+
+ try {
+ Common::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(packet["daemon"]);
+ Common::RequestManager::get()->sendRequest<Common::Requests::FSInfoRequest>(daemonCon,
+ sigc::mem_fun(this, &DaemonFSInfoRequestHandler::requestFinished));
+ }
+ catch(Common::Exception &e) {
+ Common::XmlPacket ret;
+ ret.setType("Error");
+ ret.add("ErrorCode", e.getErrorCode());
+ ret.add("SubCode", e.getSubCode());
+ ret.add("SubSubCode", e.getSubSubCode());
+ ret.add("Where", e.getWhere());
+
+ sendPacket(ret);
+ }
+}
+
+void DaemonFSInfoRequestHandler::requestFinished(const Common::Request &request) {
+ try {
+ sendPacket(request.getResult());
+ }
+ catch(Common::Exception &e) {
+ Common::XmlPacket ret;
+ ret.setType("Error");
+ ret.add("ErrorCode", e.getErrorCode());
+ ret.add("SubCode", e.getSubCode());
+ ret.add("SubSubCode", e.getSubSubCode());
+ ret.add("Where", e.getWhere());
+
+ sendPacket(ret);
+ }
+
+ signalFinished().emit();
+}
+
+}
+}
+}
diff --git a/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.h b/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.h
new file mode 100644
index 0000000..3352f11
--- /dev/null
+++ b/src/Server/RequestHandlers/DaemonFSInfoRequestHandler.h
@@ -0,0 +1,47 @@
+/*
+ * DaemonFSInfoRequestHandler.h
+ *
+ * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MAD_SERVER_REQUESTHANDLERS_DAEMONFSINFOREQUESTHANDLER_H_
+#define MAD_SERVER_REQUESTHANDLERS_DAEMONFSINFOREQUESTHANDLER_H_
+
+#include <Common/RequestHandler.h>
+#include <Common/Request.h>
+#include <stdint.h>
+
+namespace Mad {
+namespace Server {
+namespace RequestHandlers {
+
+class DaemonFSInfoRequestHandler : public Common::RequestHandler {
+ private:
+ void requestFinished(const Common::Request &request);
+
+ protected:
+ virtual void handlePacket(const Common::XmlPacket &packet);
+
+ public:
+ DaemonFSInfoRequestHandler(Common::Connection *connection, uint16_t requestId)
+ : RequestHandler(connection, requestId) {}
+};
+
+}
+}
+}
+
+#endif /* MAD_SERVER_REQUESTHANDLERS_DAEMONFSINFOREQUESTHANDLER_H_ */
diff --git a/src/Server/RequestHandlers/DaemonListRequestHandler.cpp b/src/Server/RequestHandlers/DaemonListRequestHandler.cpp
new file mode 100644
index 0000000..c4b4143
--- /dev/null
+++ b/src/Server/RequestHandlers/DaemonListRequestHandler.cpp
@@ -0,0 +1,65 @@
+/*
+ * DaemonListRequestHandler.cpp
+ *
+ * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "DaemonListRequestHandler.h"
+#include "../ConnectionManager.h"
+#include <Common/Logger.h>
+
+namespace Mad {
+namespace Server {
+namespace RequestHandlers {
+
+void DaemonListRequestHandler::handlePacket(const Common::XmlPacket &packet) {
+ if(packet.getType() != "ListHosts") {
+ Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
+
+ Common::XmlPacket ret;
+ ret.setType("Error");
+ ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET);
+
+ sendPacket(ret);
+
+ signalFinished().emit();
+ return;
+ }
+
+ // TODO Require authentication
+
+ Common::XmlPacket ret;
+ ret.setType("OK");
+ ret.addList("hosts");
+
+ std::vector<Common::HostInfo> daemons = ConnectionManager::get()->getDaemonList();
+
+ for(std::vector<Common::HostInfo>::iterator daemon = daemons.begin(); daemon != daemons.end(); ++daemon) {
+ ret["hosts"].addEntry();
+
+ ret["hosts"].back().add("name", daemon->getName());
+ ret["hosts"].back().add("address", daemon->getIP());
+ ret["hosts"].back().add("state", daemon->getState());
+ }
+
+ sendPacket(ret);
+
+ signalFinished().emit();
+}
+
+}
+}
+}
diff --git a/src/Server/RequestHandlers/DaemonListRequestHandler.h b/src/Server/RequestHandlers/DaemonListRequestHandler.h
new file mode 100644
index 0000000..8726962
--- /dev/null
+++ b/src/Server/RequestHandlers/DaemonListRequestHandler.h
@@ -0,0 +1,42 @@
+/*
+ * DaemonListRequestHandler.h
+ *
+ * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MAD_SERVER_REQUESTHANDLERS_DAEMONLISTREQUESTHANDLER_H_
+#define MAD_SERVER_REQUESTHANDLERS_DAEMONLISTREQUESTHANDLER_H_
+
+#include <Common/RequestHandler.h>
+
+namespace Mad {
+namespace Server {
+namespace RequestHandlers {
+
+class DaemonListRequestHandler : public Common::RequestHandler {
+ protected:
+ virtual void handlePacket(const Common::XmlPacket &packet);
+
+ public:
+ DaemonListRequestHandler(Common::Connection *connection, uint16_t requestId)
+ : RequestHandler(connection, requestId) {}
+};
+
+}
+}
+}
+
+#endif /* MAD_SERVER_REQUESTHANDLERS_DAEMONLISTREQUESTHANDLER_H_ */
diff --git a/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp b/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp
new file mode 100644
index 0000000..07e0c4c
--- /dev/null
+++ b/src/Server/RequestHandlers/DaemonStatusRequestHandler.cpp
@@ -0,0 +1,85 @@
+/*
+ * DaemonStatusRequestHandler.cpp
+ *
+ * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "DaemonStatusRequestHandler.h"
+#include "../ConnectionManager.h"
+#include <Common/Logger.h>
+#include <Common/Requests/StatusRequest.h>
+
+
+namespace Mad {
+namespace Server {
+namespace RequestHandlers {
+
+void DaemonStatusRequestHandler::handlePacket(const Common::XmlPacket &packet) {
+ if(packet.getType() != "GetDaemonStatus") {
+ Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
+
+ Common::XmlPacket ret;
+ ret.setType("Error");
+ ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET);
+
+ sendPacket(ret);
+
+ signalFinished().emit();
+ return;
+ }
+
+ // TODO Require authentication
+
+ std::string daemonName = packet["daemonName"];
+
+ try {
+ Common::Connection *daemonCon = ConnectionManager::get()->getDaemonConnection(daemonName);
+ Common::RequestManager::get()->sendRequest<Common::Requests::StatusRequest>(daemonCon,
+ sigc::mem_fun(this, &DaemonStatusRequestHandler::requestFinished));
+ }
+ catch(Common::Exception &e) {
+ Common::XmlPacket ret;
+ ret.setType("Error");
+ ret.add("ErrorCode", e.getErrorCode());
+ ret.add("SubCode", e.getSubCode());
+ ret.add("SubSubCode", e.getSubSubCode());
+ ret.add("Where", e.getWhere());
+
+ sendPacket(ret);
+ }
+}
+
+void DaemonStatusRequestHandler::requestFinished(const Common::Request &request) {
+ try {
+ sendPacket(request.getResult());
+ }
+ catch(Common::Exception &e) {
+ Common::XmlPacket ret;
+ ret.setType("Error");
+ ret.add("ErrorCode", e.getErrorCode());
+ ret.add("SubCode", e.getSubCode());
+ ret.add("SubSubCode", e.getSubSubCode());
+ ret.add("Where", e.getWhere());
+
+ sendPacket(ret);
+ }
+
+ signalFinished().emit();
+}
+
+}
+}
+}
diff --git a/src/Server/RequestHandlers/DaemonStatusRequestHandler.h b/src/Server/RequestHandlers/DaemonStatusRequestHandler.h
new file mode 100644
index 0000000..8e61ada
--- /dev/null
+++ b/src/Server/RequestHandlers/DaemonStatusRequestHandler.h
@@ -0,0 +1,47 @@
+/*
+ * DaemonStatusRequestHandler.h
+ *
+ * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MAD_SERVER_REQUESTHANDLERS_DAEMONSTATUSREQUESTHANDLER_H_
+#define MAD_SERVER_REQUESTHANDLERS_DAEMONSTATUSREQUESTHANDLER_H_
+
+#include <Common/RequestHandler.h>
+#include <Common/Request.h>
+#include <stdint.h>
+
+namespace Mad {
+namespace Server {
+namespace RequestHandlers {
+
+class DaemonStatusRequestHandler : public Common::RequestHandler {
+ private:
+ void requestFinished(const Common::Request &request);
+
+ protected:
+ virtual void handlePacket(const Common::XmlPacket &packet);
+
+ public:
+ DaemonStatusRequestHandler(Common::Connection *connection, uint16_t requestId)
+ : RequestHandler(connection, requestId) {}
+};
+
+}
+}
+}
+
+#endif /* MAD_SERVER_REQUESTHANDLERS_DAEMONSTATUSREQUESTHANDLER_H_ */
diff --git a/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp b/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp
new file mode 100644
index 0000000..c665843
--- /dev/null
+++ b/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp
@@ -0,0 +1,134 @@
+/*
+ * GSSAPIAuthRequestHandler.cpp
+ *
+ * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "GSSAPIAuthRequestHandler.h"
+#include <Common/Exception.h>
+#include <Common/Logger.h>
+#include <Net/Connection.h>
+
+#include <cstring>
+
+namespace Mad {
+namespace Server {
+namespace RequestHandlers {
+
+// TODO Error handling
+
+void GSSAPIAuthRequestHandler::handlePacket(const Common::XmlPacket &packet) {
+ if(packet.getType() != "AuthGSSAPI") {
+ Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
+
+ Common::XmlPacket ret;
+ ret.setType("Error");
+ ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET);
+
+ sendPacket(ret);
+
+ signalFinished().emit();
+ return;
+ }
+
+ OM_uint32 majStat, minStat;
+ gss_buffer_desc recvBuffer, sendBuffer;
+
+ // Needs error handling!
+
+ if(gssContinue) {
+ const void *pkgData;
+ packet["authToken"].getBinaryData(&pkgData, &recvBuffer.length);
+
+ recvBuffer.value = std::malloc(recvBuffer.length);
+ std::memcpy(recvBuffer.value, pkgData, recvBuffer.length);
+
+ majStat = gss_accept_sec_context(&minStat, &gssContext, GSS_C_NO_CREDENTIAL, &recvBuffer, GSS_C_NO_CHANNEL_BINDINGS, 0, 0, &sendBuffer, 0, 0, 0);
+
+ std::free(recvBuffer.value);
+
+ if(majStat == GSS_S_COMPLETE) {
+ Common::Logger::log(Common::Logger::VERBOSE, "GSS context established.");
+ gssContinue = false;
+ }
+ else if(majStat != GSS_S_CONTINUE_NEEDED) {
+ gss_release_buffer(&minStat, &sendBuffer);
+ return;
+ }
+
+ Common::XmlPacket ret;
+ ret.setType("AuthGSSAPI");
+ ret.addBinary("authToken", sendBuffer.value, sendBuffer.length);
+
+ if(!sendPacket(ret)) {
+ gss_release_buffer(&minStat, &sendBuffer);
+ return;
+ }
+
+ gss_release_buffer(&minStat, &sendBuffer);
+ }
+ else if(!sentSignature) {
+ if(!packet["binary"].isEmpty())
+ return;
+
+ /*const gnutls_datum_t *cert = getConnection()->getCertificate();
+
+ recvBuffer.length = cert->size;
+ recvBuffer.value = cert->data;*/
+
+ recvBuffer.value = getConnection()->getCertificate(&recvBuffer.length);
+
+ majStat = gss_get_mic(&minStat, gssContext, GSS_C_QOP_DEFAULT, &recvBuffer, &sendBuffer);
+
+ if(majStat != GSS_S_COMPLETE) {
+ gss_release_buffer(&minStat, &sendBuffer);
+ return;
+ }
+
+ Common::XmlPacket ret;
+ ret.setType("AuthGSSAPI");
+ ret.addBinary("certMic", sendBuffer.value, sendBuffer.length);
+
+ if(!sendPacket(ret)) {
+ gss_release_buffer(&minStat, &sendBuffer);
+ return;
+ }
+
+ gss_release_buffer(&minStat, &sendBuffer);
+
+ sentSignature = true;
+ }
+ else {
+ const void *pkgData;
+ packet["authToken"].getBinaryData(&pkgData, &recvBuffer.length);
+
+ recvBuffer.value = std::malloc(recvBuffer.length);
+ std::memcpy(recvBuffer.value, pkgData, recvBuffer.length);
+
+ majStat = gss_process_context_token(&minStat, gssContext, &recvBuffer);
+
+ std::free(recvBuffer.value);
+
+ if(majStat != GSS_S_COMPLETE)
+ return;
+
+ signalFinished().emit();
+ }
+}
+
+}
+}
+}
diff --git a/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.h b/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.h
new file mode 100644
index 0000000..2c5191c
--- /dev/null
+++ b/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.h
@@ -0,0 +1,48 @@
+/*
+ * GSSAPIAuthRequestHandler.h
+ *
+ * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MAD_SERVER_REQUESTHANDLERS_GSSAPIAUTHREQUESTHANDLER_H_
+#define MAD_SERVER_REQUESTHANDLERS_GSSAPIAUTHREQUESTHANDLER_H_
+
+#include <Common/RequestHandler.h>
+#include <gssapi/gssapi.h>
+
+namespace Mad {
+namespace Server {
+namespace RequestHandlers {
+
+class GSSAPIAuthRequestHandler : public Common::RequestHandler {
+ private:
+ gss_ctx_id_t gssContext;
+
+ bool gssContinue, sentSignature;
+
+ protected:
+ virtual void handlePacket(const Common::XmlPacket &packet);
+
+ public:
+ GSSAPIAuthRequestHandler(Common::Connection *connection, uint16_t requestId)
+ : RequestHandler(connection, requestId), gssContext(GSS_C_NO_CONTEXT), gssContinue(true), sentSignature(false) {}
+};
+
+}
+}
+}
+
+#endif /* MAD_SERVER_REQUESTHANDLERS_GSSAPIAUTHREQUESTHANDLER_H_ */
diff --git a/src/Server/RequestHandlers/IdentifyRequestHandler.cpp b/src/Server/RequestHandlers/IdentifyRequestHandler.cpp
new file mode 100644
index 0000000..9db9411
--- /dev/null
+++ b/src/Server/RequestHandlers/IdentifyRequestHandler.cpp
@@ -0,0 +1,67 @@
+/*
+ * IdentifyRequestHandler.cpp
+ *
+ * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "IdentifyRequestHandler.h"
+#include "../ConnectionManager.h"
+#include <Common/Logger.h>
+
+
+namespace Mad {
+namespace Server {
+namespace RequestHandlers {
+
+void IdentifyRequestHandler::handlePacket(const Common::XmlPacket &packet) {
+ if(packet.getType() != "Identify") {
+ Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
+
+ Common::XmlPacket ret;
+ ret.setType("Error");
+ ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET);
+
+ sendPacket(ret);
+
+ signalFinished().emit();
+ return;
+ }
+
+ // TODO Require authentication
+ try {
+ ConnectionManager::get()->identifyDaemonConnection(getConnection(), packet["hostname"]);
+
+ Common::XmlPacket ret;
+ ret.setType("OK");
+ sendPacket(ret);
+ }
+ catch(Common::Exception &e) {
+ Common::XmlPacket ret;
+ ret.setType("Error");
+ ret.add("ErrorCode", e.getErrorCode());
+ ret.add("SubCode", e.getSubCode());
+ ret.add("SubSubCode", e.getSubSubCode());
+ ret.add("Where", e.getWhere());
+
+ sendPacket(ret);
+ }
+
+ signalFinished().emit();
+}
+
+}
+}
+}
diff --git a/src/Server/RequestHandlers/IdentifyRequestHandler.h b/src/Server/RequestHandlers/IdentifyRequestHandler.h
new file mode 100644
index 0000000..322bbab
--- /dev/null
+++ b/src/Server/RequestHandlers/IdentifyRequestHandler.h
@@ -0,0 +1,42 @@
+/*
+ * IdentifyRequestHandler.h
+ *
+ * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MAD_SERVER_REQUESTHANDLERS_IDENTIFYREQUESTHANDLER_H_
+#define MAD_SERVER_REQUESTHANDLERS_IDENTIFYREQUESTHANDLER_H_
+
+#include <Common/RequestHandler.h>
+
+namespace Mad {
+namespace Server {
+namespace RequestHandlers {
+
+class IdentifyRequestHandler : public Common::RequestHandler {
+ protected:
+ virtual void handlePacket(const Common::XmlPacket &packet);
+
+ public:
+ IdentifyRequestHandler(Common::Connection *connection, uint16_t requestId)
+ : RequestHandler(connection, requestId) {}
+};
+
+}
+}
+}
+
+#endif /* MAD_SERVER_REQUESTHANDLERS_IDENTIFYREQUESTHANDLER_H_ */
diff --git a/src/Server/RequestHandlers/LogRequestHandler.cpp b/src/Server/RequestHandlers/LogRequestHandler.cpp
new file mode 100644
index 0000000..ae64921
--- /dev/null
+++ b/src/Server/RequestHandlers/LogRequestHandler.cpp
@@ -0,0 +1,63 @@
+/*
+ * LogRequestHandler.cpp
+ *
+ * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "LogRequestHandler.h"
+#include <Common/Logger.h>
+#include <Common/LogManager.h>
+#include "../ConnectionManager.h"
+
+namespace Mad {
+namespace Server {
+namespace RequestHandlers {
+
+void LogRequestHandler::handlePacket(const Common::XmlPacket &packet) {
+ if(packet.getType() != "Log") {
+ Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
+
+ Common::XmlPacket ret;
+ ret.setType("Error");
+ ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET);
+
+ sendPacket(ret);
+
+ signalFinished().emit();
+ return;
+ }
+
+ // TODO Require authentication
+
+ try {
+ Common::LogManager::get()->log(packet["category"], packet["level"], packet["timestamp"], packet["message"],
+ ConnectionManager::get()->getDaemonName(getConnection()));
+ }
+ catch(Common::Exception &e) {
+ Common::Logger::logf(Common::Logger::ERROR, "Can't determine daemon name: %s", e.strerror().c_str());
+ }
+
+ Common::XmlPacket ret;
+ ret.setType("OK");
+
+ sendPacket(ret);
+
+ signalFinished().emit();
+}
+
+}
+}
+}
diff --git a/src/Server/RequestHandlers/LogRequestHandler.h b/src/Server/RequestHandlers/LogRequestHandler.h
new file mode 100644
index 0000000..d18a6d3
--- /dev/null
+++ b/src/Server/RequestHandlers/LogRequestHandler.h
@@ -0,0 +1,42 @@
+/*
+ * LogRequestHandler.h
+ *
+ * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MAD_SERVER_REQUESTHANDLERS_LOGREQUESTHANDLER_H_
+#define MAD_SERVER_REQUESTHANDLERS_LOGREQUESTHANDLER_H_
+
+#include <Common/RequestHandler.h>
+
+namespace Mad {
+namespace Server {
+namespace RequestHandlers {
+
+class LogRequestHandler : public Common::RequestHandler {
+ protected:
+ virtual void handlePacket(const Common::XmlPacket &packet);
+
+ public:
+ LogRequestHandler(Common::Connection *connection, uint16_t requestId)
+ : RequestHandler(connection, requestId) {}
+};
+
+}
+}
+}
+
+#endif /* MAD_SERVER_REQUESTHANDLERS_LOGREQUESTHANDLER_H_ */
diff --git a/src/Server/RequestHandlers/Makefile.am b/src/Server/RequestHandlers/Makefile.am
new file mode 100644
index 0000000..036f936
--- /dev/null
+++ b/src/Server/RequestHandlers/Makefile.am
@@ -0,0 +1,6 @@
+noinst_LTLIBRARIES = librequesthandlers.la
+librequesthandlers_la_SOURCES = DaemonCommandRequestHandler.cpp DaemonFSInfoRequestHandler.cpp DaemonListRequestHandler.cpp DaemonStatusRequestHandler.cpp \
+ GSSAPIAuthRequestHandler.cpp IdentifyRequestHandler.cpp LogRequestHandler.cpp UserInfoRequestHandler.cpp UserListRequestHandler.cpp
+
+noinst_HEADERS = DaemonCommandRequestHandler.h DaemonFSInfoRequestHandler.h DaemonListRequestHandler.h DaemonStatusRequestHandler.h \
+ GSSAPIAuthRequestHandler.h IdentifyRequestHandler.h LogRequestHandler.h UserInfoRequestHandler.h UserListRequestHandler.h
diff --git a/src/Server/RequestHandlers/Makefile.in b/src/Server/RequestHandlers/Makefile.in
new file mode 100644
index 0000000..7f1bfa3
--- /dev/null
+++ b/src/Server/RequestHandlers/Makefile.in
@@ -0,0 +1,542 @@
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src/Server/RequestHandlers
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
+ $(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/ax_lib_mysql.m4 \
+ $(top_srcdir)/m4/base64.m4 $(top_srcdir)/m4/cond.m4 \
+ $(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/extensions.m4 \
+ $(top_srcdir)/m4/gettimeofday.m4 \
+ $(top_srcdir)/m4/gnulib-common.m4 \
+ $(top_srcdir)/m4/gnulib-comp.m4 \
+ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/lib-ld.m4 \
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/lock.m4 \
+ $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/sys_time_h.m4 \
+ $(top_srcdir)/m4/thread.m4 $(top_srcdir)/m4/threadlib.m4 \
+ $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+librequesthandlers_la_LIBADD =
+am_librequesthandlers_la_OBJECTS = DaemonCommandRequestHandler.lo \
+ DaemonFSInfoRequestHandler.lo DaemonListRequestHandler.lo \
+ DaemonStatusRequestHandler.lo GSSAPIAuthRequestHandler.lo \
+ IdentifyRequestHandler.lo LogRequestHandler.lo \
+ UserInfoRequestHandler.lo UserListRequestHandler.lo
+librequesthandlers_la_OBJECTS = $(am_librequesthandlers_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(librequesthandlers_la_SOURCES)
+DIST_SOURCES = $(librequesthandlers_la_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+ARGZ_H = @ARGZ_H@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@
+EMULTIHOP_VALUE = @EMULTIHOP_VALUE@
+ENOLINK_HIDDEN = @ENOLINK_HIDDEN@
+ENOLINK_VALUE = @ENOLINK_VALUE@
+EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@
+EOVERFLOW_VALUE = @EOVERFLOW_VALUE@
+ERRNO_H = @ERRNO_H@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+GSSAPI_LIBS = @GSSAPI_LIBS@
+GnuTLS_CFLAGS = @GnuTLS_CFLAGS@
+GnuTLS_LIBS = @GnuTLS_LIBS@
+HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
+HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
+HAVE__BOOL = @HAVE__BOOL@
+INCLTDL = @INCLTDL@
+INCLUDE_NEXT = @INCLUDE_NEXT@
+INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBADD_DL = @LIBADD_DL@
+LIBADD_DLD_LINK = @LIBADD_DLD_LINK@
+LIBADD_DLOPEN = @LIBADD_DLOPEN@
+LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@
+LIBLTDL = @LIBLTDL@
+LIBMULTITHREAD = @LIBMULTITHREAD@
+LIBOBJS = @LIBOBJS@
+LIBPTH = @LIBPTH@
+LIBPTH_PREFIX = @LIBPTH_PREFIX@
+LIBS = @LIBS@
+LIBTHREAD = @LIBTHREAD@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTDLDEPS = @LTDLDEPS@
+LTDLINCL = @LTDLINCL@
+LTDLOPEN = @LTDLOPEN@
+LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
+LTLIBOBJS = @LTLIBOBJS@
+LTLIBPTH = @LTLIBPTH@
+LTLIBTHREAD = @LTLIBTHREAD@
+LT_CONFIG_H = @LT_CONFIG_H@
+LT_DLLOADERS = @LT_DLLOADERS@
+LT_DLPREOPEN = @LT_DLPREOPEN@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_CONFIG = @MYSQL_CONFIG@
+MYSQL_LDFLAGS = @MYSQL_LDFLAGS@
+MYSQL_VERSION = @MYSQL_VERSION@
+NEXT_ERRNO_H = @NEXT_ERRNO_H@
+NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@
+NEXT_TIME_H = @NEXT_TIME_H@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@
+RANLIB = @RANLIB@
+READLINE_LIBS = @READLINE_LIBS@
+REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
+REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@
+REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@
+REPLACE_STRPTIME = @REPLACE_STRPTIME@
+REPLACE_TIMEGM = @REPLACE_TIMEGM@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STDBOOL_H = @STDBOOL_H@
+STRIP = @STRIP@
+SYS_TIME_H = @SYS_TIME_H@
+SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
+TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gl_LIBOBJS = @gl_LIBOBJS@
+gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
+have_df = @have_df@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libxml2_CFLAGS = @libxml2_CFLAGS@
+libxml2_LIBS = @libxml2_LIBS@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+ltdl_LIBOBJS = @ltdl_LIBOBJS@
+ltdl_LTLIBOBJS = @ltdl_LTLIBOBJS@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pcrecpp_CFLAGS = @pcrecpp_CFLAGS@
+pcrecpp_LIBS = @pcrecpp_LIBS@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sigc_CFLAGS = @sigc_CFLAGS@
+sigc_LIBS = @sigc_LIBS@
+srcdir = @srcdir@
+sys_symbol_underscore = @sys_symbol_underscore@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+noinst_LTLIBRARIES = librequesthandlers.la
+librequesthandlers_la_SOURCES = DaemonCommandRequestHandler.cpp DaemonFSInfoRequestHandler.cpp DaemonListRequestHandler.cpp DaemonStatusRequestHandler.cpp \
+ GSSAPIAuthRequestHandler.cpp IdentifyRequestHandler.cpp LogRequestHandler.cpp UserInfoRequestHandler.cpp UserListRequestHandler.cpp
+
+noinst_HEADERS = DaemonCommandRequestHandler.h DaemonFSInfoRequestHandler.h DaemonListRequestHandler.h DaemonStatusRequestHandler.h \
+ GSSAPIAuthRequestHandler.h IdentifyRequestHandler.h LogRequestHandler.h UserInfoRequestHandler.h UserListRequestHandler.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Server/RequestHandlers/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/Server/RequestHandlers/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+librequesthandlers.la: $(librequesthandlers_la_OBJECTS) $(librequesthandlers_la_DEPENDENCIES)
+ $(CXXLINK) $(librequesthandlers_la_OBJECTS) $(librequesthandlers_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonCommandRequestHandler.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonFSInfoRequestHandler.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonListRequestHandler.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DaemonStatusRequestHandler.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GSSAPIAuthRequestHandler.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IdentifyRequestHandler.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LogRequestHandler.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UserInfoRequestHandler.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UserListRequestHandler.Plo@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/Server/RequestHandlers/UserInfoRequestHandler.cpp b/src/Server/RequestHandlers/UserInfoRequestHandler.cpp
new file mode 100644
index 0000000..16003a2
--- /dev/null
+++ b/src/Server/RequestHandlers/UserInfoRequestHandler.cpp
@@ -0,0 +1,70 @@
+/*
+ * UserInfoRequestHandler.cpp
+ *
+ * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "UserInfoRequestHandler.h"
+#include "../UserManager.h"
+#include <Common/Exception.h>
+#include <Common/Logger.h>
+
+namespace Mad {
+namespace Server {
+namespace RequestHandlers {
+
+void UserInfoRequestHandler::handlePacket(const Common::XmlPacket &packet) {
+ if(packet.getType() != "GetUserInfo") {
+ Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
+
+ Common::XmlPacket ret;
+ ret.setType("Error");
+ ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET);
+
+ sendPacket(ret);
+
+ signalFinished().emit();
+ return;
+ }
+
+ // TODO Require authentication
+
+ if(!UserManager::get()->getUserInfo(packet["uid"], sigc::mem_fun(this, &UserInfoRequestHandler::userInfoHandler))) {
+ Common::XmlPacket ret;
+ ret.setType("Error");
+ ret.add("ErrorCode", Common::Exception::NOT_IMPLEMENTED);
+
+ sendPacket(ret);
+ signalFinished().emit();
+ }
+}
+
+void UserInfoRequestHandler::userInfoHandler(const Common::UserInfo &info) {
+ Common::XmlPacket ret;
+ ret.setType("OK");
+
+ ret.add("uid", info.getUid());
+ ret.add("gid", info.getGid());
+ ret.add("username", info.getUsername());
+ ret.add("fullName", info.getFullName());
+
+ sendPacket(ret);
+ signalFinished().emit();
+}
+
+}
+}
+}
diff --git a/src/Server/RequestHandlers/UserInfoRequestHandler.h b/src/Server/RequestHandlers/UserInfoRequestHandler.h
new file mode 100644
index 0000000..5b1d466
--- /dev/null
+++ b/src/Server/RequestHandlers/UserInfoRequestHandler.h
@@ -0,0 +1,48 @@
+/*
+ * UserInfoRequestHandler.h
+ *
+ * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MAD_SERVER_REQUESTHANDLERS_USERINFOREQUESTHANDLER_H_
+#define MAD_SERVER_REQUESTHANDLERS_USERINFOREQUESTHANDLER_H_
+
+#include <Common/RequestHandler.h>
+#include <Common/UserInfo.h>
+
+#include <map>
+
+namespace Mad {
+namespace Server {
+namespace RequestHandlers {
+
+class UserInfoRequestHandler : public Common::RequestHandler {
+ private:
+ void userInfoHandler(const Common::UserInfo &info);
+
+ protected:
+ virtual void handlePacket(const Common::XmlPacket &packet);
+
+ public:
+ UserInfoRequestHandler(Common::Connection *connection, uint16_t requestId)
+ : RequestHandler(connection, requestId) {}
+};
+
+}
+}
+}
+
+#endif /* MAD_SERVER_REQUESTHANDLERS_USERINFOREQUESTHANDLER_H_ */
diff --git a/src/Server/RequestHandlers/UserListRequestHandler.cpp b/src/Server/RequestHandlers/UserListRequestHandler.cpp
new file mode 100644
index 0000000..696b1d4
--- /dev/null
+++ b/src/Server/RequestHandlers/UserListRequestHandler.cpp
@@ -0,0 +1,76 @@
+/*
+ * UserListRequestHandler.cpp
+ *
+ * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "UserListRequestHandler.h"
+#include "../UserManager.h"
+#include <Common/Exception.h>
+#include <Common/Logger.h>
+
+namespace Mad {
+namespace Server {
+namespace RequestHandlers {
+
+void UserListRequestHandler::handlePacket(const Common::XmlPacket &packet) {
+ if(packet.getType() != "ListUsers") {
+ Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet.");
+
+ Common::XmlPacket ret;
+ ret.setType("Error");
+ ret.add("ErrorCode", Common::Exception::UNEXPECTED_PACKET);
+
+ sendPacket(ret);
+
+ signalFinished().emit();
+ return;
+ }
+
+ // TODO Require authentication
+
+ if(!UserManager::get()->getUserList(sigc::mem_fun(this, &UserListRequestHandler::userListHandler))) {
+ Common::XmlPacket ret;
+ ret.setType("Error");
+ ret.add("ErrorCode", Common::Exception::NOT_IMPLEMENTED);
+
+ sendPacket(ret);
+ signalFinished().emit();
+ }
+}
+
+void UserListRequestHandler::userListHandler(const std::map<unsigned long, Common::UserInfo> &info) {
+ Common::XmlPacket ret;
+ ret.setType("OK");
+ ret.addList("users");
+
+ for(std::map<unsigned long, Common::UserInfo>::const_iterator user = info.begin(); user != info.end(); ++user) {
+ ret["users"].addEntry();
+ Common::XmlPacket::Entry &entry = ret["users"].back();
+
+ entry.add("uid", user->second.getUid());
+ entry.add("gid", user->second.getGid());
+ entry.add("username", user->second.getUsername());
+ entry.add("fullName", user->second.getFullName());
+ }
+
+ sendPacket(ret);
+ signalFinished().emit();
+}
+
+}
+}
+}
diff --git a/src/Server/RequestHandlers/UserListRequestHandler.h b/src/Server/RequestHandlers/UserListRequestHandler.h
new file mode 100644
index 0000000..7c85aa0
--- /dev/null
+++ b/src/Server/RequestHandlers/UserListRequestHandler.h
@@ -0,0 +1,48 @@
+/*
+ * UserListRequestHandler.h
+ *
+ * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MAD_SERVER_REQUESTHANDLERS_USERLISTREQUESTHANDLER_H_
+#define MAD_SERVER_REQUESTHANDLERS_USERLISTREQUESTHANDLER_H_
+
+#include <Common/RequestHandler.h>
+#include <Common/UserInfo.h>
+
+#include <map>
+
+namespace Mad {
+namespace Server {
+namespace RequestHandlers {
+
+class UserListRequestHandler : public Common::RequestHandler {
+ private:
+ void userListHandler(const std::map<unsigned long, Common::UserInfo> &info);
+
+ protected:
+ virtual void handlePacket(const Common::XmlPacket &packet);
+
+ public:
+ UserListRequestHandler(Common::Connection *connection, uint16_t requestId)
+ : RequestHandler(connection, requestId) {}
+};
+
+}
+}
+}
+
+#endif /* MAD_SERVER_REQUESTHANDLERS_USERLISTREQUESTHANDLER_H_ */