From owner-svn-ports-all@FreeBSD.ORG Sun Feb 22 14:50:27 2015 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9F388432; Sun, 22 Feb 2015 14:50:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C560BB3; Sun, 22 Feb 2015 14:50:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t1MEoRw9077418; Sun, 22 Feb 2015 14:50:27 GMT (envelope-from pi@FreeBSD.org) Received: (from pi@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t1MEoP4f077409; Sun, 22 Feb 2015 14:50:25 GMT (envelope-from pi@FreeBSD.org) Message-Id: <201502221450.t1MEoP4f077409@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pi set sender to pi@FreeBSD.org using -f From: Kurt Jaeger Date: Sun, 22 Feb 2015 14:50:25 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r379608 - in head/x11/slim: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Feb 2015 14:50:27 -0000 Author: pi Date: Sun Feb 22 14:50:25 2015 New Revision: 379608 URL: https://svnweb.freebsd.org/changeset/ports/379608 QAT: https://qat.redports.org/buildarchive/r379608/ Log: x11/slim: fix to honour login.conf, WWW PR: 195759 Requested by: Jonathan Chen Approved by: Henry Hu (maintainer) Modified: head/x11/slim/Makefile head/x11/slim/files/patch-CMakeLists.txt head/x11/slim/files/patch-app.cpp head/x11/slim/files/patch-slim.conf head/x11/slim/files/patch-switchuser.cpp head/x11/slim/pkg-descr Modified: head/x11/slim/Makefile ============================================================================== --- head/x11/slim/Makefile Sun Feb 22 14:34:10 2015 (r379607) +++ head/x11/slim/Makefile Sun Feb 22 14:50:25 2015 (r379608) @@ -3,7 +3,7 @@ PORTNAME= slim PORTVERSION= 1.3.6 -PORTREVISION= 6 +PORTREVISION= 7 CATEGORIES= x11 MASTER_SITES= ftp://ftp.berlios.de/pub/slim/ \ SF/slim.berlios Modified: head/x11/slim/files/patch-CMakeLists.txt ============================================================================== --- head/x11/slim/files/patch-CMakeLists.txt Sun Feb 22 14:34:10 2015 (r379607) +++ head/x11/slim/files/patch-CMakeLists.txt Sun Feb 22 14:50:25 2015 (r379608) @@ -1,5 +1,5 @@ ---- ./CMakeLists.txt.orig 2013-10-01 22:38:05.000000000 +0000 -+++ ./CMakeLists.txt 2014-03-08 16:26:46.000000000 +0000 +--- CMakeLists.txt.orig 2013-10-01 18:38:05.000000000 -0400 ++++ CMakeLists.txt 2014-12-15 21:35:53.000000000 -0500 @@ -14,6 +14,7 @@ INCLUDE(CheckCCompilerFlag) INCLUDE(CheckCXXCompilerFlag) @@ -60,7 +60,15 @@ include_directories(${PAM_INCLUDE_DIR}) else(PAM_FOUND) message("\tPAM Not Found") -@@ -221,7 +235,9 @@ +@@ -195,6 +209,7 @@ + ${FREETYPE_LIBRARY} + ${JPEG_LIBRARIES} + ${PNG_LIBRARIES} ++ util + libslim + ) + +@@ -221,7 +236,9 @@ ####### install # slim install(TARGETS slim RUNTIME DESTINATION bin) @@ -71,7 +79,7 @@ if (BUILD_SHARED_LIBS) set_target_properties(libslim PROPERTIES -@@ -236,9 +252,11 @@ +@@ -236,9 +253,11 @@ # man file install(FILES slim.1 DESTINATION ${MANDIR}/man1/) Modified: head/x11/slim/files/patch-app.cpp ============================================================================== --- head/x11/slim/files/patch-app.cpp Sun Feb 22 14:34:10 2015 (r379607) +++ head/x11/slim/files/patch-app.cpp Sun Feb 22 14:50:25 2015 (r379608) @@ -1,6 +1,76 @@ ---- ./app.cpp.orig 2012-12-31 07:03:42.000000000 -0600 -+++ ./app.cpp 2013-03-23 14:10:35.000000000 -0500 -@@ -931,7 +931,7 @@ +--- app.cpp.orig 2013-10-01 18:38:05.000000000 -0400 ++++ app.cpp 2014-12-18 00:18:29.000000000 -0500 +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -32,6 +33,20 @@ + + using namespace std; + ++static const int LOGIN_CAP_VAR_COUNT = 4; ++static const char* LOGIN_CAP_VARS[] = { ++ "lang", ++ "charset", ++ "timezone", ++ "manpath", ++}; ++static const char* LOGIN_CAP_ENVS[] = { ++ "LANG", ++ "MM_CHARSET", ++ "TZ", ++ "MANPATH", ++}; ++ + #ifdef USE_PAM + #include + +@@ -123,6 +138,22 @@ + signal(sig, User1Signal); + } + ++static void AddToEnv(char*** curr_env, const char *name, const char *value) { ++ int n; ++ for (n = 0; (*curr_env)[n] != NULL; n++) ; ++ n++; ++ char** new_env = static_cast(malloc(sizeof(char*) * (n + 1))); ++ memcpy(new_env, *curr_env, sizeof(char*) * n); ++ char* entry = static_cast(malloc(strlen(name) + strlen(value) + 2)); ++ strcpy(entry, name); ++ strcat(entry, "="); ++ strcat(entry, value); ++ new_env[n-1] = entry; ++ new_env[n] = NULL; ++ free(*curr_env); ++ *curr_env = new_env; ++} ++ + #ifdef USE_PAM + App::App(int argc, char** argv) + : pam(conv, static_cast(&LoginPanel)), +@@ -627,6 +658,17 @@ + + #endif + ++ login_cap_t *lc = login_getpwclass(pw); ++ if (lc != NULL) { ++ for (int i = 0; i < LOGIN_CAP_VAR_COUNT; i++) { ++ const char *value = login_getcapstr(lc, LOGIN_CAP_VARS[i], NULL, NULL); ++ if (value != NULL) { ++ AddToEnv(&child_env, LOGIN_CAP_ENVS[i], value); ++ } ++ } ++ login_close(lc); ++ } ++ + /* Login process starts here */ + SwitchUser Su(pw, cfg, DisplayName, child_env); + string session = LoginPanel->getSession(); +@@ -941,7 +983,7 @@ } if (!hasVtSet && daemonmode) { Modified: head/x11/slim/files/patch-slim.conf ============================================================================== --- head/x11/slim/files/patch-slim.conf Sun Feb 22 14:34:10 2015 (r379607) +++ head/x11/slim/files/patch-slim.conf Sun Feb 22 14:50:25 2015 (r379608) @@ -7,7 +7,7 @@ -default_xserver /usr/bin/X -#xserver_arguments -dpi 75 +# Use default path from /etc/login.conf -+default_path /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:%%LOCALBASE%%/sbin:%%LOCALBASE%%/bin:$HOME/bin ++default_path /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:%%LOCALBASE%%/sbin:%%LOCALBASE%%/bin +default_xserver %%LOCALBASE%%/bin/X +# The X server needs to be started on an unused virtual terminal, +# for FreeBSD in a default configuration, the first one of those is #09 Modified: head/x11/slim/files/patch-switchuser.cpp ============================================================================== --- head/x11/slim/files/patch-switchuser.cpp Sun Feb 22 14:34:10 2015 (r379607) +++ head/x11/slim/files/patch-switchuser.cpp Sun Feb 22 14:50:25 2015 (r379608) @@ -1,11 +1,46 @@ ---- ./switchuser.cpp.orig 2012-12-31 07:03:42.000000000 -0600 -+++ ./switchuser.cpp 2013-03-23 14:10:35.000000000 -0500 -@@ -36,6 +36,8 @@ +--- switchuser.cpp.orig 2013-10-01 18:38:05.000000000 -0400 ++++ switchuser.cpp 2014-12-15 22:14:16.000000000 -0500 +@@ -9,6 +9,9 @@ + (at your option) any later version. + */ + ++#include ++#include ++ + #include + #include "switchuser.h" + #include "util.h" +@@ -35,13 +38,27 @@ + } void SwitchUser::SetUserId() { - if( (Pw == 0) || -+ (setsid() == -1) || -+ (setlogin(Pw->pw_name) != 0) || - (initgroups(Pw->pw_name, Pw->pw_gid) != 0) || - (setgid(Pw->pw_gid) != 0) || - (setuid(Pw->pw_uid) != 0) ) { +- if( (Pw == 0) || +- (initgroups(Pw->pw_name, Pw->pw_gid) != 0) || +- (setgid(Pw->pw_gid) != 0) || +- (setuid(Pw->pw_uid) != 0) ) { +- logStream << APPNAME << ": could not switch user id" << endl; +- exit(ERR_EXIT); ++ if ((Pw != 0) && (setsid() != -1)) { ++ // TODO: allow users to override settings with .login.conf ++ login_cap_t *lc = login_getpwclass(Pw); ++ if ((lc != NULL) && ++ (setusercontext(lc, Pw, Pw->pw_uid, LOGIN_SETALL) == 0)) { ++ login_close(lc); ++ return; ++ } ++ login_close(lc); ++ logStream << APPNAME << ": fail to set user context" << endl; ++ // fallback to old method ++ if ((setlogin(Pw->pw_name) == 0) && ++ (initgroups(Pw->pw_name, Pw->pw_gid) == 0) && ++ (setgid(Pw->pw_gid) == 0) && ++ (setuid(Pw->pw_uid) == 0) ) { ++ return; ++ } + } ++ ++ logStream << APPNAME << ": could not switch user id" << endl; ++ exit(ERR_EXIT); + } + + void SwitchUser::Execute(const char* cmd) { Modified: head/x11/slim/pkg-descr ============================================================================== --- head/x11/slim/pkg-descr Sun Feb 22 14:34:10 2015 (r379607) +++ head/x11/slim/pkg-descr Sun Feb 22 14:50:25 2015 (r379608) @@ -5,4 +5,4 @@ It aims to be light and simple, although themes and an option file; is suitable for machines on which remote login functionalities are not needed. -WWW: http://slim.berlios.de/ +WWW: http://sourceforge.net/projects/slim.berlios/