summaryrefslogtreecommitdiff
path: root/distfoldd/main.cc
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2012-09-30 19:41:17 +0200
committerJavier S. Pedro <maemo@javispedro.com>2012-09-30 19:41:17 +0200
commit15253d1995ea49b114ef5c627e15b661dbd602b2 (patch)
tree1111441406a0b043f45ab19fe42e567be36d4d09 /distfoldd/main.cc
parentc8f89279026af6bb03ef3d66e44e859fb7208925 (diff)
downloaddistfold-15253d1995ea49b114ef5c627e15b661dbd602b2.tar.gz
distfold-15253d1995ea49b114ef5c627e15b661dbd602b2.zip
add some trivial authentication
Diffstat (limited to 'distfoldd/main.cc')
-rw-r--r--distfoldd/main.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/distfoldd/main.cc b/distfoldd/main.cc
index 48d52a5..01ad11c 100644
--- a/distfoldd/main.cc
+++ b/distfoldd/main.cc
@@ -1,6 +1,7 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QSettings>
#include <QtCore/QDebug>
+#include <QtCrypto>
#include "distfolder.h"
#include "localkey.h"
@@ -13,6 +14,14 @@ int main(int argc, char *argv[])
a.setApplicationName("distfoldd");
a.setApplicationVersion("0.2");
+ QCA::Initializer qca;
+ qsrand(uint(QDateTime::currentMSecsSinceEpoch() & 0xFFFF));
+
+ if (!QCA::isSupported("cert,pkey,rsa,sha1,hmac(sha1),random")) {
+ qWarning() << "QCA was not build with the OpenSSL plugin";
+ return EXIT_FAILURE;
+ }
+
if (!LocalKey::setupLocalKey()) {
qWarning() << "Failed to setup local private key";
return EXIT_FAILURE;
@@ -24,6 +33,7 @@ int main(int argc, char *argv[])
QUuid uuid(settings.value("uuid").toString());
QString path = settings.value("path").toString();
DistFolder *f = new DistFolder(uuid, path);
+ f->setPassword(settings.value("password", uuid.toString()).toString());
f->setReadOnlySync(settings.value("ro", false).toBool());
f->setPullMode(settings.value("pull", false).toBool());
f->setCompress(settings.value("compress", true).toBool());