View | Details | Raw Unified | Return to bug 228116 | Differences between
and this patch

Collapse All | Expand All

(-)x11/sddm/Makefile (-12 / +13 lines)
Lines 1-14 Link Here
1
# $FreeBSD$
1
# $FreeBSD$
2
2
3
PORTNAME=	sddm
3
PORTNAME=	sddm
4
PORTVERSION=	0.14.0
4
PORTVERSION=	0.17.0
5
DISTVERSIONPREFIX=	v
5
DISTVERSIONPREFIX=	v
6
CATEGORIES=	x11
6
CATEGORIES=	x11
7
7
8
MAINTAINER=	kde@FreeBSD.org
8
MAINTAINER=	kde@FreeBSD.org
9
COMMENT=	QML based login manager
9
COMMENT=	QML based login manager
10
10
11
USES=		cmake:outsource desktop-file-utils kde:5
11
RUN_DEPENDS=	dbus-run-session:devel/dbus
12
13
USES=		cmake:outsource kde:5
12
USE_KDE=	ecm
14
USE_KDE=	ecm
13
USE_QT5=	concurrent core dbus gui linguisttools multimedia network \
15
USE_QT5=	concurrent core dbus gui linguisttools multimedia network \
14
		printsupport qml quick script sql webkit widgets \
16
		printsupport qml quick script sql webkit widgets \
Lines 18-29 USE_XORG= xcb Link Here
18
CMAKE_ARGS=	-DUID_MIN=1000 \
20
CMAKE_ARGS=	-DUID_MIN=1000 \
19
		-DUID_MAX=65000 \
21
		-DUID_MAX=65000 \
20
		-DCMAKE_INSTALL_SYSCONFDIR:PATH=${LOCALBASE}/etc
22
		-DCMAKE_INSTALL_SYSCONFDIR:PATH=${LOCALBASE}/etc
21
# We need to disable PAM at the moment and use the passwd-based backend;
22
# the two backend are mutually exclusive, and we have to investigate how
23
# to make it compatible with OpenPAM.
24
CMAKE_ARGS+=	-DENABLE_PAM:BOOL=FALSE
25
23
26
USE_RC_SUBR=	sddm
24
USE_RC_SUBR=	sddm
25
SUB_FILES=	xinitrc.desktop
27
26
28
USERS=		sddm
27
USERS=		sddm
29
GROUPS=		sddm
28
GROUPS=		sddm
Lines 31-46 GROUPS= sddm Link Here
31
USE_GITHUB=	yes
30
USE_GITHUB=	yes
32
31
33
post-patch:
32
post-patch:
34
# Patch in the correct location for X11 startup files, and make the session start
33
	@${REINPLACE_CMD} -e 's#/etc/X11#${LOCALBASE}/etc/X11#' \
35
# script of sddm use the value of ${STARTUP} defined by 90-consolekit
34
		-e 's#/usr/bin/#${LOCALBASE}/bin/#g' \
36
	${REINPLACE_CMD} -e 's#/etc/X11#${LOCALBASE}/etc/X11#g' \
35
		-e 's#/usr/share/#${LOCALBASE}/share/#' \
37
			 -e '/exec.*session/s#exec#exec $${STARTUP}#g' \
36
		${WRKSRC}/data/scripts/Xsession \
38
		${PATCH_WRKSRC}/data/scripts/Xsession
37
		${WRKSRC}/src/common/Configuration.h
39
38
40
post-install:
39
post-install:
40
	${MV} ${STAGEDIR}${PREFIX}/etc/sddm.conf \
41
		${STAGEDIR}${PREFIX}/etc/sddm.conf.sample
41
# Install xsession.desktop to launch .xinitrc via sddm.
42
# Install xsession.desktop to launch .xinitrc via sddm.
42
	${MKDIR} ${STAGEDIR}${PREFIX}/share/xsessions
43
	${MKDIR} ${STAGEDIR}${PREFIX}/share/xsessions
43
	${INSTALL_DATA} ${FILESDIR}/xinitrc.desktop ${STAGEDIR}${PREFIX}/share/xsessions
44
	${INSTALL_DATA} ${WRKDIR}/xinitrc.desktop ${STAGEDIR}${PREFIX}/share/xsessions
44
	${INSTALL_SCRIPT} ${FILESDIR}/xinit-session ${STAGEDIR}${PREFIX}/share/sddm/scripts
45
	${INSTALL_SCRIPT} ${FILESDIR}/xinit-session ${STAGEDIR}${PREFIX}/share/sddm/scripts
