on xenial help sign in
Use proper hashing for passwords
commit6e1bdb87791a4237841f8e74490b4b64b755a496 authorMichael Terry <michael.terry@canonical.com> dateMon 23 Jun 2014, 17:06 (12 years ago) parent5717f64
2 files changed+19−6
debian/control+2 tests/mocks/LightDM/demo/GreeterPrivate.cpp+17−6
debian/control+2
@@ -40,6 +40,7 @@ Build-Depends: cmake,
4040 qtdeclarative5-ubuntu-settings-components,
4141 qtdeclarative5-ubuntu-ui-toolkit-plugin,
4242 ttf-ubuntu-font-family,
43+ whois,
4344Standards-Version: 3.9.4
4445Homepage: http://launchpad.net/unity
4546# If you aren't a member of ~unity-team but need to upload
@@ -83,6 +84,7 @@ Depends: gsettings-desktop-schemas,
8384 unity8-common (= ${source:Version}),
8485 unity8-private (= ${binary:Version}),
8586 unity8-private | unity-launcher-impl,
87+ whois,
8688 ${misc:Depends},
8789 ${shlibs:Depends},
8890Recommends: unity-scope-click,
tests/mocks/LightDM/demo/GreeterPrivate.cpp+17−6
@@ -19,6 +19,7 @@
1919#include "../Greeter.h"
2020#include "../GreeterPrivate.h"
2121#include <QtCore/QDir>
22+#include <QtCore/QProcess>
2223#include <QtCore/QSettings>
2324
2425namespace QLightDM
@@ -55,15 +56,25 @@ void GreeterPrivate::handleRespond(const QString &response)
5556
5657 QSettings settings(QDir::homePath() + "/.unity8-greeter-demo", QSettings::NativeFormat);
5758 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);
5961
60− QString passwordValue;
61− if (password == "pin") {
62− passwordValue = settings.value("passwordValue", "1234").toString();
62+ // We only support passwd type 6 (sha512) for now
63+ if (passwordParts.length() == 3 && passwordParts[0] == "6") {
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;
6374 } else {
64− passwordValue = settings.value("passwordValue", "password").toString();
75+ authenticated = false;
6576 }
66− authenticated = (response == passwordValue);
77+
6778 Q_EMIT q->authenticationComplete();
6879}
6980