Open Lighting Architecture
0.9.1
Main Page
Modules
Related Pages
Namespaces
Classes
Files
File List
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
ola
base
Credentials.h
Go to the documentation of this file.
1
/*
2
* This library is free software; you can redistribute it and/or
3
* modify it under the terms of the GNU Lesser General Public
4
* License as published by the Free Software Foundation; either
5
* version 2.1 of the License, or (at your option) any later version.
6
*
7
* This library is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
* Lesser General Public License for more details.
11
*
12
* You should have received a copy of the GNU Lesser General Public
13
* License along with this library; if not, write to the Free Software
14
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
*
16
* Credentials.h
17
* Handle getting and setting a process's credentials.
18
* Copyright (C) 2012 Simon Newton
19
*/
20
33
#ifndef INCLUDE_OLA_BASE_CREDENTIALS_H_
34
#define INCLUDE_OLA_BASE_CREDENTIALS_H_
35
36
#include <unistd.h>
37
#include <string>
38
39
#ifdef _WIN32
40
#ifndef uid_t
41
#define uid_t int
42
#endif
43
#ifndef gid_t
44
#define gid_t int
45
#endif
46
#endif
47
48
namespace
ola {
49
55
// These functions wrap their POSIX counterparts.
56
66
bool
SupportsUIDs
();
67
73
bool
GetUID
(uid_t* uid);
74
80
bool
GetEUID
(uid_t* euid);
81
89
bool
SetUID
(uid_t new_uid);
90
103
bool
GetGID
(gid_t* gid);
104
110
bool
GetEGID
(gid_t* egid);
111
119
bool
SetGID
(gid_t new_gid);
120
129
typedef
struct
{
131
std::string
pw_name
;
132
134
std::string
pw_passwd
;
// no passwd for now
135
137
uid_t
pw_uid
;
138
140
gid_t
pw_gid
;
141
143
std::string
pw_dir
;
144
146
std::string
pw_shell
;
147
}
PasswdEntry
;
148
165
bool
GetPasswdName(
const
std::string &name,
PasswdEntry
*passwd);
166
177
bool
GetPasswdUID
(uid_t uid,
PasswdEntry
*passwd);
178
187
typedef
struct
{
189
std::string
gr_name
;
194
std::string
gr_passwd
;
// no passwd for now
196
gid_t
gr_gid
;
197
// vector<string> gr_mem; // no members for now
198
}
GroupEntry
;
199
215
bool
GetGroupName(
const
std::string &name,
GroupEntry
*passwd);
216
227
bool
GetGroupGID
(gid_t gid,
GroupEntry
*passwd);
232
}
// namespace ola
233
#endif // INCLUDE_OLA_BASE_CREDENTIALS_H_
Generated on Tue Jun 24 2014 03:57:51 for Open Lighting Architecture by
1.8.1.2