Update to slim 1.3.4.

- switch to cmake.
- add missing setusercontext() call in switchuser.cpp, now the ulimits
  are properly applied when logging in.
- add support for bsd_auth(3) through auth_userokay(3). Now allows to
  login via login_ldap/login_yubikey/etc...
- add support for consolekit, no need to do ck-launch-session in
  .xinitrc anymore.
- make consolekit support at runtime optional, ie don't badly bail out
  if systemwide dbus daemon is not running. Being discussed with
upstream.
parts based on a diff from 'johnw', ok ajacoutot@
This commit is contained in:
landry 2012-09-02 09:22:59 +00:00
parent dea8c6536d
commit c4ea8f7c71
11 changed files with 192 additions and 58 deletions

View File

@ -1,33 +1,31 @@
# $OpenBSD: Makefile,v 1.20 2011/12/17 22:01:13 sthen Exp $
# $OpenBSD: Makefile,v 1.21 2012/09/02 09:22:59 landry Exp $
COMMENT= simple login manager
DISTNAME= slim-1.3.2
REVISION= 5
DISTNAME= slim-1.3.4
CATEGORIES= x11
MAINTAINER = Landry Breuil <landry@openbsd.org>
HOMEPAGE= http://slim.berlios.de/
MASTER_SITES= ${MASTER_SITE_BERLIOS:=slim/}
# GPL
# GPLv2
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
USE_GMAKE= Yes
USE_GROFF = Yes
NO_REGRESS= Yes
MODULES = devel/cmake
LIB_DEPENDS= graphics/jpeg \
sysutils/consolekit \
x11/dbus \
graphics/png
WANTLIB= X11 Xft Xmu Xrender fontconfig c m stdc++ z freetype jpeg png
WANTLIB += pthread dbus-1 ck-connector
MAKE_FILE= Makefile.openbsd
MAKE_FLAGS+= CFGDIR=${SYSCONFDIR}
FAKE_FLAGS+= PREFIX=${PREFIX} \
CFGDIR=${PREFIX}/share/examples/slim
CONFIGURE_ARGS= -DUSE_CONSOLEKIT="yes"
pre-configure:
${SUBST_CMD} ${WRKSRC}/slim.1 ${WRKSRC}/slim.conf

View File

@ -1,5 +1,2 @@
MD5 (slim-1.3.2.tar.gz) = yhrmEg5vS0lp8tbPlPR7Qg==
RMD160 (slim-1.3.2.tar.gz) = HKZQTAfqLUIP3oa22w9M+71mgPw=
SHA1 (slim-1.3.2.tar.gz) = 5CHVSHcyyDF/j1kZBmYeAUsDY1g=
SHA256 (slim-1.3.2.tar.gz) = 8VYBJQBfJTubiCIFmP7XqVde9AVxaGLGyj/MctvUgrg=
SIZE (slim-1.3.2.tar.gz) = 220592
SHA256 (slim-1.3.4.tar.gz) = FVwmRgyYufCSViQCi0JUr8DeT9ozMA86xFYGssXL1QE=
SIZE (slim-1.3.4.tar.gz) = 227197

View File

