summaryrefslogtreecommitdiffstats
path: root/src/madc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/madc.cpp')
-rw-r--r--src/madc.cpp18
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;