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. ~SwitchUser();
  25. void Login(const char* cmd, const char* mcookie);
  26. private:
  27. SwitchUser();
  28. void SetEnvironment();
  29. void SetUserId();
  30. void Execute(const char* cmd);
  31. char* BaseName(const char* name);
  32. char* StrConcat(const char* str1, const char* str2);
  33. void SetClientAuth(const char* mcookie);
  34. Cfg* cfg;
  35. struct passwd *Pw;
  36. std::string displayName;
  37. };
  38. #endif