c4ea8f7c71
- 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@
72 lines
2.1 KiB
Plaintext
72 lines
2.1 KiB
Plaintext
$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) {
|