switchuser.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* SLiM - Simple Login Manager
  2. Copyright (C) 1997, 1998 Per Liden
  3. Copyright (C) 2004-06 Simone Rota <sip@varlock.com>
  4. Copyright (C) 2004-06 Johannes Winkelmann <jw@tks6.net>
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. */
  10. #ifndef _SWITCHUSER_H_
  11. #define _SWITCHUSER_H_
  12. #include <stdlib.h>
  13. #include <unistd.h>
  14. #include <string.h>
  15. #include <pwd.h>
  16. #include <grp.h>
  17. #include <paths.h>
  18. #include <iostream>
  19. #include "const.h"
  20. #include "cfg.h"
  21. class SwitchUser {
  22. public:
  23. SwitchUser(struct passwd *pw, Cfg *c, const std::string& display,
  24. char** _env);
  25. ~SwitchUser();
  26. void Login(const char* cmd, const char* mcookie);
  27. private:
  28. SwitchUser();
  29. void SetEnvironment();
  30. void SetUserId();
  31. void Execute(const char* cmd);
  32. void SetClientAuth(const char* mcookie);
  33. Cfg* cfg;
  34. struct passwd *Pw;
  35. std::string displayName;
  36. char** env;
  37. };
  38. #endif