forked from gsingh93/slim-display-manager
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
switchuser.h
47 lines (40 loc) · 1.08 KB
/
switchuser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* SLiM - Simple Login Manager
Copyright (C) 1997, 1998 Per Liden
Copyright (C) 2004-06 Simone Rota <[email protected]>
Copyright (C) 2004-06 Johannes Winkelmann <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
*/
#ifndef _SWITCHUSER_H_
#define _SWITCHUSER_H_
#include "cfg.h"
#include "log.h"
#include <cstdio>
#include <grp.h>
#include <iostream>
#include <paths.h>
#include <pwd.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
class SwitchUser
{
public:
SwitchUser(
struct passwd * pw, Cfg & c, const std::string & display, char ** _env);
~SwitchUser();
void Login(const char * cmd, const char * mcookie);
private:
SwitchUser();
void SetEnvironment();
void SetUserId();
void Execute(const char * cmd);
void SetClientAuth(const char * mcookie);
Cfg & cfg;
struct passwd * Pw;
std::string displayName;
char ** env;
};
#endif /* _SWITCHUSER_H_ */