Open Lighting Architecture
0.9.0
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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
namespace
ola {
40
46
// These functions wrap their POSIX counterparts.
47
57
uid_t
GetUID
();
58
63
uid_t
GetEUID
();
64
72
bool
SetUID
(uid_t new_uid);
73
85
gid_t
GetGID
();
86
91
gid_t
GetEGID
();
92
100
bool
SetGID
(gid_t new_gid);
101
110
typedef
struct
{
112
std::string
pw_name
;
113
115
std::string
pw_passwd
;
// no passwd for now
116
118
uid_t
pw_uid
;
119
121
gid_t
pw_gid
;
122
124
std::string
pw_dir
;
125
127
std::string
pw_shell
;
128
}
PasswdEntry
;
129
146
bool
GetPasswdName(
const
std::string &name,
PasswdEntry
*passwd);
147
158
bool
GetPasswdUID
(uid_t uid,
PasswdEntry
*passwd);
159
168
typedef
struct
{
170
std::string
gr_name
;
175
std::string
gr_passwd
;
// no passwd for now
177
gid_t
gr_gid
;
178
// vector<string> gr_mem; // no members for now
179
}
GroupEntry
;
180
196
bool
GetGroupName(
const
std::string &name,
GroupEntry
*passwd);
197
208
bool
GetGroupGID
(gid_t gid,
GroupEntry
*passwd);
213
}
// namespace ola
214
#endif // INCLUDE_OLA_BASE_CREDENTIALS_H_
Generated on Fri Apr 4 2014 11:46:03 for Open Lighting Architecture by
1.8.1.2