@ -0,0 +1,38 @@
$OpenBSD: patch-CMakeLists_txt,v 1.1 2012/09/02 09:22:59 landry Exp $
--- CMakeLists.txt.orig Tue Jun 26 10:20:14 2012
+++ CMakeLists.txt Sat Sep 1 20:39:34 2012
@@ -24,7 +24,7 @@ set(SLIM_VERSION "${SLIM_VERSION_MAJOR}.${SLIM_VERSION
set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Installation Directory")
set(PKGDATADIR "${CMAKE_INSTALL_PREFIX}/share/slim")
set(SYSCONFDIR "/etc")
-set(MANDIR "${CMAKE_INSTALL_PREFIX}/share/man")
+set(MANDIR "${CMAKE_INSTALL_PREFIX}/man")
set(SLIM_DEFINITIONS)
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
@@ -132,8 +132,6 @@ endif(USE_CONSOLEKIT)
# system librarys
find_library(M_LIB m)
-find_library(RT_LIB rt)
-find_library(CRYPTO_LIB crypt)
add_definitions(${SLIM_DEFINITIONS})
@@ -152,8 +150,6 @@ include_directories(
#Set up library with all found packages
target_link_libraries(${PROJECT_NAME}
${M_LIB}
- ${RT_LIB}
- ${CRYPTO_LIB}
${X11_X11_LIB}
${X11_Xft_LIB}
${X11_Xrender_LIB}
@@ -169,6 +165,6 @@ install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bi
# man file
install(FILES slim.1 DESTINATION ${MANDIR}/man1/)
# configure
-install(FILES slim.conf DESTINATION ${SYSCONFDIR})
+install(FILES slim.conf DESTINATION ${CMAKE_INSTALL_PREFIX}/share/examples/slim/)
# themes directory
subdirs(themes)

View File

@ -0,0 +1,20 @@
$OpenBSD: patch-Ck_cpp,v 1.1 2012/09/02 09:22:59 landry Exp $
Keep track of the successful consolekit session opening
--- Ck.cpp.orig Tue Jun 26 10:20:14 2012
+++ Ck.cpp Sat Sep 1 23:06:17 2012
@@ -101,6 +101,7 @@ namespace Ck {
void Session::open_session(const std::string &display, uid_t uid)
{
+ session = false;
ckc = ck_connector_new();
if(!ckc)
@@ -113,6 +114,7 @@ namespace Ck {
throw Exception(__func__, "cannot open ConsoleKit session: OOM, DBus system bus "
" not available or insufficient privileges");
}
+ session = true;
}
const char * Session::get_xdg_session_cookie()

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-Ck_h,v 1.1 2012/09/02 09:22:59 landry Exp $
Add a boolean to track the consolekit session success
--- Ck.h.orig Tue Jun 26 10:20:14 2012
+++ Ck.h Sat Sep 1 23:06:38 2012
@@ -27,12 +27,13 @@ namespace Ck {
private:
CkConnector *ckc;
DBusError error;
-
+ bool session;
const char * get_x11_device(const std::string &display);
dbus_bool_t ck_connector_open_graphic_session(const std::string &display,
uid_t uid);
public:
const char * get_xdg_session_cookie();
+ bool has_session() {return session;}
void open_session(const std::string &display, uid_t uid);
void close_session();

View File

@ -1,19 +0,0 @@
$OpenBSD: patch-Makefile_openbsd,v 1.1.1.1 2007/10/24 23:32:00 landry Exp $
--- Makefile.openbsd.orig Wed Oct 24 19:29:25 2007
+++ Makefile.openbsd Wed Oct 24 19:31:24 2007
@@ -5,12 +5,10 @@
#######################################################
CXX=/usr/bin/g++
CC=/usr/bin/gcc
-CFLAGS=-I. -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/usr/X11R6/include/freetype2/config -I/usr/local/include/libpng -I/usr/local/include -I/usr/include
-LDFLAGS=-L/usr/X11R6/lib -L/usr/local/lib -lXft -lX11 -lfreetype -lXrender -lfontconfig -lpng -lz -lm -lXmu -lpng -ljpeg
+CFLAGS=-I. -I${X11BASE}/include -I${X11BASE}/include/freetype2 -I${X11BASE}/include/freetype2/config -I${LOCALBASE}/include/libpng -I${LOCALBASE}/include -I/usr/include
+LDFLAGS=-L${X11BASE}/lib -L${LOCALBASE}/lib -lXft -lX11 -lfreetype -lXrender -lfontconfig -lpng -lz -lm -lXmu -lpng -ljpeg
CUSTOM=-DNEEDS_BASENAME
-PREFIX=/usr
-CFGDIR=/etc
-MANDIR=/usr/share/man
+MANDIR=${PREFIX}/man
DESTDIR=
#######################################################

View File

@ -0,0 +1,71 @@
$OpenBSD: patch-app_cpp,v 1.4 2012/09/02 09:22:59 landry Exp $
add support for bsd_auth/auth_userokay on OpenBSD
only call the consolekit stuff if the ck session is okay
don't exit if the ck session fails to start
--- app.cpp.orig Tue Jun 26 10:20:14 2012
+++ app.cpp Sat Sep 1 23:04:49 2012
@@ -32,6 +32,11 @@
#include <shadow.h>
#endif
+/* for auth_userokay(3) */
+#ifdef __OpenBSD__
+#include <login_cap.h>
+#include <bsd_auth.h>
+#endif
using namespace std;
#ifdef USE_PAM
@@ -468,6 +473,12 @@ bool App::AuthenticateUser(bool focuspass){
if(pw == 0)
return false;
+#ifdef __OpenBSD__
+ char * pass = strdup(LoginPanel->GetPasswd().c_str());
+ int ret = auth_userokay(pw->pw_name, NULL, "auth-slim", pass);
+ free(pass);
+ return ret;
+#endif
#ifdef HAVE_SHADOW
struct spwd *sp = getspnam(pw->pw_name);
endspent();
@@ -572,7 +583,6 @@ void App::Login() {
}
catch(Ck::Exception &e) {
logStream << APPNAME << ": " << e << endl;
- exit(ERR_EXIT);
}
#endif
@@ -585,6 +595,7 @@ void App::Login() {
char** child_env = pam.getenvlist();
# ifdef USE_CONSOLEKIT
+ if(ck.has_session()) {
char** old_env = child_env;
// Grow the copy of the environment for the session cookie
@@ -597,6 +608,7 @@ void App::Login() {
memcpy(child_env, old_env, sizeof(char*)*n);
child_env[n - 1] = StrConcat("XDG_SESSION_COOKIE=", ck.get_xdg_session_cookie());
child_env[n] = NULL;
+ }
# endif /* USE_CONSOLEKIT */
pam.end();
@@ -620,6 +632,7 @@ void App::Login() {
child_env[n++]=StrConcat("MAIL=", maildir.c_str());
child_env[n++]=StrConcat("XAUTHORITY=", xauthority.c_str());
# ifdef USE_CONSOLEKIT
+ if (ck.has_session())
child_env[n++]=StrConcat("XDG_SESSION_COOKIE=", ck.get_xdg_session_cookie());
# endif /* USE_CONSOLEKIT */
child_env[n++]=0;
@@ -666,6 +679,7 @@ void App::Login() {
#ifdef USE_CONSOLEKIT
try {
+ if (ck.has_session())
ck.close_session();
}
catch(Ck::Exception &e) {

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-image_cpp,v 1.1 2012/09/02 09:22:59 landry Exp $
--- image.cpp.orig Sat Sep 1 19:52:57 2012
+++ image.cpp Sat Sep 1 19:53:20 2012
@@ -781,7 +781,7 @@ Image::readPng(const char *filename, int *width, int *
(png_infopp) NULL);
}
- if (setjmp(png_ptr->jmpbuf)) {
+ if (setjmp(png_jmpbuf(png_ptr))) {
goto png_destroy;
}

View File

@ -1,15 +0,0 @@
$OpenBSD: patch-png_c,v 1.1 2011/07/08 20:38:01 naddy Exp $
Fix build with png-1.5.
--- png.c.orig Wed Jul 6 17:24:44 2011
+++ png.c Wed Jul 6 17:25:02 2011
@@ -57,7 +57,7 @@ read_png(const char *filename, int *width, int *height
return(0);
}
- if (setjmp(png_ptr->jmpbuf))
+ if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL);
fclose(infile);

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-slim_conf,v 1.5 2010/08/24 11:37:50 landry Exp $
--- slim.conf.orig Thu Jul 8 07:04:10 2010
+++ slim.conf Mon Aug 23 21:40:33 2010
$OpenBSD: patch-slim_conf,v 1.6 2012/09/02 09:22:59 landry Exp $
--- slim.conf.orig Tue Jun 26 10:20:14 2012
+++ slim.conf Sat Sep 1 23:15:35 2012
@@ -1,17 +1,17 @@
# Path, X server and arguments (if needed)
# Note: -xauth $authfile is automatically appended
@ -37,7 +37,7 @@ $OpenBSD: patch-slim_conf,v 1.5 2010/08/24 11:37:50 landry Exp $
# Commands executed when starting and exiting a session.
# They can be used for registering a X11 session with
@@ -54,7 +54,7 @@ login_cmd exec /bin/bash -login ~/.xinitrc %
sessions xfce4,icewm,wmaker,blackbox
sessions xfce4,icewm-session,wmaker,blackbox
# Executed when pressing F11 (requires imagemagick)
-screenshot_cmd import -window root /slim.png

View File

@ -1,10 +1,23 @@
$OpenBSD: patch-switchuser_cpp,v 1.3 2010/08/24 11:37:50 landry Exp $
--- switchuser.cpp.orig Thu Jul 8 07:04:10 2010
+++ switchuser.cpp Mon Aug 23 21:36:45 2010
@@ -39,6 +39,8 @@ void SwitchUser::Login(const char* cmd, const char* mc
$OpenBSD: patch-switchuser_cpp,v 1.4 2012/09/02 09:23:00 landry Exp $
add missing setusercontext/setsid/setlogin calls.
--- switchuser.cpp.orig Tue Jun 26 10:20:14 2012
+++ switchuser.cpp Sat Sep 1 20:51:44 2012
@@ -10,6 +10,10 @@
*/
#include <cstdio>
+#ifdef __OpenBSD__
+#include <sys/types.h>
+#include <login_cap.h>
+#endif
#include "switchuser.h"
#include "util.h"
@@ -36,6 +40,9 @@ void SwitchUser::Login(const char* cmd, const char* mc
void SwitchUser::SetUserId() {
if( (Pw == 0) ||
+ (setusercontext(NULL, Pw, Pw->pw_uid, LOGIN_SETPRIORITY|LOGIN_SETRESOURCES) == -1) ||
+ (setsid() == -1) ||
+ (setlogin(Pw->pw_name) != 0) ||
(initgroups(Pw->pw_name, Pw->pw_gid) != 0) ||