core
vul
vul_user_info.cxx
Go to the documentation of this file.
1
// This is core/vul/vul_user_info.cxx
2
//:
3
// \file
4
// \author Andrew W. Fitzgibbon, Oxford RRG
5
// \date 08 Apr 99
6
//
7
//-----------------------------------------------------------------------------
8
9
#include <iostream>
10
#include "
vul_user_info.h
"
11
12
13
#if defined(_WIN32) && !defined(__CYGWIN__)
14
#include <direct.h>
15
#else
16
#include <unistd.h>
17
#include <pwd.h>
18
#endif
19
20
#ifdef _MSC_VER
21
# include <vcl_msvc_warnings.h>
22
#endif
23
24
// uid_type uid;
25
// uid_type gid;
26
// std::string name; // login name
27
// std::string home_directory;
28
// std::string full_name;
29
// std::string shell;
30
// std::string passwd;
31
32
void
vul_user_info::init
(
uid_type
/*uid*/
)
33
{
34
std::cerr <<
"Not implemented\n"
;
35
}
36
37
void
vul_user_info::init
(
char
const
* name_)
38
{
39
#if !defined(_WIN32) || defined(__CYGWIN__)
40
struct
passwd
* pw = getpwnam(name_);
41
if
(!pw) {
42
#endif
43
this->
ok
=
false
;
44
this->
uid
= 0;
45
this->
gid
= 0;
46
this->
name
= name_;
47
#if !defined(_WIN32) || defined(__CYGWIN__)
48
}
else
{
49
this->
ok
=
true
;
50
this->
uid
= pw->pw_uid;
51
this->
gid
= pw->pw_gid;
52
this->
name
= pw->pw_name;
// login name
53
this->
home_directory
= pw->pw_dir;
54
this->
full_name
= pw->pw_gecos;
55
this->
shell
= pw->pw_shell;
56
this->
passwd
= pw->pw_passwd;
57
}
58
#endif
59
}
vul_user_info.h
Reads information about a user from the password file.
vul_user_info::gid
uid_type gid
Definition:
vul_user_info.h:29
vul_user_info::passwd
std::string passwd
Definition:
vul_user_info.h:34
vul_user_info::init
void init(uid_type)
NYI.
Definition:
vul_user_info.cxx:31
vul_user_info::name
std::string name
Definition:
vul_user_info.h:30
vul_user_info::ok
bool ok
Definition:
vul_user_info.h:27
vul_user_info::uid_type
unsigned long uid_type
Definition:
vul_user_info.h:25
vul_user_info::full_name
std::string full_name
Definition:
vul_user_info.h:32
vul_user_info::uid
uid_type uid
Definition:
vul_user_info.h:28
vul_user_info::shell
std::string shell
Definition:
vul_user_info.h:33
vul_user_info::home_directory
std::string home_directory
Definition:
vul_user_info.h:31
Generated by
1.8.15