You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

59 lines
1.5 KiB

  1. --- a/app.cpp
  2. +++ b/app.cpp
  3. @@ -570,8 +570,13 @@
  4. ck.open_session(DisplayName, pw->pw_uid);
  5. }
  6. catch(Ck::Exception &e) {
  7. +#ifdef USE_PAM
  8. + logStream << APPNAME << ": Consolekit::" << e << endl;
  9. + logStream << APPNAME << ": falling back to PAM session" << endl;
  10. +#else
  11. logStream << APPNAME << ": " << e << endl;
  12. exit(ERR_EXIT);
  13. +#endif
  14. }
  15. #endif
  16. @@ -584,18 +589,20 @@
  17. char** child_env = pam.getenvlist();
  18. # ifdef USE_CONSOLEKIT
  19. - char** old_env = child_env;
  20. + if (ck.get_xdg_session_cookie()) {
  21. + char** old_env = child_env;
  22. - /* Grow the copy of the environment for the session cookie */
  23. - int n;
  24. - for(n = 0; child_env[n] != NULL ; n++);
  25. -
  26. - n++;
  27. -
  28. - child_env = static_cast<char**>(malloc(sizeof(char*)*(n+1)));
  29. - memcpy(child_env, old_env, sizeof(char*)*n);
  30. - child_env[n - 1] = StrConcat("XDG_SESSION_COOKIE=", ck.get_xdg_session_cookie());
  31. - child_env[n] = NULL;
  32. + /* Grow the copy of the environment for the session cookie */
  33. + int n;
  34. + for(n = 0; child_env[n] != NULL ; n++);
  35. +
  36. + n++;
  37. +
  38. + child_env = static_cast<char**>(malloc(sizeof(char*)*(n+1)));
  39. + memcpy(child_env, old_env, sizeof(char*)*n);
  40. + child_env[n - 1] = StrConcat("XDG_SESSION_COOKIE=", ck.get_xdg_session_cookie());
  41. + child_env[n] = NULL;
  42. + }
  43. # endif /* USE_CONSOLEKIT */
  44. #else
  45. @@ -663,7 +670,8 @@
  46. #ifdef USE_CONSOLEKIT
  47. try {
  48. - ck.close_session();
  49. + if (ck.get_xdg_session_cookie())
  50. + ck.close_session();
  51. }
  52. catch(Ck::Exception &e) {
  53. logStream << APPNAME << ": " << e << endl;