Revert all work done on authentication for now

epel9
Martin Briza 11 years ago
parent a56145a68c
commit 8d111c2f63

@ -77,7 +77,7 @@ index cbef261..4b610d8 100644
bool testing { false }; bool testing { false };
diff --git a/src/daemon/DaemonApp.cpp b/src/daemon/DaemonApp.cpp diff --git a/src/daemon/DaemonApp.cpp b/src/daemon/DaemonApp.cpp
index c40cdea..616282e 100644 index 9ad226b..9feb734 100644
--- a/src/daemon/DaemonApp.cpp --- a/src/daemon/DaemonApp.cpp
+++ b/src/daemon/DaemonApp.cpp +++ b/src/daemon/DaemonApp.cpp
@@ -25,6 +25,7 @@ @@ -25,6 +25,7 @@
@ -124,30 +124,28 @@ index 81f955c..2088010 100644
} }
diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp
index 8517124..80aa95a 100644 index f1a54b4..48137e6 100644
--- a/src/daemon/Display.cpp --- a/src/daemon/Display.cpp
+++ b/src/daemon/Display.cpp +++ b/src/daemon/Display.cpp
@@ -53,6 +53,19 @@ namespace SDDM { @@ -53,6 +53,17 @@ namespace SDDM {
return name; return name;
} }
+ Display::Display(const QString& hostname, const int displayId, QObject* parent) + Display::Display(const QString& hostname, const int displayId, QObject* parent) : QObject(parent),
+ : QObject(parent) + m_displayId(displayId),
+ , m_displayId(displayId) + m_authenticator(new Authenticator(this)),
+ , m_authenticator(new Authenticator(this)) + m_displayServer(nullptr),
+ , m_displayServer(nullptr) + m_socketServer(new SocketServer(this)),
+ , m_socketServer(new SocketServer(this)) + m_greeter(new Greeter(this)) {
+ , m_greeter(new Greeter(this))
+ {
+ m_display = QString("%1:%2").arg(hostname).arg(displayId); + m_display = QString("%1:%2").arg(hostname).arg(displayId);
+ +
+ init(); + init();
+ } + }
+ +
Display::Display(const int displayId, const int terminalId, QObject *parent) : QObject(parent), Display::Display(const int displayId, const int terminalId, Seat *parent) : QObject(parent),
m_displayId(displayId), m_terminalId(terminalId), m_displayId(displayId), m_terminalId(terminalId),
m_authenticator(new Authenticator(this)), m_authenticator(new Authenticator(this)),
@@ -62,12 +75,17 @@ namespace SDDM { @@ -63,12 +74,17 @@ namespace SDDM {
m_display = QString(":%1").arg(m_displayId); m_display = QString(":%1").arg(m_displayId);
@ -168,7 +166,7 @@ index 8517124..80aa95a 100644
// connect login signal // connect login signal
connect(m_socketServer, SIGNAL(login(QLocalSocket*,QString,QString,QString)), this, SLOT(login(QLocalSocket*,QString,QString,QString))); connect(m_socketServer, SIGNAL(login(QLocalSocket*,QString,QString,QString)), this, SLOT(login(QLocalSocket*,QString,QString,QString)));
@@ -90,6 +108,22 @@ namespace SDDM { @@ -91,6 +107,22 @@ namespace SDDM {
// set socket name // set socket name
m_socket = QString("sddm-%1-%2").arg(m_display).arg(generateName(6)); m_socket = QString("sddm-%1-%2").arg(m_display).arg(generateName(6));
@ -191,7 +189,7 @@ index 8517124..80aa95a 100644
} }
Display::~Display() { Display::~Display() {
@@ -112,6 +146,16 @@ namespace SDDM { @@ -113,6 +145,16 @@ namespace SDDM {
return m_cookie; return m_cookie;
} }
@ -205,10 +203,10 @@ index 8517124..80aa95a 100644
+ return cookie; + return cookie;
+ } + }
+ +
void Display::addCookie(const QString &file) { Seat *Display::seat() const {
// log message return m_seat;
qDebug() << " DAEMON: Adding cookie to" << file; }
@@ -139,28 +183,14 @@ namespace SDDM { @@ -144,28 +186,14 @@ namespace SDDM {
if (m_started) if (m_started)
return; return;
@ -216,14 +214,14 @@ index 8517124..80aa95a 100644
- std::random_device rd; - std::random_device rd;
- std::mt19937 gen(rd()); - std::mt19937 gen(rd());
- std::uniform_int_distribution<> dis(0, 15); - std::uniform_int_distribution<> dis(0, 15);
-
- // resever 32 bytes
- m_cookie.reserve(32);
+ if (m_displayServer != nullptr) { + if (m_displayServer != nullptr) {
+ // set display server params + // set display server params
+ m_displayServer->setDisplay(m_display); + m_displayServer->setDisplay(m_display);
+ m_displayServer->setAuthPath(m_authPath); + m_displayServer->setAuthPath(m_authPath);
- // resever 32 bytes
- m_cookie.reserve(32);
-
- // create a random hexadecimal number - // create a random hexadecimal number
- const char *digits = "0123456789abcdef"; - const char *digits = "0123456789abcdef";
- for (int i = 0; i < 32; ++i) - for (int i = 0; i < 32; ++i)
@ -244,7 +242,7 @@ index 8517124..80aa95a 100644
if ((daemonApp->configuration()->first || daemonApp->configuration()->autoRelogin()) && if ((daemonApp->configuration()->first || daemonApp->configuration()->autoRelogin()) &&
!daemonApp->configuration()->autoUser().isEmpty() && !daemonApp->configuration()->lastSession().isEmpty()) { !daemonApp->configuration()->autoUser().isEmpty() && !daemonApp->configuration()->lastSession().isEmpty()) {
@@ -216,9 +246,11 @@ namespace SDDM { @@ -221,9 +249,11 @@ namespace SDDM {
m_socketServer->stop(); m_socketServer->stop();
// stop display server // stop display server
@ -260,26 +258,26 @@ index 8517124..80aa95a 100644
// remove authority file // remove authority file
QFile::remove(m_authPath); QFile::remove(m_authPath);
diff --git a/src/daemon/Display.h b/src/daemon/Display.h diff --git a/src/daemon/Display.h b/src/daemon/Display.h
index 9d82678..9c475a9 100644 index 46d320b..9556209 100644
--- a/src/daemon/Display.h --- a/src/daemon/Display.h
+++ b/src/daemon/Display.h +++ b/src/daemon/Display.h
@@ -34,6 +34,7 @@ namespace SDDM { @@ -35,6 +35,7 @@ namespace SDDM {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(Display) Q_DISABLE_COPY(Display)
public: public:
+ explicit Display(const QString& hostname, const int displayId, QObject *parent = 0); + explicit Display(const QString& hostname, const int displayId, QObject *parent = 0);
explicit Display(const int displayId, const int terminalId, QObject *parent = 0); explicit Display(const int displayId, const int terminalId, Seat *parent);
~Display(); ~Display();
@@ -43,6 +44,7 @@ namespace SDDM { @@ -44,6 +45,7 @@ namespace SDDM {
const QString &name() const; const QString &name() const;
const QString &cookie() const; const QString &cookie() const;
+ const QByteArray rawCookie() const; + const QByteArray rawCookie() const;
void addCookie(const QString &file); void addCookie(const QString &file);
public slots: Seat *seat() const;
@@ -58,6 +60,8 @@ namespace SDDM { @@ -61,6 +63,8 @@ namespace SDDM {
void loginSucceeded(QLocalSocket *socket); void loginSucceeded(QLocalSocket *socket);
private: private:
@ -290,10 +288,10 @@ index 9d82678..9c475a9 100644
diff --git a/src/daemon/xdmcp/Packet.cpp b/src/daemon/xdmcp/Packet.cpp diff --git a/src/daemon/xdmcp/Packet.cpp b/src/daemon/xdmcp/Packet.cpp
new file mode 100644 new file mode 100644
index 0000000..90688d0 index 0000000..3a0c3d9
--- /dev/null --- /dev/null
+++ b/src/daemon/xdmcp/Packet.cpp +++ b/src/daemon/xdmcp/Packet.cpp
@@ -0,0 +1,435 @@ @@ -0,0 +1,397 @@
+/* +/*
+ * Packet type handling for X Display Control Protocol + * Packet type handling for X Display Control Protocol
+ * Copyright (C) 2013 Martin Bříza <mbriza@redhat.com> + * Copyright (C) 2013 Martin Bříza <mbriza@redhat.com>
@ -325,17 +323,15 @@ index 0000000..90688d0
+* PLUMBING +* PLUMBING
+ ******************************************************************************/ + ******************************************************************************/
+ +
+ Packet::Packet(const QHostAddress& host, quint16 port) + Packet::Packet(const QHostAddress &host, quint16 port) : m_host(host),
+ : m_host(host) + m_port(port),
+ , m_port(port) + m_valid(true) {
+ , m_valid(true) {
+ +
+ } + }
+ +
+ Packet::Packet(const QHostAddress& host, quint16 port, Reader& r) + Packet::Packet(const QHostAddress &host, quint16 port, Reader &r) : m_host(host),
+ : m_host(host) + m_port(port),
+ , m_port(port) + m_valid(false) {
+ , m_valid(false) {
+ +
+ } + }
+ +
@ -348,7 +344,7 @@ index 0000000..90688d0
+ } + }
+ +
+ // static + // static
+ Packet *Packet::decode(const QByteArray& data, const QHostAddress& host, quint16 port) { + Packet *Packet::decode(const QByteArray &data, const QHostAddress &host, quint16 port) {
+ Reader reader(data); + Reader reader(data);
+ uint16_t version, opcode, length; + uint16_t version, opcode, length;
+ +
@ -360,45 +356,45 @@ index 0000000..90688d0
+ return nullptr; + return nullptr;
+ +
+ switch (opcode) { + switch (opcode) {
+ case _Query: + case _Query:
+ return new Query(host, port, reader); + return new Query(host, port, reader);
+ case _BroadcastQuery: + case _BroadcastQuery:
+ return new BroadcastQuery(host, port, reader); + return new BroadcastQuery(host, port, reader);
+ case _IndirectQuery: + case _IndirectQuery:
+ return new IndirectQuery(host, port, reader); + return new IndirectQuery(host, port, reader);
+ case _ForwardQuery: + case _ForwardQuery:
+ return new ForwardQuery(host, port, reader); + return new ForwardQuery(host, port, reader);
+ case _Willing: + case _Willing:
+ return new Willing(host, port, reader); + return new Willing(host, port, reader);
+ case _Unwilling: + case _Unwilling:
+ return new Unwilling(host, port, reader); + return new Unwilling(host, port, reader);
+ case _Request: + case _Request:
+ return new Request(host, port, reader); + return new Request(host, port, reader);
+ case _Accept: + case _Accept:
+ return new Accept(host, port, reader); + return new Accept(host, port, reader);
+ case _Decline: + case _Decline:
+ return new Decline(host, port, reader); + return new Decline(host, port, reader);
+ case _Manage: + case _Manage:
+ return new Manage(host, port, reader); + return new Manage(host, port, reader);
+ case _Refuse: + case _Refuse:
+ return new Refuse(host, port, reader); + return new Refuse(host, port, reader);
+ case _Failed: + case _Failed:
+ return new Failed(host, port, reader); + return new Failed(host, port, reader);
+ case _KeepAlive: + case _KeepAlive:
+ return new KeepAlive(host, port, reader); + return new KeepAlive(host, port, reader);
+ case _Alive: + case _Alive:
+ return new Alive(host, port, reader); + return new Alive(host, port, reader);
+ default: + default:
+ qDebug() << " XDMCP: Got packet of an unknown type" << opcode; + qDebug() << " XDMCP: Got packet of an unknown type" << opcode;
+ return nullptr; + return nullptr;
+ } + }
+ } + }
+ +
+ void Packet::setHost(const QHostAddress host) { + void Packet::setHost(const QHostAddress &host) {
+ m_host = QHostAddress(host); + m_host = QHostAddress(host);
+ } + }
+ +
+ QHostAddress Packet::host() const { + const QHostAddress& Packet::host() const {
+ return m_host; + return m_host;
+ } + }
+ +
@ -424,12 +420,10 @@ index 0000000..90688d0
+ return nullptr; + return nullptr;
+ } + }
+ +
+ Packet::Query::Query(const QHostAddress& host, quint16 port, Reader& r) + Packet::Query::Query(const QHostAddress &host, quint16 port, Reader &r) : Packet(host, port, r) {
+ : Packet(host, port, r) {
+ r >> m_authenticationNames; + r >> m_authenticationNames;
+ if (r.isFinished()) { + if (r.isFinished())
+ m_valid = true; + m_valid = true;
+ }
+ } + }
+ +
+ QByteArray Packet::Query::encode() const { + QByteArray Packet::Query::encode() const {
@ -438,12 +432,10 @@ index 0000000..90688d0
+ return w.finalize(Packet::_Query); + return w.finalize(Packet::_Query);
+ } + }
+ +
+ Packet::BroadcastQuery::BroadcastQuery(const QHostAddress& host, quint16 port, Reader& r) + Packet::BroadcastQuery::BroadcastQuery(const QHostAddress &host, quint16 port, Reader &r) : Packet(host, port, r) {
+ : Packet(host, port, r) {
+ r >> m_authenticationNames; + r >> m_authenticationNames;
+ if (r.isFinished()) { + if (r.isFinished())
+ m_valid = true; + m_valid = true;
+ }
+ } + }
+ +
+ QByteArray Packet::BroadcastQuery::encode() const { + QByteArray Packet::BroadcastQuery::encode() const {
@ -452,12 +444,10 @@ index 0000000..90688d0
+ return w.finalize(Packet::_BroadcastQuery); + return w.finalize(Packet::_BroadcastQuery);
+ } + }
+ +
+ Packet::IndirectQuery::IndirectQuery(const QHostAddress& host, quint16 port, Reader& r) + Packet::IndirectQuery::IndirectQuery(const QHostAddress &host, quint16 port, Reader &r) : Packet(host, port, r) {
+ : Packet(host, port, r) {
+ r >> m_authenticationNames; + r >> m_authenticationNames;
+ if (r.isFinished()) { + if (r.isFinished())
+ m_valid = true; + m_valid = true;
+ }
+ } + }
+ +
+ QByteArray Packet::IndirectQuery::encode() const { + QByteArray Packet::IndirectQuery::encode() const {
@ -466,11 +456,10 @@ index 0000000..90688d0
+ return w.finalize(Packet::_IndirectQuery); + return w.finalize(Packet::_IndirectQuery);
+ } + }
+ +
+ Packet::ForwardQuery::ForwardQuery(const QHostAddress& host, quint16 port, Reader& r) : Packet(host, port, r) { + Packet::ForwardQuery::ForwardQuery(const QHostAddress &host, quint16 port, Reader &r) : Packet(host, port, r) {
+ r >> m_clientAddress >> m_clientPort >> m_authenticationNames; + r >> m_clientAddress >> m_clientPort >> m_authenticationNames;
+ if (r.isFinished()) { + if (r.isFinished())
+ m_valid = true; + m_valid = true;
+ }
+ } + }
+ +
+ QByteArray Packet::ForwardQuery::encode() const { + QByteArray Packet::ForwardQuery::encode() const {
@ -479,20 +468,17 @@ index 0000000..90688d0
+ return w.finalize(Packet::_ForwardQuery); + return w.finalize(Packet::_ForwardQuery);
+ } + }
+ +
+ Packet::Willing::Willing(const QHostAddress& host, quint16 port, const QString& authenticationName, const QString& hostname, const QString& status) + Packet::Willing::Willing(const QHostAddress &host, quint16 port, const QString &authenticationName, const QString &hostname, const QString &status) : Packet(host, port),
+ : Packet(host, port) + m_authenticationName(authenticationName.toLatin1()),
+ , m_authenticationName(authenticationName.toLatin1()) + m_hostname(hostname.toLatin1()),
+ , m_hostname(hostname.toLatin1()) + m_status(status.toLatin1()) {
+ , m_status(status.toLatin1()) {
+ qDebug() << " XDMCP: Prepared Willing reply for" << host << port << "with contents" << authenticationName << hostname << status; + qDebug() << " XDMCP: Prepared Willing reply for" << host << port << "with contents" << authenticationName << hostname << status;
+ } + }
+ +
+ Packet::Willing::Willing(const QHostAddress& host, quint16 port, Reader& r) + Packet::Willing::Willing(const QHostAddress &host, quint16 port, Reader &r) : Packet(host, port, r) {
+ : Packet(host, port, r) {
+ r >> m_authenticationName >> m_hostname >> m_status; + r >> m_authenticationName >> m_hostname >> m_status;
+ if (r.isFinished()) { + if (r.isFinished())
+ m_valid = true; + m_valid = true;
+ }
+ } + }
+ +
+ QByteArray Packet::Willing::encode() const { + QByteArray Packet::Willing::encode() const {
@ -501,19 +487,16 @@ index 0000000..90688d0
+ return w.finalize(Packet::_Willing); + return w.finalize(Packet::_Willing);
+ } + }
+ +
+ Packet::Unwilling::Unwilling(const QHostAddress& host, quint16 port, const QString& hostname, const QString& status) + Packet::Unwilling::Unwilling(const QHostAddress &host, quint16 port, const QString &hostname, const QString &status) : Packet(host, port),
+ : Packet(host, port) + m_hostname(hostname.toLatin1()),
+ , m_hostname(hostname.toLatin1()) + m_status(status.toLatin1()) {
+ , m_status(status.toLatin1()) {
+ qDebug() << " XDMCP: Prepared Unwilling reply for" << host << port << "with contents" << hostname << status; + qDebug() << " XDMCP: Prepared Unwilling reply for" << host << port << "with contents" << hostname << status;
+ } + }
+ +
+ Packet::Unwilling::Unwilling(const QHostAddress& host, quint16 port, Reader& r) + Packet::Unwilling::Unwilling(const QHostAddress &host, quint16 port, Reader &r) : Packet(host, port, r) {
+ : Packet(host, port, r) {
+ r >> m_hostname >> m_status; + r >> m_hostname >> m_status;
+ if (r.isFinished()) { + if (r.isFinished())
+ m_valid = true; + m_valid = true;
+ }
+ } + }
+ +
+ QByteArray Packet::Unwilling::encode() const { + QByteArray Packet::Unwilling::encode() const {
@ -522,64 +505,50 @@ index 0000000..90688d0
+ return w.finalize(Packet::_Unwilling); + return w.finalize(Packet::_Unwilling);
+ } + }
+ +
+ Packet::Request::Request(const QHostAddress& host, quint16 port, Reader& r) + Packet::Request::Request(const QHostAddress &host, quint16 port, Reader &r) : Packet(host, port, r) {
+ : Packet(host, port, r) { + r >> m_displayNumber >> m_connectionTypes >> m_connectionAddresses >> m_authenticationName >> m_authenticationData >> m_authorizationNames >> m_manufacturerDisplayID;
+ r >> m_displayNumber >> m_connectionTypes >> m_connectionAddresses + if (r.isFinished())
+ >> m_authenticationName >> m_authenticationData >> m_authorizationNames
+ >> m_manufacturerDisplayID;
+ if (r.isFinished()) {
+ m_valid = true; + m_valid = true;
+ }
+ } + }
+ +
+ QByteArray Packet::Request::encode() const { + QByteArray Packet::Request::encode() const {
+ Writer w; + Writer w;
+ w << m_displayNumber << m_connectionTypes << m_connectionAddresses + w << m_displayNumber << m_connectionTypes << m_connectionAddresses << m_authenticationName << m_authenticationData << m_authorizationNames << m_manufacturerDisplayID;
+ << m_authenticationName << m_authenticationData << m_authorizationNames
+ << m_manufacturerDisplayID;
+ return w.finalize(Packet::_Request); + return w.finalize(Packet::_Request);
+ } + }
+ +
+ Packet::Accept::Accept(const QHostAddress& host, quint16 port, uint32_t sessionId, const QString authenticationName, const QByteArray authenticationData, const QString authorizationName, const QByteArray authorizationData) + Packet::Accept::Accept(const QHostAddress &host, quint16 port, uint32_t sessionId, const QString authenticationName, const QByteArray authenticationData, const QString authorizationName, const QByteArray authorizationData) : Packet(host, port),
+ : Packet(host, port) + m_sessionID(sessionId),
+ , m_sessionID(sessionId) + m_authenticationName(authenticationName.toLatin1()),
+ , m_authenticationName(authenticationName.toLatin1()) + m_authenticationData(authenticationData),
+ , m_authenticationData(authenticationData) + m_authorizationName(authorizationName.toLatin1()),
+ , m_authorizationName(authorizationName.toLatin1()) + m_authorizationData(authorizationData) {
+ , m_authorizationData(authorizationData) {
+ qDebug() << " XDMCP: Prepared Accept reply for" << host << port << "with contents" << sessionId << authenticationName << authenticationData << authorizationName << authorizationData; + qDebug() << " XDMCP: Prepared Accept reply for" << host << port << "with contents" << sessionId << authenticationName << authenticationData << authorizationName << authorizationData;
+ } + }
+ +
+ Packet::Accept::Accept(const QHostAddress& host, quint16 port, Reader& r) + Packet::Accept::Accept(const QHostAddress &host, quint16 port, Reader &r) : Packet(host, port, r) {
+ : Packet(host, port, r) { + r >> m_sessionID >> m_authenticationName >> m_authenticationData >> m_authorizationName >> m_authorizationData;
+ r >> m_sessionID >> m_authenticationName >> m_authenticationData + if (r.isFinished())
+ >> m_authorizationName >> m_authorizationData;
+ if (r.isFinished()) {
+ m_valid = true; + m_valid = true;
+ }
+ } + }
+ +
+ QByteArray Packet::Accept::encode() const { + QByteArray Packet::Accept::encode() const {
+ Writer w; + Writer w;
+ w << m_sessionID << m_authenticationName << m_authenticationData + w << m_sessionID << m_authenticationName << m_authenticationData << m_authorizationName << m_authorizationData;
+ << m_authorizationName << m_authorizationData;
+ return w.finalize(Packet::_Accept); + return w.finalize(Packet::_Accept);
+ } + }
+ +
+ Packet::Decline::Decline(const QHostAddress& host, quint16 port, const QString status, const QString authenticationName, const QByteArray authenticationData) + Packet::Decline::Decline(const QHostAddress &host, quint16 port, const QString status, const QString authenticationName, const QByteArray authenticationData) : Packet(host, port),
+ : Packet(host, port) + m_status(status.toLatin1()),
+ , m_status(status.toLatin1()) + m_authenticationName(authenticationName.toLatin1()),
+ , m_authenticationName(authenticationName.toLatin1()) + m_authenticationData(authenticationData) {
+ , m_authenticationData(authenticationData) {
+ qDebug() << " XDMCP: Prepared Decline reply for" << host << port << "with contents" << status << authenticationName << authenticationData; + qDebug() << " XDMCP: Prepared Decline reply for" << host << port << "with contents" << status << authenticationName << authenticationData;
+ } + }
+ +
+ Packet::Decline::Decline(const QHostAddress& host, quint16 port, Reader& r) + Packet::Decline::Decline(const QHostAddress &host, quint16 port, Reader &r) : Packet(host, port, r) {
+ : Packet(host, port, r) {
+ r >> m_status >> m_authenticationName >> m_authenticationData; + r >> m_status >> m_authenticationName >> m_authenticationData;
+ if (r.isFinished()) { + if (r.isFinished())
+ m_valid = true; + m_valid = true;
+ }
+ } + }
+ +
+ QByteArray Packet::Decline::encode() const { + QByteArray Packet::Decline::encode() const {
@ -588,12 +557,10 @@ index 0000000..90688d0
+ return w.finalize(Packet::_Decline); + return w.finalize(Packet::_Decline);
+ } + }
+ +
+ Packet::Manage::Manage(const QHostAddress& host, quint16 port, Reader& r) + Packet::Manage::Manage(const QHostAddress &host, quint16 port, Reader &r) : Packet(host, port, r) {
+ : Packet(host, port, r) {
+ r >> m_sessionID >> m_displayNumber >> m_displayClass; + r >> m_sessionID >> m_displayNumber >> m_displayClass;
+ if (r.isFinished()) { + if (r.isFinished())
+ m_valid = true; + m_valid = true;
+ }
+ } + }
+ +
+ QByteArray Packet::Manage::encode() const { + QByteArray Packet::Manage::encode() const {
@ -602,17 +569,15 @@ index 0000000..90688d0
+ return w.finalize(Packet::_Manage); + return w.finalize(Packet::_Manage);
+ } + }
+ +
+ Packet::Refuse::Refuse(const QHostAddress& host, quint16 port, uint32_t sessionID) + Packet::Refuse::Refuse(const QHostAddress &host, quint16 port, uint32_t sessionID) : Packet(host, port),
+ : Packet(host, port) + m_sessionID(sessionID) {
+ , m_sessionID(sessionID) {
+ qDebug() << " XDMCP: Prepared Refuse reply for" << host << port << "with contents" << sessionID; + qDebug() << " XDMCP: Prepared Refuse reply for" << host << port << "with contents" << sessionID;
+ } + }
+ +
+ Packet::Refuse::Refuse(const QHostAddress& host, quint16 port, Reader& r) : Packet(host, port, r) { + Packet::Refuse::Refuse(const QHostAddress &host, quint16 port, Reader &r) : Packet(host, port, r) {
+ r >> m_sessionID; + r >> m_sessionID;
+ if (r.isFinished()) { + if (r.isFinished())
+ m_valid = true; + m_valid = true;
+ }
+ } + }
+ +
+ QByteArray Packet::Refuse::encode() const { + QByteArray Packet::Refuse::encode() const {
@ -621,19 +586,16 @@ index 0000000..90688d0
+ return w.finalize(Packet::_Refuse); + return w.finalize(Packet::_Refuse);
+ } + }
+ +
+ Packet::Failed::Failed(const QHostAddress& host, quint16 port, uint32_t sessionID, const QString& status) + Packet::Failed::Failed(const QHostAddress &host, quint16 port, uint32_t sessionID, const QString &status) : Packet(host, port),
+ : Packet(host, port) + m_sessionID(sessionID),
+ , m_sessionID(sessionID) + m_status(status.toLatin1()) {
+ , m_status(status.toLatin1()) {
+ qDebug() << " XDMCP: Prepared Failed reply for" << host << port << "with contents" << sessionID << status; + qDebug() << " XDMCP: Prepared Failed reply for" << host << port << "with contents" << sessionID << status;
+ } + }
+ +
+ Packet::Failed::Failed(const QHostAddress& host, quint16 port, Reader& r) + Packet::Failed::Failed(const QHostAddress &host, quint16 port, Reader &r) : Packet(host, port, r) {
+ : Packet(host, port, r) {
+ r >> m_sessionID >> m_status; + r >> m_sessionID >> m_status;
+ if (r.isFinished()) { + if (r.isFinished())
+ m_valid = true; + m_valid = true;
+ }
+ } + }
+ +
+ QByteArray Packet::Failed::encode() const { + QByteArray Packet::Failed::encode() const {
@ -642,12 +604,10 @@ index 0000000..90688d0
+ return w.finalize(Packet::_Failed); + return w.finalize(Packet::_Failed);
+ } + }
+ +
+ Packet::KeepAlive::KeepAlive(const QHostAddress& host, quint16 port, Reader& r) + Packet::KeepAlive::KeepAlive(const QHostAddress &host, quint16 port, Reader &r) : Packet(host, port, r) {
+ : Packet(host, port, r) {
+ r >> m_displayNumber >> m_sessionID; + r >> m_displayNumber >> m_sessionID;
+ if (r.isFinished()) { + if (r.isFinished())
+ m_valid = true; + m_valid = true;
+ }
+ } + }
+ +
+ QByteArray Packet::KeepAlive::encode() const { + QByteArray Packet::KeepAlive::encode() const {
@ -656,19 +616,16 @@ index 0000000..90688d0
+ return w.finalize(Packet::_KeepAlive); + return w.finalize(Packet::_KeepAlive);
+ } + }
+ +
+ Packet::Alive::Alive(const QHostAddress& host, quint16 port, uint8_t sessionRunning, uint32_t sessionID) + Packet::Alive::Alive(const QHostAddress &host, quint16 port, uint8_t sessionRunning, uint32_t sessionID) : Packet(host, port),
+ : Packet(host, port) + m_sessionRunning(sessionRunning),
+ , m_sessionRunning(sessionRunning) + m_sessionID(sessionID) {
+ , m_sessionID(sessionID) {
+ qDebug() << " XDMCP: Prepared Alive reply for" << host << port << "with contents" << sessionRunning << sessionID; + qDebug() << " XDMCP: Prepared Alive reply for" << host << port << "with contents" << sessionRunning << sessionID;
+ } + }
+ +
+ Packet::Alive::Alive(const QHostAddress& host, quint16 port, Reader& r) + Packet::Alive::Alive(const QHostAddress &host, quint16 port, Reader &r) : Packet(host, port, r) {
+ : Packet(host, port, r) {
+ r >> m_sessionRunning >> m_sessionID; + r >> m_sessionRunning >> m_sessionID;
+ if (r.isFinished()) { + if (r.isFinished())
+ m_valid = true; + m_valid = true;
+ }
+ } + }
+ +
+ QByteArray Packet::Alive::encode() const { + QByteArray Packet::Alive::encode() const {
@ -682,45 +639,48 @@ index 0000000..90688d0
+ ******************************************************************************/ + ******************************************************************************/
+ +
+ Packet *Packet::Query::onServerReceived() const { + Packet *Packet::Query::onServerReceived() const {
+ if (m_authenticationNames.isEmpty()) { + if (m_authenticationNames.isEmpty())
+ return new Willing(m_host, m_port, "", Server::instance()->hostname(), Server::instance()->status()); + return new Willing(m_host, m_port, "", Server::instance()->hostname(), Server::instance()->status());
+ } +
+ else { + return new Unwilling(m_host, m_port, Server::instance()->hostname(), "Server does not support authentication");
+ return new Unwilling(m_host, m_port, Server::instance()->hostname(), "Server does not support authentication");
+ }
+ } + }
+ +
+ Packet* Packet::Request::onServerReceived() const { + Packet* Packet::Request::onServerReceived() const {
+ qDebug() << " XDMCP: Server: Received Request" << m_displayNumber << m_connectionTypes << m_connectionAddresses << m_authenticationName << m_authenticationData << m_authorizationNames << m_manufacturerDisplayID; + qDebug() << " XDMCP: Server: Received Request" << m_displayNumber << m_connectionTypes << m_connectionAddresses << m_authenticationName << m_authenticationData << m_authorizationNames << m_manufacturerDisplayID;
+
+ if (m_authorizationNames.contains("MIT-MAGIC-COOKIE-1")) { + if (m_authorizationNames.contains("MIT-MAGIC-COOKIE-1")) {
+ uint32_t sessionId = Server::instance()->newSessionId(); + uint32_t sessionId = Server::instance()->newSessionId();
+ // FIXME for obvious reasons
+ QHostAddress addr(QString("%1.%2.%3.%4").arg((uint) m_connectionAddresses.first()[0]).arg((uint) m_connectionAddresses.first()[1]).arg((uint) m_connectionAddresses.first()[2]).arg((uint) m_connectionAddresses.first()[3])); + QHostAddress addr(QString("%1.%2.%3.%4").arg((uint) m_connectionAddresses.first()[0]).arg((uint) m_connectionAddresses.first()[1]).arg((uint) m_connectionAddresses.first()[2]).arg((uint) m_connectionAddresses.first()[3]));
+ Display *display = Server::instance()->newDisplay(sessionId, addr.toString(), m_displayNumber); + Display *display = Server::instance()->newDisplay(sessionId, addr.toString(), m_displayNumber);
+
+ return new Accept(m_host, m_port, sessionId, m_authenticationName, m_authenticationData, "MIT-MAGIC-COOKIE-1", display->rawCookie()); + return new Accept(m_host, m_port, sessionId, m_authenticationName, m_authenticationData, "MIT-MAGIC-COOKIE-1", display->rawCookie());
+ } else {
+ return new Decline(m_host, m_port, Server::instance()->status(), m_authenticationName, m_authenticationData);
+ } + }
+
+ return new Decline(m_host, m_port, Server::instance()->status(), m_authenticationName, m_authenticationData);
+ } + }
+ +
+ Packet* Packet::Manage::onServerReceived() const { + Packet* Packet::Manage::onServerReceived() const {
+ Display *display = Server::instance()->getDisplay(m_sessionID); + Display *display = Server::instance()->getDisplay(m_sessionID);
+
+ if (display != nullptr) { + if (display != nullptr) {
+ display->start(); + display->start();
+ return nullptr; + return nullptr; // this packet doesn't have any response on success
+ } else {
+ return new Refuse(m_host, m_port, m_sessionID);
+ } + }
+
+ return new Refuse(m_host, m_port, m_sessionID);
+ } + }
+ +
+ Packet* Packet::KeepAlive::onServerReceived() const { + Packet* Packet::KeepAlive::onServerReceived() const {
+ Display *display = Server::instance()->getDisplay(m_sessionID); + Display *display = Server::instance()->getDisplay(m_sessionID);
+
+ if (display == nullptr) + if (display == nullptr)
+ return new Alive(m_host, m_port, 0, m_sessionID); + return new Alive(m_host, m_port, 0, m_sessionID);
+ else if (display->displayId() != m_displayNumber) +
+ if (display->displayId() != m_displayNumber)
+ return new Alive(m_host, m_port, 0, m_sessionID); + return new Alive(m_host, m_port, 0, m_sessionID);
+ else { +
+ return new Alive(m_host, m_port, 1, m_sessionID); + return new Alive(m_host, m_port, 1, m_sessionID);
+ }
+ } + }
+ +
+/******************************************************************************* +/*******************************************************************************
@ -731,7 +691,7 @@ index 0000000..90688d0
+}; +};
diff --git a/src/daemon/xdmcp/Packet.h b/src/daemon/xdmcp/Packet.h diff --git a/src/daemon/xdmcp/Packet.h b/src/daemon/xdmcp/Packet.h
new file mode 100644 new file mode 100644
index 0000000..507b1b4 index 0000000..9246541
--- /dev/null --- /dev/null
+++ b/src/daemon/xdmcp/Packet.h +++ b/src/daemon/xdmcp/Packet.h
@@ -0,0 +1,394 @@ @@ -0,0 +1,394 @@
@ -807,21 +767,21 @@ index 0000000..507b1b4
+ * \param port Source port of the packet + * \param port Source port of the packet
+ * \return Parsed packet + * \return Parsed packet
+ */ + */
+ static Packet *decode(const QByteArray& data, const QHostAddress& host = QHostAddress(), quint16 port = 0); + static Packet *decode(const QByteArray &data, const QHostAddress &host = QHostAddress(), quint16 port = 0);
+ +
+ /** + /**
+ * Set the packet's source/destination host + * Set the packet's source/destination host
+ * + *
+ * \param host The host + * \param host The host
+ */ + */
+ void setHost(const QHostAddress host); + void setHost(const QHostAddress &host);
+ +
+ /** + /**
+ * Get the packet's source/destination host + * Get the packet's source/destination host
+ * + *
+ * \return The host + * \return The host
+ */ + */
+ QHostAddress host() const; + const QHostAddress& host() const;
+ +
+ /** + /**
+ * Set the packet's source/destination host + * Set the packet's source/destination host
@ -881,7 +841,7 @@ index 0000000..507b1b4
+ * \param host Destination host for the response + * \param host Destination host for the response
+ * \param port Destination port for the response + * \param port Destination port for the response
+ */ + */
+ Packet(const QHostAddress& host, quint16 port); + Packet(const QHostAddress &host, quint16 port);
+ /** + /**
+ * C'tor targetted for parsing raw data + * C'tor targetted for parsing raw data
+ * + *
@ -889,7 +849,7 @@ index 0000000..507b1b4
+ * \param port Destination port for the response + * \param port Destination port for the response
+ * \param r Reader containing the packet's raw data + * \param r Reader containing the packet's raw data
+ */ + */
+ Packet(const QHostAddress& host, quint16 port, Reader& r); + Packet(const QHostAddress &host, quint16 port, Reader &r);
+ +
+ QHostAddress m_host; + QHostAddress m_host;
+ quint16 m_port { 0 }; + quint16 m_port { 0 };
@ -898,7 +858,7 @@ index 0000000..507b1b4
+ +
+ class Packet::BroadcastQuery : public Packet { + class Packet::BroadcastQuery : public Packet {
+ public: + public:
+ BroadcastQuery(const QHostAddress& host, quint16 port, Reader& r); + BroadcastQuery(const QHostAddress &host, quint16 port, Reader &r);
+ virtual QByteArray encode() const; + virtual QByteArray encode() const;
+ private: + private:
+ QVector<QByteArray> m_authenticationNames; + QVector<QByteArray> m_authenticationNames;
@ -906,7 +866,7 @@ index 0000000..507b1b4
+ +
+ class Packet::Query : public Packet { + class Packet::Query : public Packet {
+ public: + public:
+ Query(const QHostAddress& host, quint16 port, Reader& r); + Query(const QHostAddress &host, quint16 port, Reader &r);
+ virtual QByteArray encode() const; + virtual QByteArray encode() const;
+ /** + /**
+ * Server side handling of Query packet + * Server side handling of Query packet
@ -933,7 +893,7 @@ index 0000000..507b1b4
+ +
+ class Packet::IndirectQuery : public Packet { + class Packet::IndirectQuery : public Packet {
+ public: + public:
+ IndirectQuery(const QHostAddress& host, quint16 port, Reader& r); + IndirectQuery(const QHostAddress &host, quint16 port, Reader &r);
+ virtual QByteArray encode() const; + virtual QByteArray encode() const;
+ private: + private:
+ QVector<QByteArray> m_authenticationNames; + QVector<QByteArray> m_authenticationNames;
@ -941,7 +901,7 @@ index 0000000..507b1b4
+ +
+ class Packet::ForwardQuery : public Packet { + class Packet::ForwardQuery : public Packet {
+ public: + public:
+ ForwardQuery(const QHostAddress& host, quint16 port, Reader& r); + ForwardQuery(const QHostAddress &host, quint16 port, Reader &r);
+ virtual QByteArray encode() const; + virtual QByteArray encode() const;
+ private: + private:
+ QByteArray m_clientAddress; + QByteArray m_clientAddress;
@ -951,10 +911,10 @@ index 0000000..507b1b4
+ +
+ class Packet::Willing : public Packet { + class Packet::Willing : public Packet {
+ public: + public:
+ Willing(const QHostAddress& host, quint16 port, + Willing(const QHostAddress &host, quint16 port,
+ const QString& authenticationName, const QString& hostname, + const QString &authenticationName, const QString &hostname,
+ const QString& status); + const QString &status);
+ Willing(const QHostAddress& host, quint16 port, Reader& r); + Willing(const QHostAddress &host, quint16 port, Reader &r);
+ virtual QByteArray encode() const; + virtual QByteArray encode() const;
+ /** + /**
+ * Client side handling of Willing packet + * Client side handling of Willing packet
@ -974,9 +934,9 @@ index 0000000..507b1b4
+ +
+ class Packet::Unwilling : public Packet { + class Packet::Unwilling : public Packet {
+ public: + public:
+ Unwilling(const QHostAddress& host, quint16 port, + Unwilling(const QHostAddress &host, quint16 port,
+ const QString& hostname, const QString& status); + const QString &hostname, const QString &status);
+ Unwilling(const QHostAddress& host, quint16 port, Reader& r); + Unwilling(const QHostAddress &host, quint16 port, Reader &r);
+ virtual QByteArray encode() const; + virtual QByteArray encode() const;
+ private: + private:
+ QByteArray m_hostname; + QByteArray m_hostname;
@ -985,7 +945,7 @@ index 0000000..507b1b4
+ +
+ class Packet::Request : public Packet { + class Packet::Request : public Packet {
+ public: + public:
+ Request(const QHostAddress& host, quint16 port, Reader& r); + Request(const QHostAddress &host, quint16 port, Reader &r);
+ virtual QByteArray encode() const; + virtual QByteArray encode() const;
+ /** + /**
+ * Server side handling of Request packet + * Server side handling of Request packet
@ -1016,10 +976,10 @@ index 0000000..507b1b4
+ +
+ class Packet::Accept : public Packet { + class Packet::Accept : public Packet {
+ public: + public:
+ Accept(const QHostAddress& host, quint16 port, uint32_t sessionId, + Accept(const QHostAddress &host, quint16 port, uint32_t sessionId,
+ const QString authenticationName, const QByteArray authenticationData, + const QString authenticationName, const QByteArray authenticationData,
+ const QString authorizationName, const QByteArray authorizationData); + const QString authorizationName, const QByteArray authorizationData);
+ Accept(const QHostAddress& host, quint16 port, Reader& r); + Accept(const QHostAddress &host, quint16 port, Reader &r);
+ virtual QByteArray encode() const; + virtual QByteArray encode() const;
+ /** + /**
+ * Client side handling of Accept packet + * Client side handling of Accept packet
@ -1041,9 +1001,9 @@ index 0000000..507b1b4
+ +
+ class Packet::Decline : public Packet { + class Packet::Decline : public Packet {
+ public: + public:
+ Decline(const QHostAddress& host, quint16 port, const QString status, + Decline(const QHostAddress &host, quint16 port, const QString status,
+ const QString authenticationName, const QByteArray authenticationData); + const QString authenticationName, const QByteArray authenticationData);
+ Decline(const QHostAddress& host, quint16 port, Reader& r); + Decline(const QHostAddress &host, quint16 port, Reader &r);
+ virtual QByteArray encode() const; + virtual QByteArray encode() const;
+ private: + private:
+ QByteArray m_status; + QByteArray m_status;
@ -1053,7 +1013,7 @@ index 0000000..507b1b4
+ +
+ class Packet::Manage : public Packet { + class Packet::Manage : public Packet {
+ public: + public:
+ Manage(const QHostAddress& host, quint16 port, Reader& r); + Manage(const QHostAddress &host, quint16 port, Reader &r);
+ virtual QByteArray encode() const; + virtual QByteArray encode() const;
+ /** + /**
+ * Server side handling of Manage packet + * Server side handling of Manage packet
@ -1080,8 +1040,8 @@ index 0000000..507b1b4
+ +
+ class Packet::Refuse : public Packet { + class Packet::Refuse : public Packet {
+ public: + public:
+ Refuse(const QHostAddress& host, quint16 port, uint32_t sessionID); + Refuse(const QHostAddress &host, quint16 port, uint32_t sessionID);
+ Refuse(const QHostAddress& host, quint16 port, Reader& r); + Refuse(const QHostAddress &host, quint16 port, Reader &r);
+ virtual QByteArray encode() const; + virtual QByteArray encode() const;
+ private: + private:
+ uint32_t m_sessionID; + uint32_t m_sessionID;
@ -1089,8 +1049,8 @@ index 0000000..507b1b4
+ +
+ class Packet::Failed : public Packet { + class Packet::Failed : public Packet {
+ public: + public:
+ Failed(const QHostAddress& host, quint16 port, uint32_t sessionID, const QString& status); + Failed(const QHostAddress &host, quint16 port, uint32_t sessionID, const QString &status);
+ Failed(const QHostAddress& host, quint16 port, Reader& r); + Failed(const QHostAddress &host, quint16 port, Reader &r);
+ virtual QByteArray encode() const; + virtual QByteArray encode() const;
+ private: + private:
+ uint32_t m_sessionID; + uint32_t m_sessionID;
@ -1099,7 +1059,7 @@ index 0000000..507b1b4
+ +
+ class Packet::KeepAlive : public Packet { + class Packet::KeepAlive : public Packet {
+ public: + public:
+ KeepAlive(const QHostAddress& host, quint16 port, Reader& r); + KeepAlive(const QHostAddress &host, quint16 port, Reader &r);
+ virtual QByteArray encode() const; + virtual QByteArray encode() const;
+ /** + /**
+ * Server side handling of KeepAlive packet + * Server side handling of KeepAlive packet
@ -1117,8 +1077,8 @@ index 0000000..507b1b4
+ +
+ class Packet::Alive : public Packet { + class Packet::Alive : public Packet {
+ public: + public:
+ Alive(const QHostAddress& host, quint16 port, uint8_t sessionRunning, uint32_t sessionID); + Alive(const QHostAddress &host, quint16 port, uint8_t sessionRunning, uint32_t sessionID);
+ Alive(const QHostAddress& host, quint16 port, Reader& r); + Alive(const QHostAddress &host, quint16 port, Reader &r);
+ virtual QByteArray encode() const; + virtual QByteArray encode() const;
+ private: + private:
+ uint8_t m_sessionRunning; + uint8_t m_sessionRunning;
@ -1131,10 +1091,10 @@ index 0000000..507b1b4
+#endif // SDDM_XDMCP_PACKET_H +#endif // SDDM_XDMCP_PACKET_H
diff --git a/src/daemon/xdmcp/Server.cpp b/src/daemon/xdmcp/Server.cpp diff --git a/src/daemon/xdmcp/Server.cpp b/src/daemon/xdmcp/Server.cpp
new file mode 100644 new file mode 100644
index 0000000..edfdff4 index 0000000..b4dc6e1
--- /dev/null --- /dev/null
+++ b/src/daemon/xdmcp/Server.cpp +++ b/src/daemon/xdmcp/Server.cpp
@@ -0,0 +1,149 @@ @@ -0,0 +1,148 @@
+/* +/*
+ * Server implementation for X Display Control Protocol + * Server implementation for X Display Control Protocol
+ * Copyright (C) 2013 Martin Bříza <mbriza@redhat.com> + * Copyright (C) 2013 Martin Bříza <mbriza@redhat.com>
@ -1174,9 +1134,8 @@ index 0000000..edfdff4
+ return self; + return self;
+ } + }
+ +
+ Server::Server(DaemonApp* parent) + Server::Server(DaemonApp* parent) : QUdpSocket(parent),
+ : QUdpSocket(parent) + m_hostname(QHostInfo::localHostName()) {
+ , m_hostname(QHostInfo::localHostName()) {
+ +
+ } + }
+ +
@ -1225,7 +1184,7 @@ index 0000000..edfdff4
+ return m_lastSession++; + return m_lastSession++;
+ } + }
+ +
+ Display* Server::newDisplay(uint32_t sessionId, QString hostName, uint32_t displayNumber) { + Display* Server::newDisplay(uint32_t sessionId, const QString &hostName, uint32_t displayNumber) {
+ if (m_displays.contains(sessionId)) + if (m_displays.contains(sessionId))
+ return nullptr; + return nullptr;
+ Display *display = new Display(hostName, displayNumber, this); + Display *display = new Display(hostName, displayNumber, this);
@ -1237,12 +1196,12 @@ index 0000000..edfdff4
+ Display* Server::getDisplay(uint32_t id) { + Display* Server::getDisplay(uint32_t id) {
+ if (m_displays.contains(id)) + if (m_displays.contains(id))
+ return m_displays[id]; + return m_displays[id];
+ else + return nullptr;
+ return nullptr;
+ } + }
+ +
+ void Server::removeDisplay(QObject* obj) { + void Server::removeDisplay(QObject* obj) {
+ int key = m_displays.key(qobject_cast<Display*>(obj), -1); + int key = m_displays.key(qobject_cast<Display*>(obj), -1);
+
+ if (key == -1) + if (key == -1)
+ return; + return;
+ +
@ -1286,7 +1245,7 @@ index 0000000..edfdff4
+#include "Server.moc" +#include "Server.moc"
diff --git a/src/daemon/xdmcp/Server.h b/src/daemon/xdmcp/Server.h diff --git a/src/daemon/xdmcp/Server.h b/src/daemon/xdmcp/Server.h
new file mode 100644 new file mode 100644
index 0000000..2898381 index 0000000..6f7bdae
--- /dev/null --- /dev/null
+++ b/src/daemon/xdmcp/Server.h +++ b/src/daemon/xdmcp/Server.h
@@ -0,0 +1,118 @@ @@ -0,0 +1,118 @@
@ -1381,7 +1340,7 @@ index 0000000..2898381
+ /** + /**
+ * Create a new display + * Create a new display
+ */ + */
+ Display *newDisplay(uint32_t sessionId, QString hostName, uint32_t displayNumber); + Display *newDisplay(uint32_t sessionId, const QString &hostName, uint32_t displayNumber);
+ Display *getDisplay(uint32_t id); + Display *getDisplay(uint32_t id);
+ QString status() const; + QString status() const;
+ QString hostname() const; + QString hostname() const;
@ -1410,10 +1369,10 @@ index 0000000..2898381
+#endif // SDDM_XDMCP_SERVER_H +#endif // SDDM_XDMCP_SERVER_H
diff --git a/src/daemon/xdmcp/Utils.cpp b/src/daemon/xdmcp/Utils.cpp diff --git a/src/daemon/xdmcp/Utils.cpp b/src/daemon/xdmcp/Utils.cpp
new file mode 100644 new file mode 100644
index 0000000..92e1d6a index 0000000..53ac7e3
--- /dev/null --- /dev/null
+++ b/src/daemon/xdmcp/Utils.cpp +++ b/src/daemon/xdmcp/Utils.cpp
@@ -0,0 +1,145 @@ @@ -0,0 +1,143 @@
+/* +/*
+ * Utilities for X Display Control Protocol + * Utilities for X Display Control Protocol
+ * Copyright (C) 2013 Martin Bříza <mbriza@redhat.com> + * Copyright (C) 2013 Martin Bříza <mbriza@redhat.com>
@ -1441,28 +1400,27 @@ index 0000000..92e1d6a
+namespace SDDM { +namespace SDDM {
+namespace XDMCP { +namespace XDMCP {
+ +
+ Reader::Reader(const QByteArray& data) + Reader::Reader(const QByteArray &data) : m_data(data),
+ : m_data(data) + m_stream(&m_data, QIODevice::ReadOnly | QIODevice::Unbuffered) {
+ , m_stream(&m_data, QIODevice::ReadOnly | QIODevice::Unbuffered) {
+ m_stream.setByteOrder(QDataStream::BigEndian); + m_stream.setByteOrder(QDataStream::BigEndian);
+ } + }
+ +
+ Reader& Reader::operator>>(uint8_t& byte) { + Reader& Reader::operator>>(uint8_t &byte) {
+ m_stream >> byte; + m_stream >> byte;
+ return *this; + return *this;
+ } + }
+ +
+ Reader& Reader::operator>>(uint16_t& word) { + Reader& Reader::operator>>(uint16_t &word) {
+ m_stream >> word; + m_stream >> word;
+ return *this; + return *this;
+ } + }
+ +
+ Reader& Reader::operator>>(uint32_t& doubleword) { + Reader& Reader::operator>>(uint32_t &doubleword) {
+ m_stream >> doubleword; + m_stream >> doubleword;
+ return *this; + return *this;
+ } + }
+ +
+ Reader& Reader::operator>>(QByteArray& array) { + Reader& Reader::operator>>(QByteArray &array) {
+ uint16_t arrayLen; + uint16_t arrayLen;
+ *this >> arrayLen; + *this >> arrayLen;
+ while (arrayLen--) { + while (arrayLen--) {
@ -1473,7 +1431,7 @@ index 0000000..92e1d6a
+ return *this; + return *this;
+ } + }
+ +
+ Reader& Reader::operator>>(QVector< uint16_t >& wordArray) { + Reader& Reader::operator>>(QVector< uint16_t > &wordArray) {
+ uint8_t arrayLen; + uint8_t arrayLen;
+ *this >> arrayLen; + *this >> arrayLen;
+ while (arrayLen--) { + while (arrayLen--) {
@ -1484,7 +1442,7 @@ index 0000000..92e1d6a
+ return *this; + return *this;
+ } + }
+ +
+ Reader& Reader::operator>>(QVector< QByteArray >& arrayOfArrays) { + Reader& Reader::operator>>(QVector< QByteArray > &arrayOfArrays) {
+ uint8_t arrayCount; + uint8_t arrayCount;
+ *this >> arrayCount; + *this >> arrayCount;
+ while (arrayCount--) { + while (arrayCount--) {
@ -1502,9 +1460,8 @@ index 0000000..92e1d6a
+ return false; + return false;
+ } + }
+ +
+ Writer::Writer() + Writer::Writer() : m_data(),
+ : m_data() + m_stream(&m_data, QIODevice::WriteOnly | QIODevice::Unbuffered) {
+ , m_stream(&m_data, QIODevice::WriteOnly | QIODevice::Unbuffered) {
+ m_stream.setByteOrder(QDataStream::BigEndian); + m_stream.setByteOrder(QDataStream::BigEndian);
+ } + }
+ +
@ -1524,23 +1481,23 @@ index 0000000..92e1d6a
+ return *this; + return *this;
+ } + }
+ +
+ Writer& Writer::operator<<(const QByteArray& array) { + Writer& Writer::operator<<(const QByteArray &array) {
+ *this << (uint16_t) array.count(); + *this << (uint16_t) array.count();
+ for (uint8_t c : array) + for (uint8_t c : array)
+ m_stream << c; + m_stream << c;
+ return *this; + return *this;
+ } + }
+ +
+ Writer& Writer::operator<<(const QVector< uint16_t >& wordArray) { + Writer& Writer::operator<<(const QVector< uint16_t > &wordArray) {
+ *this << (uint8_t) wordArray.count(); + *this << (uint8_t) wordArray.count();
+ for (const uint16_t& i : wordArray) + for (const uint16_t &i : wordArray)
+ *this << i; + *this << i;
+ return *this; + return *this;
+ } + }
+ +
+ Writer& Writer::operator<<(const QVector< QByteArray >& arrayOfArrays) { + Writer& Writer::operator<<(const QVector< QByteArray > &arrayOfArrays) {
+ *this << (uint16_t) arrayOfArrays.count(); + *this << (uint16_t) arrayOfArrays.count();
+ for (const QByteArray& i : arrayOfArrays) + for (const QByteArray &i : arrayOfArrays)
+ *this << i; + *this << i;
+ return *this; + return *this;
+ } + }
@ -1562,7 +1519,7 @@ index 0000000..92e1d6a
\ No newline at end of file \ No newline at end of file
diff --git a/src/daemon/xdmcp/Utils.h b/src/daemon/xdmcp/Utils.h diff --git a/src/daemon/xdmcp/Utils.h b/src/daemon/xdmcp/Utils.h
new file mode 100644 new file mode 100644
index 0000000..9457ef1 index 0000000..bd96708
--- /dev/null --- /dev/null
+++ b/src/daemon/xdmcp/Utils.h +++ b/src/daemon/xdmcp/Utils.h
@@ -0,0 +1,93 @@ @@ -0,0 +1,93 @@
@ -1609,12 +1566,12 @@ index 0000000..9457ef1
+ public: + public:
+ Reader(const QByteArray &data); + Reader(const QByteArray &data);
+ ~Reader() {} + ~Reader() {}
+ Reader& operator>>(uint8_t& byte); + Reader& operator>>(uint8_t &byte);
+ Reader& operator>>(uint16_t& word); + Reader& operator>>(uint16_t &word);
+ Reader& operator>>(uint32_t& doubleword); + Reader& operator>>(uint32_t &doubleword);
+ Reader& operator>>(QByteArray& array); + Reader& operator>>(QByteArray &array);
+ Reader& operator>>(QVector<uint16_t>& wordArray); + Reader& operator>>(QVector<uint16_t> &wordArray);
+ Reader& operator>>(QVector<QByteArray>& arrayOfArrays); + Reader& operator>>(QVector<QByteArray> &arrayOfArrays);
+ /** + /**
+ * Returns true if the stream is at its end and no errors occured + * Returns true if the stream is at its end and no errors occured
+ * + *
@ -1640,9 +1597,9 @@ index 0000000..9457ef1
+ Writer& operator<<(const uint8_t byte); + Writer& operator<<(const uint8_t byte);
+ Writer& operator<<(const uint16_t word); + Writer& operator<<(const uint16_t word);
+ Writer& operator<<(const uint32_t doubleword); + Writer& operator<<(const uint32_t doubleword);
+ Writer& operator<<(const QByteArray& array); + Writer& operator<<(const QByteArray &array);
+ Writer& operator<<(const QVector<uint16_t>& wordArray); + Writer& operator<<(const QVector<uint16_t> &wordArray);
+ Writer& operator<<(const QVector<QByteArray>& arrayOfArrays); + Writer& operator<<(const QVector<QByteArray> &arrayOfArrays);
+ /** + /**
+ * Finalizes building of the packet + * Finalizes building of the packet
+ * + *

File diff suppressed because it is too large Load Diff

@ -0,0 +1,14 @@
--- sddm-7a008602f5f0a4ed8586ce24012983458a687d4e/src/daemon/Authenticator.cpp.pam_end 2013-12-16 15:26:35.749298583 +0100
+++ sddm-7a008602f5f0a4ed8586ce24012983458a687d4e/src/daemon/Authenticator.cpp 2013-12-16 15:26:45.273274332 +0100
@@ -418,10 +418,9 @@ namespace SDDM {
if (m_pam) {
m_pam->result = pam_close_session(m_pam->handle, 0);
m_pam->result = pam_setcred(m_pam->handle, PAM_DELETE_CRED);
- // for some reason this has to be called here too
- pam_end(m_pam->handle, m_pam->result);
delete m_pam;
m_pam = nullptr;
+ daemonApp->exit(0); // until PAM is fixed, we have to restart the whole service with audit
}
#endif

@ -1,16 +0,0 @@
#%PAM-1.0
auth required pam_env.so
auth required pam_permit.so
auth include postlogin
account required pam_nologin.so
account include system-auth
password include system-auth
session required pam_selinux.so close
session required pam_loginuid.so
session optional pam_console.so
-session optional pam_ck_connector.so
session required pam_selinux.so open
session optional pam_keyinit.so force revoke
session required pam_namespace.so
session include system-auth
session include postlogin

@ -1,10 +0,0 @@
--- sddm-7a008602f5f0a4ed8586ce24012983458a687d4e/src/daemon/Display.cpp.savelast 2013-11-25 19:41:15.824359536 +0100
+++ sddm-7a008602f5f0a4ed8586ce24012983458a687d4e/src/daemon/Display.cpp 2013-11-25 19:41:58.793247508 +0100
@@ -77,6 +77,7 @@ namespace SDDM {
// connect login result signals
connect(this, SIGNAL(loginFailed(QLocalSocket*)), m_socketServer, SLOT(loginFailed(QLocalSocket*)));
connect(this, SIGNAL(loginSucceeded(QLocalSocket*)), m_socketServer, SLOT(loginSucceeded(QLocalSocket*)));
+ connect(this, SIGNAL(loginSucceeded(QLocalSocket*)), this, SLOT(slotLoginSucceeded(QLocalSocket*)));
// get auth dir
QString authDir = daemonApp->configuration()->authDir();

@ -3,7 +3,7 @@
Name: sddm Name: sddm
Version: 0.2.0 Version: 0.2.0
Release: 0.22.20131125git%(echo %{sddm_commit} | cut -c-8)%{?dist} Release: 0.23.20131125git%(echo %{sddm_commit} | cut -c-8)%{?dist}
# code GPLv2+, fedora theme CC-BY-SA # code GPLv2+, fedora theme CC-BY-SA
License: GPLv2+ and CC-BY-SA License: GPLv2+ and CC-BY-SA
Summary: QML based X11 desktop manager Summary: QML based X11 desktop manager
@ -20,8 +20,6 @@ Source12: sddm.service
# systesmd tmpfiles support for /var/run/sddm # systesmd tmpfiles support for /var/run/sddm
Source13: tmpfiles-sddm.conf Source13: tmpfiles-sddm.conf
Source14: sddm-passwordless.pam
# fedora theme files # fedora theme files
Source21: fedora-Main.qml Source21: fedora-Main.qml
Source22: fedora-metadata.desktop Source22: fedora-metadata.desktop
@ -31,9 +29,8 @@ Source23: fedora-theme.conf
Patch2: sddm-git.e707e229-session-list.patch Patch2: sddm-git.e707e229-session-list.patch
Patch3: sddm-0.2.0-0.11.20130914git50ca5b20-xdmcp.patch Patch3: sddm-0.2.0-0.11.20130914git50ca5b20-xdmcp.patch
# Don't end the PAM session twice
Patch4: sddm-auth.patch Patch4: sddm-pam_end.patch
Patch5: sddm-savelast.patch
Provides: service(graphical-login) = sddm Provides: service(graphical-login) = sddm
@ -74,10 +71,8 @@ A collection of sddm themes, including: circles, elarun, maldives, maui.
%setup -q -n %{name}-%{sddm_commit} %setup -q -n %{name}-%{sddm_commit}
%patch2 -p1 -b .session-list %patch2 -p1 -b .session-list
# disabled for now %patch3 -p1 -b .xdmcp
#%patch3 -p1 -b .xdmcp %patch4 -p1 -b .pam_end
%patch4 -p1 -b .auth
%patch5 -p1 -b .savelast
# get rid of the architecture flag # get rid of the architecture flag
sed -i "s/-march=native//" CMakeLists.txt sed -i "s/-march=native//" CMakeLists.txt
@ -99,7 +94,6 @@ install -Dpm 644 %{SOURCE10} %{buildroot}%{_sysconfdir}/sddm.conf
install -Dpm 644 %{SOURCE11} %{buildroot}%{_sysconfdir}/pam.d/sddm install -Dpm 644 %{SOURCE11} %{buildroot}%{_sysconfdir}/pam.d/sddm
install -Dpm 644 %{SOURCE12} %{buildroot}%{_unitdir}/sddm.service install -Dpm 644 %{SOURCE12} %{buildroot}%{_unitdir}/sddm.service
install -Dpm 644 %{SOURCE13} %{buildroot}%{_tmpfilesdir}/sddm.conf install -Dpm 644 %{SOURCE13} %{buildroot}%{_tmpfilesdir}/sddm.conf
install -Dpm 644 %{SOURCE14} %{buildroot}%{_sysconfdir}/pam.d/sddm-passwordless
mkdir -p %{buildroot}%{_localstatedir}/run/sddm mkdir -p %{buildroot}%{_localstatedir}/run/sddm
# install fedora theme # install fedora theme
@ -121,10 +115,8 @@ install -Dpm 644 %{SOURCE23} %{buildroot}%{_datadir}/apps/sddm/themes/fedora/the
%doc COPYING README.md CONTRIBUTORS %doc COPYING README.md CONTRIBUTORS
%config %{_sysconfdir}/sddm.conf %config %{_sysconfdir}/sddm.conf
%config(noreplace) %{_sysconfdir}/pam.d/sddm %config(noreplace) %{_sysconfdir}/pam.d/sddm
%config(noreplace) %{_sysconfdir}/pam.d/sddm-passwordless
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/org.freedesktop.DisplayManager.conf %config(noreplace) %{_sysconfdir}/dbus-1/system.d/org.freedesktop.DisplayManager.conf
%{_bindir}/sddm %{_bindir}/sddm
%{_bindir}/sddm-auth
%{_bindir}/sddm-greeter %{_bindir}/sddm-greeter
%{_tmpfilesdir}/sddm.conf %{_tmpfilesdir}/sddm.conf
%attr(0711,root,root) %dir %{_localstatedir}/run/sddm %attr(0711,root,root) %dir %{_localstatedir}/run/sddm
@ -150,6 +142,9 @@ install -Dpm 644 %{SOURCE23} %{buildroot}%{_datadir}/apps/sddm/themes/fedora/the
%{_datadir}/apps/sddm/themes/maui/ %{_datadir}/apps/sddm/themes/maui/
%changelog %changelog
* Mon Dec 16 2013 Martin Briza <mbriza@redhat.com> - 0.2.0-0.23.20131125git7a008602
- Revert all work done on authentication, doesn't support multiple logins right now
* Mon Nov 25 2013 Martin Briza <mbriza@redhat.com> - 0.2.0-0.22.20131125git7a008602 * Mon Nov 25 2013 Martin Briza <mbriza@redhat.com> - 0.2.0-0.22.20131125git7a008602
- Fix saving of last session and user - Fix saving of last session and user

Loading…
Cancel
Save