switchuser.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* SLiM - Simple Login Manager
  2. Copyright (C) 1997, 1998 Per Liden
  3. Copyright (C) 2004-05 Simone Rota <sip@varlock.com>
  4. Copyright (C) 2004-05 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);
  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. Cfg* cfg;
  34. struct passwd *Pw;
  35. std::string displayName;
  36. };
  37. #endif