openbsd-ports/x11/slim/patches/patch-app_cpp
dcoppa d67d92be37 Update to slim-1.3.6
ok rpe@, jung@, landry@ (maintainer)
2013-10-31 09:03:33 +00:00

72 lines
1.9 KiB
Plaintext

$OpenBSD: patch-app_cpp,v 1.6 2013/10/31 09:03:33 dcoppa 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 Wed Oct 2 00:38:05 2013
+++ app.cpp Wed Oct 30 08:30:31 2013
@@ -30,6 +30,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
@@ -472,6 +477,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();
@@ -575,7 +586,6 @@ void App::Login() {
}
catch(Ck::Exception &e) {
logStream << APPNAME << ": " << e << endl;
- exit(ERR_EXIT);
}
#endif
@@ -588,6 +598,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 */
@@ -600,6 +611,7 @@ void App::Login() {
memcpy(child_env, old_env, sizeof(char*)*n+1);
child_env[n - 1] = StrConcat("XDG_SESSION_COOKIE=", ck.get_xdg_session_cookie());
child_env[n] = NULL;
+ }
# endif /* USE_CONSOLEKIT */
#else
@@ -621,6 +633,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;
@@ -667,6 +680,7 @@ void App::Login() {
#ifdef USE_CONSOLEKIT
try {
+ if (ck.has_session())
ck.close_session();
}
catch(Ck::Exception &e) {