forked from ValdikSS/openvpn-radiusplugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UserPlugin.cpp
executable file
·165 lines (143 loc) · 4.01 KB
/
UserPlugin.cpp
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*
* radiusplugin -- An OpenVPN plugin for do radius authentication
* and accounting.
*
* Copyright (C) 2005 EWE TEL GmbH/Ralf Luebben <[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
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "UserPlugin.h"
/**The constructor sets the sessionid and sends the portnumber to the
* constructor of the class User, where the portnumber is set. The flags
* authenticated and accounted are set to false.*/
UserPlugin::UserPlugin() : User()
{
this->accounted=false;
this->authenticated=false;
this->authcontrolfile="";
this->clientconnectdeferfile="";
}
/**The destructor, nothing happens here.*/
UserPlugin::~UserPlugin()
{
}
/**Overloading of the assignment operator.*/
UserPlugin & UserPlugin::operator=(const UserPlugin &u)
{
if (this!=&u)
{
//call the assignment operator of the class User
User::operator=(u);
this->authenticated=u.authenticated;
this->accounted=u.accounted;
this->sessionid=u.sessionid;
this->password=u.password;
this->untrustedport=u.untrustedport;
this->authcontrolfile=u.authcontrolfile;
this->clientconnectdeferfile=u.clientconnectdeferfile;
}
return *this;
}
/*
bool UserPlugin::operator<(const UserPlugin & u)
{
if (this->sessionid < u.sessionid)
{
return true;
}
return false;
}*/
/**The copy constructor. First the copy constructor of the
* class User is called and than the sessionid, the password and the flags
* authenticated and accounted are copied.*/
UserPlugin::UserPlugin(const UserPlugin &u) : User(u)
{
this->sessionid=u.sessionid;
this->password=u.password;
this->authenticated=u.authenticated;
this->accounted=u.accounted;
this->untrustedport=u.untrustedport;
this->authcontrolfile=u.authcontrolfile;
this->clientconnectdeferfile=u.clientconnectdeferfile;
}
/**The getter method of the password.
* @return The password as a string.*/
string UserPlugin::getPassword(void)
{
return this->password;
}
/**The setter method of the password.
* @param passwd The password.*/
void UserPlugin::setPassword(string passwd)
{
this->password=passwd;
}
/** The getter method of the sessionid.
* @return The sessionid as an integer.
*/
string UserPlugin::getSessionId(void)
{
return this->sessionid;
}
/** The setter method of the sessionid.
* @param id The sessionid.*/
void UserPlugin::setSessionId(string id)
{
this->sessionid=id;
}
/** The getter method for authenticated flag.
* @return True if the user is authenticated, else false.
*/
bool UserPlugin::isAuthenticated(void)
{
return this->authenticated;
}
/**The setter method for the authenticated flag.
* @param The value for the authenticated flag.
*/
void UserPlugin::setAuthenticated(bool auth)
{
this->authenticated=auth;
}
/** The getter method for accounted flag.
* @return True if the user is accounted, else false.
*/
bool UserPlugin::isAccounted(void)
{
return this->accounted;
}
/**The setter method for the accounted flag.
* @param The value for the accounted flag.
*/
void UserPlugin::setAccounted(bool acct)
{
this->accounted=acct;
}
string UserPlugin::getAuthControlFile(void )
{
return authcontrolfile;
}
void UserPlugin::setAuthControlFile(string file)
{
authcontrolfile=file;
}
string UserPlugin::getClientConnectDeferFile(void )
{
return clientconnectdeferfile;
}
void UserPlugin::setClientConnectDeferFile(string file)
{
clientconnectdeferfile=file;
}