on xenial help sign in
Use proper hashing for passwords
6e1bdb8Michael Terry
debian/control+2
@@ -40,6 +40,7 @@ Build-Depends: cmake,
40 qtdeclarative5-ubuntu-settings-components,
40 qtdeclarative5-ubuntu-settings-components,
41 qtdeclarative5-ubuntu-ui-toolkit-plugin,
41 qtdeclarative5-ubuntu-ui-toolkit-plugin,
42 ttf-ubuntu-font-family,
42 ttf-ubuntu-font-family,
43+ whois,
43Standards-Version: 3.9.4
44Standards-Version: 3.9.4
44Homepage: http://launchpad.net/unity
45Homepage: http://launchpad.net/unity
45# If you aren't a member of ~unity-team but need to upload
46# If you aren't a member of ~unity-team but need to upload
@@ -83,6 +84,7 @@ Depends: gsettings-desktop-schemas,
83 unity8-common (= ${source:Version}),
84 unity8-common (= ${source:Version}),
84 unity8-private (= ${binary:Version}),
85 unity8-private (= ${binary:Version}),
85 unity8-private | unity-launcher-impl,
86 unity8-private | unity-launcher-impl,
87+ whois,
86 ${misc:Depends},
88 ${misc:Depends},
87 ${shlibs:Depends},
89 ${shlibs:Depends},
88Recommends: unity-scope-click,
90Recommends: unity-scope-click,
tests/mocks/LightDM/demo/GreeterPrivate.cpp+17−6
@@ -19,6 +19,7 @@
19#include "../Greeter.h"
19#include "../Greeter.h"
20#include "../GreeterPrivate.h"
20#include "../GreeterPrivate.h"
21#include <QtCore/QDir>
21#include <QtCore/QDir>
22+#include <QtCore/QProcess>
22#include <QtCore/QSettings>
23#include <QtCore/QSettings>
23
24
24namespace QLightDM
25namespace QLightDM
@@ -55,15 +56,25 @@ void GreeterPrivate::handleRespond(const QString &response)
55
56
56 QSettings settings(QDir::homePath() + "/.unity8-greeter-demo", QSettings::NativeFormat);
57 QSettings settings(QDir::homePath() + "/.unity8-greeter-demo", QSettings::NativeFormat);
57 settings.beginGroup(authenticationUser);
58 settings.beginGroup(authenticationUser);
58− QVariant password = settings.value("password", "none");
59+ QVariant passwordValue(settings.value("passwordValue", QString()));
60+ QStringList passwordParts = passwordValue.toString().split('$', QString::SkipEmptyParts);
59
61
60− QString passwordValue;
62+ // We only support passwd type 6 (sha512) for now
61− if (password == "pin") {
63+ if (passwordParts.length() == 3 && passwordParts[0] == "6") {
62− passwordValue = settings.value("passwordValue", "1234").toString();
64+ QString command = "mkpasswd --method=sha-512 --stdin --salt=" + passwordParts[1];
65+
66+ QProcess process;
67+ process.start(command);
68+ process.write(response.toLatin1());
69+ process.closeWriteChannel();
70+ process.waitForFinished();
71+
72+ QString result = QString(process.readAllStandardOutput()).trimmed();
73+ authenticated = result == passwordValue;
63 } else {
74 } else {
64− passwordValue = settings.value("passwordValue", "password").toString();
75+ authenticated = false;
65 }
76 }
66− authenticated = (response == passwordValue);
77+
67 Q_EMIT q->authenticationComplete();
78 Q_EMIT q->authenticationComplete();
68}
79}
69
80