openbsd-ports/x11/slim/patches/patch-switchuser_cpp
landry c4ea8f7c71 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@
2012-09-02 09:22:59 +00:00

26 lines
829 B
Plaintext

$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) ||
(setgid(Pw->pw_gid) != 0) ||
(setuid(Pw->pw_uid) != 0) ) {