summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Client/CommandManager.cpp14
-rw-r--r--src/Client/CommandManager.h1
-rw-r--r--src/Client/CommandParser.cpp28
-rw-r--r--src/Client/CommandParser.h1
-rw-r--r--src/Client/Makefile.in11
-rw-r--r--src/Client/Requests/Makefile.in11
-rw-r--r--src/Common/Makefile.in11
-rw-r--r--src/Common/RequestHandlers/Makefile.in11
-rw-r--r--src/Common/Requests/Makefile.am4
-rw-r--r--src/Common/Requests/Makefile.in18
-rw-r--r--src/Common/Requests/UserInfoRequest.cpp36
-rw-r--r--src/Common/Requests/UserInfoRequest.h45
-rw-r--r--src/Core/ConnectionManager.cpp3
-rw-r--r--src/Core/Makefile.in11
-rw-r--r--src/Core/RequestHandlers/Makefile.am8
-rw-r--r--src/Core/RequestHandlers/Makefile.in22
-rw-r--r--src/Core/RequestHandlers/UserInfoRequestHandler.cpp70
-rw-r--r--src/Core/RequestHandlers/UserInfoRequestHandler.h48
-rw-r--r--src/Core/RequestHandlers/UserListRequestHandler.h1
-rw-r--r--src/Core/Requests/Makefile.in11
-rw-r--r--src/Daemon/Backends/Makefile.in11
-rw-r--r--src/Daemon/Makefile.in11
-rw-r--r--src/Daemon/RequestHandlers/Makefile.in11
-rw-r--r--src/Daemon/Requests/Makefile.in11
-rw-r--r--src/Makefile.in11
-rw-r--r--src/Net/Makefile.in11
-rw-r--r--src/mad-core.conf4
-rw-r--r--src/modules/Makefile.am2
-rw-r--r--src/modules/Makefile.in16
-rw-r--r--src/modules/UserBackendMysql.cpp50
30 files changed, 416 insertions, 87 deletions
diff --git a/src/Client/CommandManager.cpp b/src/Client/CommandManager.cpp
index 3bfc3a6..ad88152 100644
--- a/src/Client/CommandManager.cpp
+++ b/src/Client/CommandManager.cpp
@@ -211,6 +211,20 @@ void CommandManager::statusRequestFinished(const Common::Request &request) {
requestFinished();
}
+void CommandManager::userInfoRequestFinished(const Common::Request &request) {
+ try {
+ const Common::XmlPacket &packet = request.getResult();
+
+ std::cout << " " << (unsigned long)packet["uid"] << ", " << (unsigned long)packet["gid"] << ", " << (const std::string&)packet["username"] << ", "
+ << (const std::string&)packet["fullName"] << std::endl << std::endl;
+ }
+ catch(Common::Exception &exception) {
+ Common::Logger::logf(Common::Logger::ERROR, "An error occurred during your request: %s.", exception.strerror().c_str());
+ }
+
+ requestFinished();
+}
+
void CommandManager::userListRequestFinished(const Common::Request &request) {
try {
const Common::XmlPacket &packet = request.getResult();
diff --git a/src/Client/CommandManager.h b/src/Client/CommandManager.h
index 1c6e5fc..f1689b1 100644
--- a/src/Client/CommandManager.h
+++ b/src/Client/CommandManager.h
@@ -58,6 +58,7 @@ class CommandManager {
void disconnectRequestFinished(const Common::Request &request);
void fsInfoRequestFinished(const Common::Request &request);
void statusRequestFinished(const Common::Request &request);
+ void userInfoRequestFinished(const Common::Request &request);
void userListRequestFinished(const Common::Request &request);
CommandManager() : activeRequests(0), disconnect(false) {}
diff --git a/src/Client/CommandParser.cpp b/src/Client/CommandParser.cpp
index 7e3a90e..8e55c01 100644
--- a/src/Client/CommandParser.cpp
+++ b/src/Client/CommandParser.cpp
@@ -28,6 +28,7 @@
#include <Common/Requests/FSInfoRequest.h>
#include <Common/Requests/DisconnectRequest.h>
#include <Common/Requests/StatusRequest.h>
+#include <Common/Requests/UserInfoRequest.h>
#include <Common/Requests/UserListRequest.h>
#include <Common/Tokenizer.h>
@@ -45,6 +46,7 @@ const CommandParser::Command CommandParser::commands[] = {
{{"reboot", 0}, "reboot *|host...", "Reboot host", "Reboot hosts. * will reboot all hosts.", &CommandParser::rebootCommand},
{{"shutdown", "halt", 0}, "shutdown *|host...", "Shut hosts down", "Shut hosts down. * will shut down all hosts.", &CommandParser::shutdownCommand},
{{"status", "st", 0}, "status [host]", "Display status information", "Display host status information. If no host is given, display server status information.", &CommandParser::statusCommand},
+ {{"user_info", "user", 0}, "user_info uid", "Search for a user id", "Search for a user id.", &CommandParser::userInfoCommand},
{{"list_users", "users", 0}, "list_users", "Show the user account database", "Show the user account database.", &CommandParser::listUsersCommand},
{{"exit", "quit", 0}, "exit", "Close the connection and quit the client", "Closes the connection and quits the client.", &CommandParser::exitCommand},
{{0}, 0, 0, 0, 0}
@@ -255,6 +257,32 @@ void CommandParser::statusCommand(const std::vector<std::string> &args) {
++CommandManager::get()->activeRequests;
}
+void CommandParser::userInfoCommand(const std::vector<std::string> &args) {
+ if(args.size() == 1) {
+ Common::Logger::logf(Common::Logger::ERROR, "%s: No user id given.", args[0].c_str());
+ printUsage("user_info");
+ return;
+ }
+ if(args.size() > 2) {
+ Common::Logger::logf(Common::Logger::ERROR, "%s: Too many arguments.", args[0].c_str());
+ printUsage("user_info");
+ return;
+ }
+
+ char *endptr;
+ unsigned long uid = std::strtoul(args[1].c_str(), &endptr, 10);
+ if(args[1].empty() || *endptr != '\0') {
+ Common::Logger::logf(Common::Logger::ERROR, "%s: Unable to parse user id.", args[0].c_str());
+ printUsage("user_info");
+ return;
+ }
+
+ ++CommandManager::get()->activeRequests;
+
+ Common::RequestManager::get()->sendRequest<Common::Requests::UserInfoRequest>(connection,
+ sigc::mem_fun(CommandManager::get(), &CommandManager::userInfoRequestFinished), uid);
+}
+
void CommandParser::listUsersCommand(const std::vector<std::string>&) {
++CommandManager::get()->activeRequests;
diff --git a/src/Client/CommandParser.h b/src/Client/CommandParser.h
index 23330ca..4b44656 100644
--- a/src/Client/CommandParser.h
+++ b/src/Client/CommandParser.h
@@ -63,6 +63,7 @@ class CommandParser {
void rebootCommand(const std::vector<std::string> &args);
void shutdownCommand(const std::vector<std::string> &args);
void statusCommand(const std::vector<std::string> &args);
+ void userInfoCommand(const std::vector<std::string> &args);
void listUsersCommand(const std::vector<std::string> &args);
void exitCommand(const std::vector<std::string>&);
diff --git a/src/Client/Makefile.in b/src/Client/Makefile.in
index 7398cc2..076a181 100644
--- a/src/Client/Makefile.in
+++ b/src/Client/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -219,6 +219,8 @@ 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@
@@ -231,6 +233,7 @@ 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@
SUBDIRS = Requests
@@ -246,8 +249,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -395,7 +398,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/src/Client/Requests/Makefile.in b/src/Client/Requests/Makefile.in
index 0e70532..ca43c66 100644
--- a/src/Client/Requests/Makefile.in
+++ b/src/Client/Requests/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -209,6 +209,8 @@ 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@
@@ -221,6 +223,7 @@ 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 = librequests.la
@@ -234,8 +237,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -313,7 +316,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/src/Common/Makefile.in b/src/Common/Makefile.in
index 45fc07f..8b6b7ef 100644
--- a/src/Common/Makefile.in
+++ b/src/Common/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -223,6 +223,8 @@ 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@
@@ -235,6 +237,7 @@ 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@
SUBDIRS = Requests RequestHandlers
@@ -258,8 +261,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -419,7 +422,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/src/Common/RequestHandlers/Makefile.in b/src/Common/RequestHandlers/Makefile.in
index 5a5e778..b7c01a3 100644
--- a/src/Common/RequestHandlers/Makefile.in
+++ b/src/Common/RequestHandlers/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -209,6 +209,8 @@ 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@
@@ -221,6 +223,7 @@ 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
@@ -234,8 +237,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -313,7 +316,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/src/Common/Requests/Makefile.am b/src/Common/Requests/Makefile.am
index b5c3bec..00a4bd7 100644
--- a/src/Common/Requests/Makefile.am
+++ b/src/Common/Requests/Makefile.am
@@ -1,4 +1,4 @@
noinst_LTLIBRARIES = librequests.la
-librequests_la_SOURCES = DisconnectRequest.cpp GSSAPIAuthRequest.cpp SimpleRequest.cpp
+librequests_la_SOURCES = DisconnectRequest.cpp GSSAPIAuthRequest.cpp SimpleRequest.cpp UserInfoRequest.cpp
-noinst_HEADERS = DisconnectRequest.h FSInfoRequest.h GSSAPIAuthRequest.h SimpleRequest.h StatusRequest.h UserListRequest.h
+noinst_HEADERS = DisconnectRequest.h FSInfoRequest.h GSSAPIAuthRequest.h SimpleRequest.h StatusRequest.h UserInfoRequest.h UserListRequest.h
diff --git a/src/Common/Requests/Makefile.in b/src/Common/Requests/Makefile.in
index 8533102..0472724 100644
--- a/src/Common/Requests/Makefile.in
+++ b/src/Common/Requests/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -53,7 +53,7 @@ CONFIG_CLEAN_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
librequests_la_LIBADD =
am_librequests_la_OBJECTS = DisconnectRequest.lo GSSAPIAuthRequest.lo \
- SimpleRequest.lo
+ SimpleRequest.lo UserInfoRequest.lo
librequests_la_OBJECTS = $(am_librequests_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
@@ -209,6 +209,8 @@ 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@
@@ -221,11 +223,12 @@ 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 = librequests.la
-librequests_la_SOURCES = DisconnectRequest.cpp GSSAPIAuthRequest.cpp SimpleRequest.cpp
-noinst_HEADERS = DisconnectRequest.h FSInfoRequest.h GSSAPIAuthRequest.h SimpleRequest.h StatusRequest.h UserListRequest.h
+librequests_la_SOURCES = DisconnectRequest.cpp GSSAPIAuthRequest.cpp SimpleRequest.cpp UserInfoRequest.cpp
+noinst_HEADERS = DisconnectRequest.h FSInfoRequest.h GSSAPIAuthRequest.h SimpleRequest.h StatusRequest.h UserInfoRequest.h UserListRequest.h
all: all-am
.SUFFIXES:
@@ -234,8 +237,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -280,6 +283,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DisconnectRequest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GSSAPIAuthRequest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SimpleRequest.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UserInfoRequest.Plo@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -313,7 +317,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/src/Common/Requests/UserInfoRequest.cpp b/src/Common/Requests/UserInfoRequest.cpp
new file mode 100644
index 0000000..455eed6
--- /dev/null
+++ b/src/Common/Requests/UserInfoRequest.cpp
@@ -0,0 +1,36 @@
+/*
+ * UserInfoRequest.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 "UserInfoRequest.h"
+
+namespace Mad {
+namespace Common {
+namespace Requests {
+
+void UserInfoRequest::sendRequest() {
+ Common::XmlPacket packet;
+ packet.setType("GetUserInfo");
+ packet.add("uid", uid);
+
+ sendPacket(packet);
+}
+
+}
+}
+}
diff --git a/src/Common/Requests/UserInfoRequest.h b/src/Common/Requests/UserInfoRequest.h
new file mode 100644
index 0000000..27cf1af
--- /dev/null
+++ b/src/Common/Requests/UserInfoRequest.h
@@ -0,0 +1,45 @@
+/*
+ * UserInfoRequest.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_COMMON_REQUESTS_USERINFOREQUEST_H_
+#define MAD_COMMON_REQUESTS_USERINFOREQUEST_H_
+
+#include "../Request.h"
+
+namespace Mad {
+namespace Common {
+namespace Requests {
+
+class UserInfoRequest : public Request {
+ private:
+ unsigned long uid;
+
+ protected:
+ virtual void sendRequest();
+
+ public:
+ UserInfoRequest(Connection *connection, uint16_t requestId, slot_type slot, unsigned long uid0)
+ : Request(connection, requestId, slot), uid(uid0) {}
+};
+
+}
+}
+}
+
+#endif /* MAD_COMMON_REQUESTS_USERINFOREQUEST_H_ */
diff --git a/src/Core/ConnectionManager.cpp b/src/Core/ConnectionManager.cpp
index 3d252c2..4f8f90d 100644
--- a/src/Core/ConnectionManager.cpp
+++ b/src/Core/ConnectionManager.cpp
@@ -31,6 +31,7 @@
#include "RequestHandlers/GSSAPIAuthRequestHandler.h"
#include "RequestHandlers/IdentifyRequestHandler.h"
#include "RequestHandlers/LogRequestHandler.h"
+#include "RequestHandlers/UserInfoRequestHandler.h"
#include "RequestHandlers/UserListRequestHandler.h"
#include <Net/FdManager.h>
#include <Net/ServerConnection.h>
@@ -177,6 +178,7 @@ void ConnectionManager::doInit() {
Common::RequestManager::get()->registerPacketType<RequestHandlers::DaemonStatusRequestHandler>("GetDaemonStatus");
Common::RequestManager::get()->registerPacketType<RequestHandlers::IdentifyRequestHandler>("Identify");
Common::RequestManager::get()->registerPacketType<RequestHandlers::DaemonListRequestHandler>("ListHosts");
+ Common::RequestManager::get()->registerPacketType<RequestHandlers::UserInfoRequestHandler>("GetUserInfo");
Common::RequestManager::get()->registerPacketType<RequestHandlers::UserListRequestHandler>("ListUsers");
Common::RequestManager::get()->registerPacketType<RequestHandlers::LogRequestHandler>("Log");
}
@@ -194,6 +196,7 @@ void ConnectionManager::doDeinit() {
Common::RequestManager::get()->unregisterPacketType("GetDaemonStatus");
Common::RequestManager::get()->unregisterPacketType("Identify");
Common::RequestManager::get()->unregisterPacketType("ListHosts");
+ Common::RequestManager::get()->unregisterPacketType("GetUserInfo");
Common::RequestManager::get()->unregisterPacketType("ListUsers");
Common::RequestManager::get()->unregisterPacketType("Log");
diff --git a/src/Core/Makefile.in b/src/Core/Makefile.in
index 9f8fa72..4e3ef5a 100644
--- a/src/Core/Makefile.in
+++ b/src/Core/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -219,6 +219,8 @@ 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@
@@ -231,6 +233,7 @@ 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@
SUBDIRS = Requests RequestHandlers
@@ -246,8 +249,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -394,7 +397,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/src/Core/RequestHandlers/Makefile.am b/src/Core/RequestHandlers/Makefile.am
index 5a044c8..036f936 100644
--- a/src/Core/RequestHandlers/Makefile.am
+++ b/src/Core/RequestHandlers/Makefile.am
@@ -1,6 +1,6 @@
noinst_LTLIBRARIES = librequesthandlers.la
-librequesthandlers_la_SOURCES = DaemonCommandRequestHandler.cpp DaemonFSInfoRequestHandler.cpp DaemonListRequestHandler.cpp DaemonStatusRequestHandler.cpp GSSAPIAuthRequestHandler.cpp \
- IdentifyRequestHandler.cpp LogRequestHandler.cpp UserListRequestHandler.cpp
+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 UserListRequestHandler.h
+noinst_HEADERS = DaemonCommandRequestHandler.h DaemonFSInfoRequestHandler.h DaemonListRequestHandler.h DaemonStatusRequestHandler.h \
+ GSSAPIAuthRequestHandler.h IdentifyRequestHandler.h LogRequestHandler.h UserInfoRequestHandler.h UserListRequestHandler.h
diff --git a/src/Core/RequestHandlers/Makefile.in b/src/Core/RequestHandlers/Makefile.in
index 03a0ddd..70e0df4 100644
--- a/src/Core/RequestHandlers/Makefile.in
+++ b/src/Core/RequestHandlers/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -56,7 +56,7 @@ am_librequesthandlers_la_OBJECTS = DaemonCommandRequestHandler.lo \
DaemonFSInfoRequestHandler.lo DaemonListRequestHandler.lo \
DaemonStatusRequestHandler.lo GSSAPIAuthRequestHandler.lo \
IdentifyRequestHandler.lo LogRequestHandler.lo \
- UserListRequestHandler.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
@@ -212,6 +212,8 @@ 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@
@@ -224,14 +226,15 @@ 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 UserListRequestHandler.cpp
+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 UserListRequestHandler.h
+noinst_HEADERS = DaemonCommandRequestHandler.h DaemonFSInfoRequestHandler.h DaemonListRequestHandler.h DaemonStatusRequestHandler.h \
+ GSSAPIAuthRequestHandler.h IdentifyRequestHandler.h LogRequestHandler.h UserInfoRequestHandler.h UserListRequestHandler.h
all: all-am
@@ -241,8 +244,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -291,6 +294,7 @@ distclean-compile:
@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:
@@ -325,7 +329,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/src/Core/RequestHandlers/UserInfoRequestHandler.cpp b/src/Core/RequestHandlers/UserInfoRequestHandler.cpp
new file mode 100644
index 0000000..d3a8aca
--- /dev/null
+++ b/src/Core/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 "../UserBackend.h"
+#include <Common/Exception.h>
+#include <Common/Logger.h>
+
+namespace Mad {
+namespace Core {
+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(!UserBackend::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/Core/RequestHandlers/UserInfoRequestHandler.h b/src/Core/RequestHandlers/UserInfoRequestHandler.h
new file mode 100644
index 0000000..b3103d4
--- /dev/null
+++ b/src/Core/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_CORE_REQUESTHANDLERS_USERINFOREQUESTHANDLER_H_
+#define MAD_CORE_REQUESTHANDLERS_USERINFOREQUESTHANDLER_H_
+
+#include <Common/RequestHandler.h>
+#include <Common/UserInfo.h>
+
+#include <map>
+
+namespace Mad {
+namespace Core {
+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_CORE_REQUESTHANDLERS_USERINFOREQUESTHANDLER_H_ */
diff --git a/src/Core/RequestHandlers/UserListRequestHandler.h b/src/Core/RequestHandlers/UserListRequestHandler.h
index a80c451..e31da67 100644
--- a/src/Core/RequestHandlers/UserListRequestHandler.h
+++ b/src/Core/RequestHandlers/UserListRequestHandler.h
@@ -24,7 +24,6 @@
#include <Common/UserInfo.h>
#include <map>
-#include <stdint.h>
namespace Mad {
namespace Core {
diff --git a/src/Core/Requests/Makefile.in b/src/Core/Requests/Makefile.in
index 2a0ca94..588f3c5 100644
--- a/src/Core/Requests/Makefile.in
+++ b/src/Core/Requests/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -209,6 +209,8 @@ 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@
@@ -221,6 +223,7 @@ 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 = librequests.la
@@ -234,8 +237,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -312,7 +315,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/src/Daemon/Backends/Makefile.in b/src/Daemon/Backends/Makefile.in
index 17a500c..943e014 100644
--- a/src/Daemon/Backends/Makefile.in
+++ b/src/Daemon/Backends/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -191,6 +191,8 @@ 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@
@@ -203,6 +205,7 @@ 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_HEADERS = NetworkLogger.h
@@ -213,8 +216,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -250,7 +253,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/src/Daemon/Makefile.in b/src/Daemon/Makefile.in
index 135338c..0c9efaf 100644
--- a/src/Daemon/Makefile.in
+++ b/src/Daemon/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -217,6 +217,8 @@ 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@
@@ -229,6 +231,7 @@ 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@
SUBDIRS = Backends Requests RequestHandlers
@@ -243,8 +246,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -367,7 +370,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/src/Daemon/RequestHandlers/Makefile.in b/src/Daemon/RequestHandlers/Makefile.in
index 0311a7e..6b3d1c0 100644
--- a/src/Daemon/RequestHandlers/Makefile.in
+++ b/src/Daemon/RequestHandlers/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -208,6 +208,8 @@ 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@
@@ -220,6 +222,7 @@ 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
@@ -233,8 +236,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -310,7 +313,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/src/Daemon/Requests/Makefile.in b/src/Daemon/Requests/Makefile.in
index 2b926db..2e47bda 100644
--- a/src/Daemon/Requests/Makefile.in
+++ b/src/Daemon/Requests/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -208,6 +208,8 @@ 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@
@@ -220,6 +222,7 @@ 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 = librequests.la
@@ -233,8 +236,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -311,7 +314,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/src/Makefile.in b/src/Makefile.in
index e7c7f50..ba89940 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -253,6 +253,8 @@ 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@
@@ -265,6 +267,7 @@ 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@
SUBDIRS = Common Client Core Daemon Net modules
@@ -294,8 +297,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -469,7 +472,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/src/Net/Makefile.in b/src/Net/Makefile.in
index 54ee467..a258962 100644
--- a/src/Net/Makefile.in
+++ b/src/Net/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -209,6 +209,8 @@ 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@
@@ -221,6 +223,7 @@ 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 = libnet.la
@@ -234,8 +237,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -317,7 +320,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/src/mad-core.conf b/src/mad-core.conf
index 8f84278..4176307 100644
--- a/src/mad-core.conf
+++ b/src/mad-core.conf
@@ -20,8 +20,8 @@ UserBackendMysql {
#ListGroups
#ListUserGroups
#ListGroupUsers
- #UserById
- #UserByName
+ UserById "SELECT id, gid, username, fullname FROM users WHERE id = {ID}"
+ UserByName "SELECT id, gid, username, fullname FROM users WHERE username = {USER}"
#GroupById
#GroupByName
}
diff --git a/src/modules/Makefile.am b/src/modules/Makefile.am
index ee11f5c..93b54b3 100644
--- a/src/modules/Makefile.am
+++ b/src/modules/Makefile.am
@@ -31,7 +31,7 @@ SystemBackendProc_la_SOURCES = SystemBackendProc.cpp
SystemBackendProc_la_LDFLAGS = $(static_ldflags) -export-symbols-regex '^SystemBackendProc_LTX_'
UserBackendMysql_la_SOURCES = UserBackendMysql.cpp
-UserBackendMysql_la_LIBADD = $(MYSQL_LDFLAGS)
+UserBackendMysql_la_LIBADD = $(MYSQL_LDFLAGS) $(pcrecpp_LIBS)
UserBackendMysql_la_LDFLAGS = $(default_ldflags) -export-symbols-regex '^UserBackendMysql_LTX_'
noinst_HEADERS = FileLogger.h SystemBackendPosix.h SystemBackendProc.h UserBackendMysql.h
diff --git a/src/modules/Makefile.in b/src/modules/Makefile.in
index 7ea2f4f..3913566 100644
--- a/src/modules/Makefile.in
+++ b/src/modules/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -83,7 +83,8 @@ SystemBackendProc_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(SystemBackendProc_la_LDFLAGS) $(LDFLAGS) -o $@
@SYSTEMBACKEND_PROC_TRUE@am_SystemBackendProc_la_rpath =
-UserBackendMysql_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
+UserBackendMysql_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
am_UserBackendMysql_la_OBJECTS = UserBackendMysql.lo
UserBackendMysql_la_OBJECTS = $(am_UserBackendMysql_la_OBJECTS)
UserBackendMysql_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
@@ -248,6 +249,8 @@ 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@
@@ -260,6 +263,7 @@ 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@
moddir = ${pkglibdir}/modules
@@ -276,7 +280,7 @@ SystemBackendPosix_la_LDFLAGS = $(static_ldflags) -export-symbols-regex '^System
SystemBackendProc_la_SOURCES = SystemBackendProc.cpp
SystemBackendProc_la_LDFLAGS = $(static_ldflags) -export-symbols-regex '^SystemBackendProc_LTX_'
UserBackendMysql_la_SOURCES = UserBackendMysql.cpp
-UserBackendMysql_la_LIBADD = $(MYSQL_LDFLAGS)
+UserBackendMysql_la_LIBADD = $(MYSQL_LDFLAGS) $(pcrecpp_LIBS)
UserBackendMysql_la_LDFLAGS = $(default_ldflags) -export-symbols-regex '^UserBackendMysql_LTX_'
noinst_HEADERS = FileLogger.h SystemBackendPosix.h SystemBackendProc.h UserBackendMysql.h
all: all-am
@@ -287,8 +291,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -400,7 +404,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/src/modules/UserBackendMysql.cpp b/src/modules/UserBackendMysql.cpp
index 0b028fb..db3c32b 100644
--- a/src/modules/UserBackendMysql.cpp
+++ b/src/modules/UserBackendMysql.cpp
@@ -17,14 +17,17 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <config.h>
+
#include "UserBackendMysql.h"
#include <Common/ActionManager.h>
#include <Common/ConfigEntry.h>
#include <Common/Logger.h>
-#include <sigc++/bind.h>
+#include <sstream>
-#include <cstdlib>
+#include <sigc++/bind.h>
+#include <pcrecpp.h>
#define init UserBackendMysql_LTX_init
#define deinit UserBackendMysql_LTX_deinit
@@ -61,7 +64,7 @@ bool UserBackendMysql::handleConfigEntry(const Common::ConfigEntry &entry, bool
char *endptr;
long val;
- val = std::strtol(entry[1][0].c_str(), &endptr, 10);
+ val = strtol(entry[1][0].c_str(), &endptr, 10);
if(endptr != 0 || val < 0 || val > 65535)
Common::Logger::log(Common::Logger::WARNING, "UserBackendMysql: Invalid port");
@@ -143,9 +146,9 @@ bool UserBackendMysql::userList(const sigc::slot<void, const std::map<unsigned l
std::map<unsigned long, Common::UserInfo> users;
while(MYSQL_ROW row = mysql_fetch_row(result)) {
- Common::UserInfo user(std::strtoul(row[0], 0, 10), row[2]);
+ Common::UserInfo user(strtoul(row[0], 0, 10), row[2]);
- user.setGid(std::strtoul(row[1], 0, 10));
+ user.setGid(strtoul(row[1], 0, 10));
user.setFullName(row[3]);
users.insert(std::make_pair(user.getUid(), user));
@@ -157,10 +160,43 @@ bool UserBackendMysql::userList(const sigc::slot<void, const std::map<unsigned l
}
bool UserBackendMysql::userInfo(unsigned long uid, const sigc::slot<void, const Common::UserInfo&> &callback) {
- return false;
+ mysql_ping(mysql);
+
+ std::string query = queryUserById;
+
+ std::ostringstream tmp;
+ tmp << '"';
+ tmp << uid;
+ tmp << '"';
+
+ pcrecpp::RE("\\{ID\\}").GlobalReplace(tmp.str(), &query);
+
+ mysql_real_query(mysql, query.c_str(), query.length());
+ MYSQL_RES *result = mysql_use_result(mysql);
+
+ if(mysql_num_fields(result) < 4)
+ return true; // TODO Error
+
+ MYSQL_ROW row = mysql_fetch_row(result);
+
+ if(row) {
+ Common::UserInfo user(strtoul(row[0], 0, 10), row[2]);
+
+ user.setGid(strtoul(row[1], 0, 10));
+ user.setFullName(row[3]);
+
+ Common::ActionManager::get()->add(sigc::bind(callback, user));
+
+ while((row = mysql_fetch_row(result)) != 0) {}
+ }
+ else {
+ Common::ActionManager::get()->add(sigc::bind(callback, Common::UserInfo()));
+ }
+
+ return true;
}
-bool UserBackendMysql::password(unsigned long uid, const std::string &password, const sigc::slot<void, bool> &callback) {
+bool UserBackendMysql::password(unsigned long uid _UNUSED_PARAMETER_, const std::string &password _UNUSED_PARAMETER_, const sigc::slot<void, bool> &callback _UNUSED_PARAMETER_) {
return false;
}