45
46
46
.include <bsd.port.mk>
47
.include <bsd.port.mk>
(-)x11/sddm/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1488014449
1
TIMESTAMP = 1525019041
2
SHA256 (sddm-sddm-v0.14.0_GH0.tar.gz) = a551551a6ba324e9c384c89bc63e871de65fea3740eadbea2d63df86045f8205
2
SHA256 (sddm-sddm-v0.17.0_GH0.tar.gz) = c6da2862688d21a091f1568b78a5f5900cd2e02a83dd42c016f0c5867e69a92d
3
SIZE (sddm-sddm-v0.14.0_GH0.tar.gz) = 3367582
3
SIZE (sddm-sddm-v0.17.0_GH0.tar.gz) = 3524362
(-)x11/sddm/files/patch-CMakeLists.txt (-7 / +7 lines)
Lines 1-16 Link Here
1
1) On FreeBSD X is normally started on VT9.
1
1) On FreeBSD X is normally started on VT9.
2
2) The shutdown command uses '-p' and not '-P' on FreeBSD.
2
2) The shutdown command uses '-p' and not '-P' on FreeBSD.
3
3
4
--- CMakeLists.txt.orig	2016-08-28 11:54:03 UTC
4
--- CMakeLists.txt.orig	2017-12-05 16:00:16 UTC
5
+++ CMakeLists.txt
5
+++ CMakeLists.txt
6
@@ -143,8 +143,8 @@ if(SYSTEMD_FOUND)
6
@@ -168,8 +168,8 @@ add_feature_info("elogind" ELOGIND_FOUND "elogind supp
7
     set(REBOOT_COMMAND "/usr/bin/systemctl reboot")
7
 
8
 else()
8
 # Default behaviour if neither systemd nor elogind is used
9
     set(SYSTEMD_FOUND 0)
9
 if (NOT ELOGIND_FOUND AND NOT SYSTEMD_FOUND)
10
-    set(MINIMUM_VT 7)
10
-    set(MINIMUM_VT 7)
11
-    set(HALT_COMMAND "/sbin/shutdown -h -P now")
11
-    set(HALT_COMMAND "/sbin/shutdown -h -P now")
12
+    set(MINIMUM_VT 9)
12
+    set(MINIMUM_VT 9)
13
+    set(HALT_COMMAND "/sbin/shutdown -h -p now")
13
+    set(HALT_COMMAND "/sbin/shutdown -p now")
14
     set(REBOOT_COMMAND "/sbin/shutdown -r now")
14
     set(REBOOT_COMMAND "/sbin/shutdown -r now")
15
 endif()
15
 endif()
16
 add_feature_info("systemd" SYSTEMD_FOUND "systemd support")
16
 
(-)x11/sddm/files/patch-data_scripts_Xsession (+23 lines)
Line 0 Link Here
1
Fix use of "$@" (see sh(1)).
2
3
There's no systemd on FreeBSD so start the session using $STARTUP which is
4
defined in 90-consolekit if ConsoleKit2 is installed.  By default this allows
5
local users to shutdown/reboot the machine and access devices like USB keys.
6
7
Also use dbus-run-session so libdbus doesn't have to autolauch the session bus
8
daemon on first use.  Autolaunched dbus daemons tend to linger and may only
9
exit if the X server exits.
10
11
--- data/scripts/Xsession.orig	2017-12-05 16:00:16 UTC
12
+++ data/scripts/Xsession
13
@@ -94,8 +94,8 @@ if [ -f "$USERXSESSION" ]; then
14
   . "$USERXSESSION"
15
 fi
16
 
17
-if [ -z "$@" ]; then
18
+if [ -z "$1" ]; then
19
     exec xmessage -center -buttons OK:0 -default OK "Sorry, $DESKTOP_SESSION is no valid session."
20
 else
21
-    exec $@
22
+    exec $STARTUP /usr/bin/dbus-run-session --dbus-daemon=/usr/bin/dbus-daemon -- "$@"
23
 fi
(-)x11/sddm/files/patch-services_sddm-autologin.pam (+23 lines)
Line 0 Link Here
1
--- services/sddm-autologin.pam.orig	2017-12-05 16:00:16 UTC
2
+++ services/sddm-autologin.pam
3
@@ -1,13 +1,9 @@
4
 #%PAM-1.0
5
-auth        required    pam_env.so
6
-auth        required    pam_tally.so file=/var/log/faillog onerr=succeed
7
-auth        required    pam_shells.so
8
-auth        required    pam_nologin.so
9
 auth        required    pam_permit.so
10
--auth       optional    pam_gnome_keyring.so
11
--auth       optional    pam_kwallet5.so
12
-account     include     system-local-login
13
-password    include     system-local-login
14
-session     include     system-local-login
15
--session    optional    pam_gnome_keyring.so auto_start
16
--session    optional    pam_kwallet5.so auto_start
17
+#auth       optional    pam_gnome_keyring.so
18
+#auth       optional    pam_kwallet5.so
19
+account     include     login
20
+password    required    pam_deny.so
21
+session     include     login
22
+#session    optional    pam_gnome_keyring.so auto_start
23
+#session    optional    pam_kwallet5.so auto_start
(-)x11/sddm/files/patch-services_sddm-greeter.pam (+19 lines)
Line 0 Link Here
1
--- services/sddm-greeter.pam.orig	2017-12-05 16:00:16 UTC
2
+++ services/sddm-greeter.pam
3
@@ -1,8 +1,5 @@
4
 #%PAM-1.0
5
 
6
-# Load environment from /etc/environment and ~/.pam_environment
7
-auth		required pam_env.so
8
-
9
 # Always let the greeter start without authentication
10
 auth		required pam_permit.so
11
 
12
@@ -13,6 +10,4 @@ account		required pam_permit.so
13
 password	required pam_deny.so
14
 
15
 # Setup session
16
-session		required pam_unix.so
17
--session		optional pam_systemd.so
18
--session		optional pam_elogind.so
19
+session		required pam_permit.so
(-)x11/sddm/files/patch-services_sddm.pam (+27 lines)
Line 0 Link Here
1
--- services/sddm.pam.orig	2017-12-05 16:00:16 UTC
2
+++ services/sddm.pam
3
@@ -1,15 +1,14 @@
4
 #%PAM-1.0
5
 
6
-auth		include		system-login
7
--auth		optional	pam_gnome_keyring.so
8
--auth   optional  pam_kwallet5.so
9
+auth		include		login
10
+#auth		optional	pam_gnome_keyring.so
11
+#auth		optional	pam_kwallet5.so
12
 
13
-account		include		system-login
14
+account		include		login
15
 
16
-password	include		system-login
17
--password	optional	pam_gnome_keyring.so use_authtok
18
+password	include		login
19
+#password	optional	pam_gnome_keyring.so use_authtok
20
 
21
-session		optional	pam_keyinit.so force revoke
22
-session		include		system-login
23
--session		optional	pam_gnome_keyring.so auto_start
24
--session  optional  pam_kwallet5.so auto_start
25
+session 	include		login
26
+#session 	optional	pam_gnome_keyring.so auto_start
27
+#session 	optional	pam_kwallet5.so auto_start
(-)x11/sddm/files/patch-src_common_Configuration.h (-30 / +28 lines)
Lines 1-38 Link Here
1
Modify the default configuration to fit in to FreeBSD. That is replace '/usr/bin'
1
Leave InputMethod empty by default since qtvirtualkeyboard does not appear to
2
with '/usr/local/bin' and so on.
2
be supported by the included themes.  The keyboard is drawn on top of the
3
The setting of '$PATH' I find a bit dumb... this should respect the values of the
3
login screen and has to be clicked away (button lower-right).
4
users profile...
5
4
6
--- src/common/Configuration.h.orig	2016-08-28 11:54:03 UTC
5
Set the default theme and cursor theme to breeze, because sddm is most likely
6
used together with Plasma.  If they aren't available sddm falls back to a
7
compiled-in theme.
8
9
--- src/common/Configuration.h.orig	2017-12-05 16:00:16 UTC
7
+++ src/common/Configuration.h
10
+++ src/common/Configuration.h
8
@@ -58,11 +58,11 @@ namespace SDDM {
11
@@ -42,14 +42,14 @@ namespace SDDM {
9
 
12
         Entry(Numlock,             NumState,    NUM_NONE,                                       _S("Initial NumLock state. Can be on, off or none.\n"
10
         // TODO: Not absolutely sure if everything belongs here. Xsessions, VT and probably some more seem universal
13
                                                                                                    "If property is set to none, numlock won't be changed\n"
11
         Section(X11,
14
                                                                                                    "NOTE: Currently ignored if autologin is enabled."));
12
-            Entry(ServerPath,          QString,     _S("/usr/bin/X"),                           _S("Path to X server binary"));
15
-        Entry(InputMethod,         QString,     QStringLiteral("qtvirtualkeyboard"),                   _S("Input method module"));
13
+            Entry(ServerPath,          QString,     _S("/usr/local/bin/X"),                           _S("Path to X server binary"));
16
+        Entry(InputMethod,         QString,     QString(),                                      _S("Input method module"));
14
             Entry(ServerArguments,     QString,     _S("-nolisten tcp"),                        _S("Arguments passed to the X server invocation"));
17
         //  Name   Entries (but it's a regular class again)
15
-            Entry(XephyrPath,          QString,     _S("/usr/bin/Xephyr"),                      _S("Path to Xephyr binary"));
18
         Section(Theme,
16
-            Entry(XauthPath,           QString,     _S("/usr/bin/xauth"),                       _S("Path to xauth binary"));
19
             Entry(ThemeDir,            QString,     _S(DATA_INSTALL_DIR "/themes"),             _S("Theme directory path"));
17
-            Entry(SessionDir,          QString,     _S("/usr/share/xsessions"),                 _S("Directory containing available X sessions"));
20
-            Entry(Current,             QString,     _S(""),                                     _S("Current theme name"));
18
+            Entry(XephyrPath,          QString,     _S("/usr/local/bin/Xephyr"),                      _S("Path to Xephyr binary"));
21
+            Entry(Current,             QString,     _S("breeze"),                               _S("Current theme name"));
19
+            Entry(XauthPath,           QString,     _S("/usr/local/bin/xauth"),                       _S("Path to xauth binary"));
22
             Entry(FacesDir,            QString,     _S(DATA_INSTALL_DIR "/faces"),              _S("Global directory for user avatars\n"
20
+            Entry(SessionDir,          QString,     _S("/usr/local/share/xsessions"),                 _S("Directory containing available X sessions"));
23
                                                                                                    "The files should be named <username>.face.icon"));
21
             Entry(SessionCommand,      QString,     _S(SESSION_COMMAND),                        _S("Path to a script to execute when starting the desktop session"));
24
-            Entry(CursorTheme,         QString,     QString(),                                  _S("Cursor theme used in the greeter"));
22
 	    Entry(SessionLogFile,      QString,     _S(".local/share/sddm/xorg-session.log"),   _S("Path to the user session log file"));
25
+            Entry(CursorTheme,         QString,     _S("breeze_cursors"),                       _S("Cursor theme used in the greeter"));
23
 	    Entry(UserAuthFile,        QString,     _S(".Xauthority"),                          _S("Path to the Xauthority file"));
26
             Entry(EnableAvatars,       bool,        true,                                       _S("Enable display of custom user avatars"));
24
@@ -72,13 +72,13 @@ namespace SDDM {
27
             Entry(DisableAvatarsThreshold,int,      7,                                          _S("Number of users to use as threshold\n"
28
                                                                                                    "above which avatars are disabled\n"
29
@@ -80,7 +80,7 @@ namespace SDDM {
25
         );
30
         );
26
 
31
 
27
         Section(Wayland,
28
-            Entry(SessionDir,          QString,     _S("/usr/share/wayland-sessions"),          _S("Directory containing available Wayland sessions"));
29
+            Entry(SessionDir,          QString,     _S("/usr/local/share/wayland-sessions"),          _S("Directory containing available Wayland sessions"));
30
             Entry(SessionCommand,      QString,     _S(WAYLAND_SESSION_COMMAND),                _S("Path to a script to execute when starting the desktop session"));
31
 	    Entry(SessionLogFile,      QString,     _S(".local/share/sddm/wayland-session.log"),_S("Path to the user session log file"));
32
         );
33
 
34
         Section(Users,
32
         Section(Users,
35
-            Entry(DefaultPath,         QString,     _S("/bin:/usr/bin:/usr/local/bin"),         _S("Default $PATH for logged in users"));
33
-            Entry(DefaultPath,         QString,     _S("/usr/local/bin:/usr/bin:/bin"),         _S("Default $PATH for logged in users"));
36
+            Entry(DefaultPath,         QString,     _S("/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"),         _S("Default $PATH for logged in users"));
34
+            Entry(DefaultPath,         QString,     _S("/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"),         _S("Default $PATH for logged in users"));
37
             Entry(MinimumUid,          int,         UID_MIN,                                    _S("Minimum user id for displayed users"));
35
             Entry(MinimumUid,          int,         UID_MIN,                                    _S("Minimum user id for displayed users"));
38
             Entry(MaximumUid,          int,         UID_MAX,                                    _S("Maximum user id for displayed users"));
36
             Entry(MaximumUid,          int,         UID_MAX,                                    _S("Maximum user id for displayed users"));
(-)x11/sddm/files/patch-src_daemon_CMakeLists.txt (-14 / +4 lines)
Lines 1-19 Link Here
1
This patch does two things:
1
Remove VirtualTerminal.cpp from the sources that need to be built.
2
1) Add the include directories for 'libxcb' to the compiler search directories,
2
See also 'patch-src_daemon_Display.cpp'.
3
2) Remove VirtualTerminal.cpp from the sources that need to be built.
4
   see also 'patch-src_daemon_Display.cpp'
5
3
6
--- src/daemon/CMakeLists.txt.orig	2016-08-28 11:54:03 UTC
4
--- src/daemon/CMakeLists.txt.orig	2017-12-05 16:00:16 UTC
7
+++ src/daemon/CMakeLists.txt
5
+++ src/daemon/CMakeLists.txt
8
@@ -3,6 +3,7 @@ include_directories(
6
@@ -29,7 +29,6 @@ set(DAEMON_SOURCES
9
     "${CMAKE_SOURCE_DIR}/src/auth"
10
 )
11
 include_directories("${CMAKE_BINARY_DIR}/src/common")
12
+include_directories("${LIBXCB_INCLUDE_DIR}")
13
 
14
 set(DAEMON_SOURCES
15
     ${CMAKE_SOURCE_DIR}/src/common/Configuration.cpp
16
@@ -26,7 +27,6 @@ set(DAEMON_SOURCES
17
     SeatManager.cpp
7
     SeatManager.cpp
18
     SignalHandler.cpp
8
     SignalHandler.cpp
19
     SocketServer.cpp
9
     SocketServer.cpp
(-)x11/sddm/files/patch-src_daemon_DaemonApp.cpp (+22 lines)
Line 0 Link Here
1
On FreeBSD console-kit-daemon isn't started by the init system, so try to
2
start it from sddm.
3
4
--- src/daemon/DaemonApp.cpp.orig	2017-12-05 16:00:16 UTC
5
+++ src/daemon/DaemonApp.cpp
6
@@ -28,6 +28,7 @@
7
 
8
 #include "MessageHandler.h"
9
 
10
+#include <QDBusConnectionInterface>
11
 #include <QDebug>
12
 #include <QHostInfo>
13
 #include <QTimer>
14
@@ -48,6 +49,8 @@ namespace SDDM {
15
 
16
         // set testing parameter
17
         m_testing = (arguments().indexOf(QStringLiteral("--test-mode")) != -1);
18
+
19
+        QDBusConnection::systemBus().interface()->startService(QStringLiteral("org.freedesktop.ConsoleKit"));
20
 
21
         // create display manager
22
         m_displayManager = new DisplayManager(this);
(-)x11/sddm/files/patch-src_daemon_Display.cpp (-3 / +22 lines)
Lines 2-8 VirtualTerminal for Wayland is only present on Linux a Link Here
2
As we are only interested in an X11 session at the moment, we therefore
2
As we are only interested in an X11 session at the moment, we therefore
3
can hide it behind a Q_OS_LINUX.
3
can hide it behind a Q_OS_LINUX.
4
4
5
--- src/daemon/Display.cpp.orig	2016-08-28 11:54:03 UTC
5
Only set XDG_CURRENT_DESKTOP and XDG_SESSION_DESKTOP if the xsession .desktop
6
file defines DesktopNames.  Our xinitrc.desktop does not set it because that
7
may confuse the desktop session started from ~/.xinitrc.  These environment
8
variables are used for OnlyShowIn and NotShowIn in .desktop files.
9
10
--- src/daemon/Display.cpp.orig	2017-12-05 16:00:16 UTC
6
+++ src/daemon/Display.cpp
11
+++ src/daemon/Display.cpp
7
@@ -30,7 +30,9 @@
12
@@ -30,7 +30,9 @@
8
 #include "Greeter.h"
13
 #include "Greeter.h"
Lines 14-20 can hide it behind a Q_OS_LINUX. Link Here
14
 
19
 
15
 #include <QDebug>
20
 #include <QDebug>
16
 #include <QFile>
21
 #include <QFile>
17
@@ -280,8 +282,10 @@ namespace SDDM {
22
@@ -310,8 +312,10 @@ namespace SDDM {
18
 
23
 
19
         // create new VT for Wayland sessions otherwise use greeter vt
24
         // create new VT for Wayland sessions otherwise use greeter vt
20
         int vt = terminalId();
25
         int vt = terminalId();
Lines 25-31 can hide it behind a Q_OS_LINUX. Link Here
25
         m_lastSession.setVt(vt);
30
         m_lastSession.setVt(vt);
26
 
31
 
27
         QProcessEnvironment env;
32
         QProcessEnvironment env;
28
@@ -321,9 +325,11 @@ namespace SDDM {
33
@@ -321,11 +325,13 @@ namespace SDDM {
34
         env.insert(QStringLiteral("XDG_SEAT_PATH"), daemonApp->displayManager()->seatPath(seat()->name()));
35
         env.insert(QStringLiteral("XDG_SESSION_PATH"), daemonApp->displayManager()->sessionPath(QStringLiteral("Session%1").arg(daemonApp->newSessionId())));
36
         env.insert(QStringLiteral("DESKTOP_SESSION"), session.desktopSession());
37
+        if (!session.desktopNames().isEmpty())
38
         env.insert(QStringLiteral("XDG_CURRENT_DESKTOP"), session.desktopNames());
39
         env.insert(QStringLiteral("XDG_SESSION_CLASS"), QStringLiteral("user"));
40
         env.insert(QStringLiteral("XDG_SESSION_TYPE"), session.xdgSessionType());
41
         env.insert(QStringLiteral("XDG_SEAT"), seat()->name());
42
 
43
+        if (!session.desktopNames().isEmpty())
44
         env.insert(QStringLiteral("XDG_SESSION_DESKTOP"), session.desktopNames());
45
         if (seat()->name() == QLatin1String("seat0")) {
46
             env.insert(QStringLiteral("XDG_VTNR"), QString::number(vt));
47
@@ -366,9 +372,11 @@ namespace SDDM {
29
                 stateConfig.Last.Session.setDefault();
48
                 stateConfig.Last.Session.setDefault();
30
             stateConfig.save();
49
             stateConfig.save();
31
 
50
 
(-)x11/sddm/files/patch-src_daemon_LogindDBusTypes.cpp (+13 lines)
Line 0 Link Here
1
Disable ConsoleKit seat management for now.  It is mistakenly assumed to have
2
the same D-Bus interface as logind.
3
4
--- src/daemon/LogindDBusTypes.cpp.orig	2017-12-05 16:00:16 UTC
5
+++ src/daemon/LogindDBusTypes.cpp
6
@@ -58,6 +58,7 @@ LogindPathInternal::LogindPathInternal()
7
         return;
8
     }
9
 
10
+    if (0)
11
     if (QDBusConnection::systemBus().interface()->isServiceRegistered(QStringLiteral("org.freedesktop.ConsoleKit"))) {
12
         qDebug() << "Console kit interface found";
13
         available = true;
(-)x11/sddm/files/patch-src_daemon_SignalHandler.cpp (+45 lines)
Line 0 Link Here
1
From 62d776518594f517dc59de3c87e53afdda339079 Mon Sep 17 00:00:00 2001
2
From: Romain Labolle <ravomavain@gmail.com>
3
Date: Sat, 3 Mar 2018 22:09:30 +0100
4
Subject: [PATCH] Add SOCK_CLOEXEC to signal handling sockets
5
6
SDDM is currennty leaking 8 sockets file descriptors to the user session.
7
Adding the CLOEXEC flag to the fd to avoid thoses leaks.
8
---
9
 src/daemon/SignalHandler.cpp | 8 ++++----
10
 1 file changed, 4 insertions(+), 4 deletions(-)
11
12
diff --git a/src/daemon/SignalHandler.cpp b/src/daemon/SignalHandler.cpp
13
index 5c536603..3054e635 100644
14
--- src/daemon/SignalHandler.cpp.orig	2017-12-05 16:00:16 UTC
15
+++ src/daemon/SignalHandler.cpp
16
@@ -34,25 +34,25 @@ namespace SDDM {
17
     int sigusr1Fd[2];
18
 
19
     SignalHandler::SignalHandler(QObject *parent) : QObject(parent) {
20
-        if (::socketpair(AF_UNIX, SOCK_STREAM, 0, sighupFd))
21
+        if (::socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sighupFd))
22
             qCritical() << "Failed to create socket pair for SIGHUP handling.";
23
 
24
         snhup = new QSocketNotifier(sighupFd[1], QSocketNotifier::Read, this);
25
         connect(snhup, SIGNAL(activated(int)), this, SLOT(handleSighup()));
26
 
27
-        if (::socketpair(AF_UNIX, SOCK_STREAM, 0, sigintFd))
28
+        if (::socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sigintFd))
29
             qCritical() << "Failed to create socket pair for SIGINT handling.";
30
 
31
         snint = new QSocketNotifier(sigintFd[1], QSocketNotifier::Read, this);
32
         connect(snint, SIGNAL(activated(int)), this, SLOT(handleSigint()));
33
 
34
-        if (::socketpair(AF_UNIX, SOCK_STREAM, 0, sigtermFd))
35
+        if (::socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sigtermFd))
36
             qCritical() << "Failed to create socket pair for SIGTERM handling.";
37
 
38
         snterm = new QSocketNotifier(sigtermFd[1], QSocketNotifier::Read, this);
39
         connect(snterm, SIGNAL(activated(int)), this, SLOT(handleSigterm()));
40
 
41
-        if (::socketpair(AF_UNIX, SOCK_STREAM, 0, sigusr1Fd))
42
+        if (::socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sigusr1Fd))
43
             qCritical() << "Failed to create socket pair for SIGUSR1 handling.";
44
 
45
         snusr1 = new QSocketNotifier(sigusr1Fd[1], QSocketNotifier::Read, this);
(-)x11/sddm/files/patch-src_greeter_UserModel.cpp (-4 / +4 lines)
Lines 1-12 Link Here
1
Call 'setpwent' to rewind to the beginning of the passwd database.
1
Call 'setpwent' to rewind to the beginning of the passwd database.
2
2
3
--- src/greeter/UserModel.cpp.orig	2016-07-10 21:26:13 UTC
3
--- src/greeter/UserModel.cpp.orig	2017-12-05 16:00:16 UTC
4
+++ src/greeter/UserModel.cpp
4
+++ src/greeter/UserModel.cpp
5
@@ -55,6 +55,7 @@ namespace SDDM {
5
@@ -55,6 +55,7 @@ namespace SDDM {
6
         const QString defaultFace = QStringLiteral("%1/.face.icon").arg(facesDir);
6
         const QString defaultFace = QStringLiteral("file://%1/.face.icon").arg(facesDir);
7
7
 
8
         struct passwd *current_pw;
8
         struct passwd *current_pw;
9
+        setpwent();
9
+        setpwent();
10
         while ((current_pw = getpwent()) != nullptr) {
10
         while ((current_pw = getpwent()) != nullptr) {
11
11
 
12
             // skip entries with uids smaller than minimum uid
12
             // skip entries with uids smaller than minimum uid
(-)x11/sddm/files/patch-src_helper_HelperApp.cpp (+48 lines)
Line 0 Link Here
1
--- src/helper/HelperApp.cpp.orig	2017-12-05 16:00:16 UTC
2
+++ src/helper/HelperApp.cpp
3
@@ -33,8 +33,11 @@
4
 #include <iostream>
5
 #include <unistd.h>
6
 #include <sys/socket.h>
7
+#include <sys/time.h>
8
 
9
+#if defined(Q_OS_LINUX)
10
 #include <utmp.h>
11
+#endif
12
 #include <utmpx.h>
13
 #include <QByteArray>
14
 
15
@@ -301,12 +304,20 @@ namespace SDDM {
16
 
17
         // append to failed login database btmp
18
         if (!authSuccessful) {
19
+#if defined(Q_OS_FREEBSD)
20
+            pututxline(&entry);
21
+#else
22
             updwtmpx("/var/log/btmp", &entry);
23
+#endif
24
         }
25
 
26
         // append to wtmp
27
         else {
28
+#if defined(Q_OS_FREEBSD)
29
+            pututxline(&entry);
30
+#else
31
             updwtmpx("/var/log/wtmp", &entry);
32
+#endif
33
         }
34
     }
35
 
36
@@ -342,8 +353,12 @@ namespace SDDM {
37
             qWarning() << "Failed to write utmpx: " << strerror(errno);
38
         endutxent();
39
 
40
+#if defined(Q_OS_FREEBSD)
41
+        pututxline(&entry);
42
+#else
43
         // append to wtmp
44
         updwtmpx("/var/log/wtmp", &entry);
45
+#endif
46
     }
47
 }
48
 
(-)x11/sddm/files/patch-src_helper_UserSession.cpp (-9 / +21 lines)
Lines 1-12 Link Here
1
Include '<errno.h>' as 'errno' is used.
1
Run sddm-greeter via the session command (Xsession script) so it also gets X
2
resources and a ConsoleKit and D-Bus session.  The ConsoleKit session has its
3
session-class set to "user" instead of "greeter" because ck-launch-session
4
doesn't provide a way to change this.  ConsoleKit doesn't do anything with
5
this value though so it is believed to be harmless.  The XDG_SESSION_CLASS
6
environment variable does have the value "greeter".
2
7
3
--- src/helper/UserSession.cpp.orig	2016-07-06 14:00:10 UTC
8
Remove double quotes because we fixed the use of "$@" in the script.
9
10
--- src/helper/UserSession.cpp.orig	2017-12-05 16:00:16 UTC
4
+++ src/helper/UserSession.cpp
11
+++ src/helper/UserSession.cpp
5
@@ -25,6 +25,7 @@
12
@@ -45,10 +45,8 @@ namespace SDDM {
13
     bool UserSession::start() {
14
         QProcessEnvironment env = qobject_cast<HelperApp*>(parent())->session()->processEnvironment();
6
 
15
 
7
 #include <sys/types.h>
16
-        if (env.value(QStringLiteral("XDG_SESSION_CLASS")) == QLatin1String("greeter")) {
8
 #include <sys/ioctl.h>
17
-            QProcess::start(m_path);
9
+#include <errno.h>
18
-        } else if (env.value(QStringLiteral("XDG_SESSION_TYPE")) == QLatin1String("x11")) {
10
 #include <unistd.h>
19
-            const QString cmd = QStringLiteral("%1 \"%2\"").arg(mainConfig.X11.SessionCommand.get()).arg(m_path);
11
 #include <pwd.h>
20
+        if (env.value(QStringLiteral("XDG_SESSION_TYPE")) == QLatin1String("x11")) {
12
 #include <grp.h>
21
+            const QString cmd = QStringLiteral("%1 %2").arg(mainConfig.X11.SessionCommand.get()).arg(m_path);
22
             qInfo() << "Starting:" << cmd;
23
             QProcess::start(cmd);
24
         } else if (env.value(QStringLiteral("XDG_SESSION_TYPE")) == QLatin1String("wayland")) {
(-)x11/sddm/files/patch-src_helper_backend_PasswdBackend.cpp (-46 lines)
Lines 1-46 Link Here
1
Implement password authentication on FreeBSD.
2
This needs review :)
3
4
--- src/helper/backend/PasswdBackend.cpp.orig	2016-07-06 14:00:10 UTC
5
+++ src/helper/backend/PasswdBackend.cpp
6
@@ -27,8 +27,13 @@
7
 
8
 #include <sys/types.h>
9
 #include <pwd.h>
10
+#if defined(Q_OS_LINUX)
11
 #include <shadow.h>
12
 #include <crypt.h>
13
+#endif
14
+#if defined(Q_OS_FREEBSD)
15
+#include <unistd.h>
16
+#endif
17
 
18
 namespace SDDM {
19
     PasswdBackend::PasswdBackend(HelperApp *parent)
20
@@ -72,6 +77,17 @@ namespace SDDM {
21
             return false;
22
         }
23
 
24
+#if defined(Q_OS_FREEBSD)
25
+        if (!*pw->pw_passwd)
26
+        {
27
+            //empty password
28
+            return true;
29
+        }
30
+        char *crypted = crypt(qPrintable(password), pw->pw_passwd);
31
+        if (0 == strcmp(crypted, pw->pw_passwd)) {
32
+            return true;
33
+        }
34
+#else
35
         struct spwd *spw = getspnam(pw->pw_name);
36
         if (!spw) {
37
             qWarning() << "[Passwd] Could get passwd but not shadow";
38
@@ -85,7 +101,7 @@ namespace SDDM {
39
         if (0 == strcmp(crypted, spw->sp_pwdp)) {
40
             return true;
41
         }
42
-
43
+#endif
44
         m_app->error(QStringLiteral("Wrong user/password combination"), Auth::ERROR_AUTHENTICATION);
45
         return false;
46
     }
(-)x11/sddm/files/sddm.in (-25 / +5 lines)
Lines 16-45 rcvar=sddm_enable Link Here
16
16
17
load_rc_config ${name}
17
load_rc_config ${name}
18
18
19
: ${sddm_enable="NO"}
19
: ${sddm_lang="en_US"} # .UTF-8 suffix will be added later to comply with locale format
20
: ${sddm_lang="en_US"} # .UTF-8 suffix will be added later to comply with locale format
20
21
21
command="/usr/local/bin/sddm"
22
command="%%PREFIX%%/bin/sddm"
22
pidfile="/var/run/sddm.pid"
23
start_cmd="sddm_start"
23
start_cmd="sddm_start"
24
stop_cmd="sddm_stop"
25
24
26
# Creates /etc/sddm.conf after `sddm --example-config` if it's not there already.
27
sddm_genconf()
28
{
29
	if [ ! -r /etc/sddm.conf ]; then
30
		echo "Generating SDDM configuration."
31
		${command} --example-config > /etc/sddm.conf
32
	fi
33
}
34
35
sddm_start()
25
sddm_start()
36
{
26
{
37
	echo "Starting ${name}."
27
	echo "Starting ${name}."
38
	local iter
28
	local iter
39
	sddm_genconf
40
29
41
	( iter=0
30
	( iter=0
42
	while ! ps -axoargs | grep "^/usr/libexec/getty" | grep -qv grep > /dev/null 2>&1; do
31
	while ! pgrep -f "^/usr/libexec/getty " > /dev/null; do
43
		if [ ${iter} -eq 60 ]; then
32
		if [ ${iter} -eq 60 ]; then
44
			break
33
			break
45
		fi
34
		fi
Lines 48-75 sddm_start() Link Here
48
	done
37
	done
49
38
50
	if checkyesno hald_enable; then
39
	if checkyesno hald_enable; then
51
		if [ ! -x /usr/local/sbin/hald ]; then
40
		if [ ! -x %%LOCALBASE%%/sbin/hald ]; then
52
			err 1 "Hald does not seem to be installed."
41
			err 1 "Hald does not seem to be installed."
53
		fi
42
		fi
54
43
55
		iter=0
44
		iter=0
56
		while [ ${iter} -lt 60 ] &&
45
		while [ ${iter} -lt 60 ] &&
57
			!pgrep -f "^/usr/local/sbin/hald" > /dev/null 2>&1; do
46
			! pgrep -f "^%%LOCALBASE%%/sbin/hald" > /dev/null; do
58
			sleep 1
47
			sleep 1
59
			iter=$((${iter} + 1))
48
			iter=$((${iter} + 1))
60
		done
49
		done
61
	fi
50
	fi
62
51
63
	LANG=${sddm_lang}.UTF-8 ${command} ${sddm_flags} ) &
52
	LANG=${sddm_lang}.UTF-8 ${command} ${sddm_flags} ) &
64
}
65
66
# Only takes the user back to the sddm screen when run from X
67
sddm_stop()
68
{
69
	echo "Stopping ${name}."
70
	/bin/kill -9 $(/bin/cat "${pidfile}")
71
	pkill -9 -U ${name}
72
	pkill -9 X
73
}
53
}
74
54
75
run_rc_command "$1"
55
run_rc_command "$1"
(-)x11/sddm/files/xinitrc.desktop (-7 lines)
Lines 1-7 Link Here
1
[Desktop Entry]
2
Encoding=UTF-8
3
Type=XSession
4
Exec=/usr/local/share/sddm/scripts/xinit-session
5
TryExec=/usr/local/share/sddm/scripts/xinit-session
6
DesktopNames=User Session
7
Name=User Session
(-)x11/sddm/files/xinitrc.desktop.in (-3 / +2 lines)
Lines 1-7 Link Here
1
[Desktop Entry]
1
[Desktop Entry]
2
Encoding=UTF-8
2
Encoding=UTF-8
3
Type=XSession
3
Type=XSession
4
Exec=/usr/local/share/sddm/scripts/xinit-session
4
Exec=%%PREFIX%%/share/sddm/scripts/xinit-session
5
TryExec=/usr/local/share/sddm/scripts/xinit-session
5
TryExec=%%PREFIX%%/share/sddm/scripts/xinit-session
6
DesktopNames=User Session
7
Name=User Session
6
Name=User Session
(-)x11/sddm/pkg-plist (-1 / +20 lines)
Lines 4-10 etc/dbus-1/system.d/org.freedesktop.DisplayManager.con Link Here
4
etc/pam.d/sddm
4
etc/pam.d/sddm
5
etc/pam.d/sddm-autologin
5
etc/pam.d/sddm-autologin
6
etc/pam.d/sddm-greeter
6
etc/pam.d/sddm-greeter
7
etc/sddm.conf
7
@sample etc/sddm.conf.sample
8
%%QT_QMLDIR%%/SddmComponents/Background.qml
8
%%QT_QMLDIR%%/SddmComponents/Background.qml
9
%%QT_QMLDIR%%/SddmComponents/Button.qml
9
%%QT_QMLDIR%%/SddmComponents/Button.qml
10
%%QT_QMLDIR%%/SddmComponents/Clock.qml
10
%%QT_QMLDIR%%/SddmComponents/Clock.qml
Lines 132-164 libexec/sddm-helper Link Here
132
%%DATADIR%%/themes/maldives/metadata.desktop
132
%%DATADIR%%/themes/maldives/metadata.desktop
133
%%DATADIR%%/themes/maldives/rectangle.png
133
%%DATADIR%%/themes/maldives/rectangle.png
134
%%DATADIR%%/themes/maldives/theme.conf
134
%%DATADIR%%/themes/maldives/theme.conf
135
%%DATADIR%%/themes/maya/LICENSE
136
%%DATADIR%%/themes/maya/Main.qml
137
%%DATADIR%%/themes/maya/README
138
%%DATADIR%%/themes/maya/components/SpButton.qml
139
%%DATADIR%%/themes/maya/components/SpClock.qml
140
%%DATADIR%%/themes/maya/fonts/OpenSans_CondLight.ttf
141
%%DATADIR%%/themes/maya/images/ic_arrow_drop_down_white_24px.svg
142
%%DATADIR%%/themes/maya/images/ic_power_settings_new_white_24px.svg
143
%%DATADIR%%/themes/maya/images/ic_refresh_white_24px.svg
144
%%DATADIR%%/themes/maya/images/ic_warning_white_24px.svg
145
%%DATADIR%%/themes/maya/metadata.desktop
146
%%DATADIR%%/themes/maya/screenshots/hi_IN.png
147
%%DATADIR%%/themes/maya/theme.conf
135
%%DATADIR%%/translations/ar.qm
148
%%DATADIR%%/translations/ar.qm
136
%%DATADIR%%/translations/ca.qm
149
%%DATADIR%%/translations/ca.qm
137
%%DATADIR%%/translations/cs.qm
150
%%DATADIR%%/translations/cs.qm
151
%%DATADIR%%/translations/da.qm
138
%%DATADIR%%/translations/de.qm
152
%%DATADIR%%/translations/de.qm
139
%%DATADIR%%/translations/es.qm
153
%%DATADIR%%/translations/es.qm
140
%%DATADIR%%/translations/et.qm
154
%%DATADIR%%/translations/et.qm
141
%%DATADIR%%/translations/fi.qm
155
%%DATADIR%%/translations/fi.qm
142
%%DATADIR%%/translations/fr.qm
156
%%DATADIR%%/translations/fr.qm
157
%%DATADIR%%/translations/hi_IN.qm
143
%%DATADIR%%/translations/hu.qm
158
%%DATADIR%%/translations/hu.qm
144
%%DATADIR%%/translations/it.qm
159
%%DATADIR%%/translations/it.qm
145
%%DATADIR%%/translations/ja.qm
160
%%DATADIR%%/translations/ja.qm
161
%%DATADIR%%/translations/kk.qm
146
%%DATADIR%%/translations/ko.qm
162
%%DATADIR%%/translations/ko.qm
147
%%DATADIR%%/translations/lt.qm
163
%%DATADIR%%/translations/lt.qm
148
%%DATADIR%%/translations/lv.qm
164
%%DATADIR%%/translations/lv.qm
149
%%DATADIR%%/translations/nb.qm
165
%%DATADIR%%/translations/nb.qm
166
%%DATADIR%%/translations/nl.qm
150
%%DATADIR%%/translations/nn.qm
167
%%DATADIR%%/translations/nn.qm
151
%%DATADIR%%/translations/pl.qm
168
%%DATADIR%%/translations/pl.qm
152
%%DATADIR%%/translations/pt_BR.qm
169
%%DATADIR%%/translations/pt_BR.qm
153
%%DATADIR%%/translations/pt_PT.qm
170
%%DATADIR%%/translations/pt_PT.qm
154
%%DATADIR%%/translations/ro.qm
171
%%DATADIR%%/translations/ro.qm
155
%%DATADIR%%/translations/ru.qm
172
%%DATADIR%%/translations/ru.qm
173
%%DATADIR%%/translations/sk.qm
156
%%DATADIR%%/translations/sr.qm
174
%%DATADIR%%/translations/sr.qm
157
%%DATADIR%%/translations/sr@ijekavian.qm
175
%%DATADIR%%/translations/sr@ijekavian.qm
158
%%DATADIR%%/translations/sr@ijekavianlatin.qm
176
%%DATADIR%%/translations/sr@ijekavianlatin.qm
159
%%DATADIR%%/translations/sr@latin.qm
177
%%DATADIR%%/translations/sr@latin.qm
160
%%DATADIR%%/translations/sv.qm
178
%%DATADIR%%/translations/sv.qm
161
%%DATADIR%%/translations/tr.qm
179
%%DATADIR%%/translations/tr.qm
180
%%DATADIR%%/translations/uk.qm
162
%%DATADIR%%/translations/zh_CN.qm
181
%%DATADIR%%/translations/zh_CN.qm
163
%%DATADIR%%/translations/zh_TW.qm
182
%%DATADIR%%/translations/zh_TW.qm
164
share/xsessions/xinitrc.desktop
183
share/xsessions/xinitrc.desktop

Return to bug 228116