diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-08-23 20:57:00 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-08-23 20:57:00 +0200 |
commit | 415cd36477e152c12f91a10ad61bb719373cd9d1 (patch) | |
tree | 0c235f3b1f9b844313e81eb9e900fa2662ebefcc /src/madc.cpp | |
parent | 6666bbf908b3f2a61a9ec1959e975de54dc23b0d (diff) | |
download | mad-415cd36477e152c12f91a10ad61bb719373cd9d1.tar mad-415cd36477e152c12f91a10ad61bb719373cd9d1.zip |
Authentifikation hinzugefügt.
Diffstat (limited to 'src/madc.cpp')
-rw-r--r-- | src/madc.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/madc.cpp b/src/madc.cpp index c55fd3e..1fa2112 100644 --- a/src/madc.cpp +++ b/src/madc.cpp @@ -30,6 +30,8 @@ #include "Client/Application.h" #include "Client/CommandParser.h" #include "Client/InformationManager.h" +#include "Client/PasswordReader.h" +#include "Client/Authenticators/PasswordAuthenticator.h" #include <iostream> @@ -69,13 +71,19 @@ int main(int argc, char *argv[]) { application.getRequestManager()->registerConnection(connection); + std::cerr << " connected." << std::endl << std::endl; + { - boost::shared_ptr<Common::Requests::IdentifyRequest> request(new Common::Requests::IdentifyRequest(&application)); - application.getRequestManager()->sendRequest(connection, request); - request->wait(); + std::string username, password; + + std::cerr << "Login: " << std::flush; + std::getline(std::cin, username); + password = Client::PasswordReader::readPassword("Password: "); + + Client::Authenticators::PasswordAuthenticator::authenticate(&application, connection, username, password); } - std::cerr << " connected." << std::endl; + std::cerr << "Login successful." << std::endl << std::endl; std::cerr << "Receiving host list..." << std::flush; application.getInformationManager()->updateDaemonList(connection); @@ -108,7 +116,7 @@ int main(int argc, char *argv[]) { application.getRequestManager()->unregisterConnection(connection); } catch(Core::Exception &e) { - application.logf(Core::LoggerBase::LOG_CRITICAL, "Connection error: %s", e.strerror().c_str()); + application.logf(Core::LoggerBase::LOG_CRITICAL, "Error: %s", e.strerror().c_str()); } delete connection; |