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.
 
 
 
 
 

48 lines
1.1 KiB

  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 <cstdio>
  19. #include <iostream>
  20. #include "log.h"
  21. #include "cfg.h"
  22. class SwitchUser {
  23. public:
  24. SwitchUser(struct passwd *pw, Cfg *c, const std::string& display,
  25. char** _env);
  26. ~SwitchUser();
  27. void Login(const char* cmd, const char* mcookie);
  28. private:
  29. SwitchUser();
  30. void SetEnvironment();
  31. void SetUserId();
  32. void Execute(const char* cmd);
  33. void SetClientAuth(const char* mcookie);
  34. Cfg* cfg;
  35. struct passwd *Pw;
  36. std::string displayName;
  37. char** env;
  38. };
  39. #endif /* _SWITCHUSER_H_ */