FreeBSD Bugzilla – Attachment 150621 Details for
Bug 195759
x11/slim: Fails to honour login.conf
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
use login capabilities database to set up environment
slim-loginconf.patch (text/plain), 3.68 KB, created by
Henry Hu
on 2014-12-16 03:23:01 UTC
(
hide
)
Description:
use login capabilities database to set up environment
Filename:
MIME Type:
Creator:
Henry Hu
Created:
2014-12-16 03:23:01 UTC
Size:
3.68 KB
patch
obsolete
>diff -ruN /usr/ports/x11/slim/files/patch-CMakeLists.txt ./files/patch-CMakeLists.txt >--- /usr/ports/x11/slim/files/patch-CMakeLists.txt 2014-03-14 17:32:02.000000000 -0400 >+++ ./files/patch-CMakeLists.txt 2014-12-15 21:36:36.000000000 -0500 >@@ -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/) >diff -ruN /usr/ports/x11/slim/files/patch-slim.conf ./files/patch-slim.conf >--- /usr/ports/x11/slim/files/patch-slim.conf 2014-11-02 15:19:53.000000000 -0500 >+++ ./files/patch-slim.conf 2014-12-15 21:37:40.000000000 -0500 >@@ -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 >diff -ruN /usr/ports/x11/slim/files/patch-switchuser.cpp ./files/patch-switchuser.cpp >--- /usr/ports/x11/slim/files/patch-switchuser.cpp 2014-01-26 15:47:32.000000000 -0500 >+++ ./files/patch-switchuser.cpp 2014-12-15 22:14:41.000000000 -0500 >@@ -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 <sys/types.h> >++#include <login_cap.h> >++ >+ #include <cstdio> >+ #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) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 195759
:
150621
|
150706