Skip to content

Commit 0a42691

Browse files
author
ralfluebben
committed
*** empty log message ***
1 parent df6d197 commit 0a42691

6 files changed

+32
-7
lines changed

AccountingProcess.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ void AccountingProcess::Accounting(PluginContext * context)
9999
user->setCommonname(context->acctsocketforegr.recvStr());
100100
user->setAcctInterimInterval(context->acctsocketforegr.recvInt());
101101
user->setFramedRoutes(context->acctsocketforegr.recvStr());
102-
user->setKey(context->acctsocketforegr.recvStr());
102+
user->setKey(context->acctsocketforegr.recvStr());
103+
user->setStatusFileKey(context->acctsocketforegr.recvStr());
103104
user->setUntrustedPort(context->acctsocketforegr.recvStr());
104105
context->acctsocketforegr.recvBuf(user);
105106
if (DEBUG (context->getVerbosity()))

AcctScheduler.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void AcctScheduler::delUser(PluginContext * context, UserAcct *user)
7676
uint64_t bytesin=0, bytesout=0;
7777

7878
//get the sent and received bytes
79-
this->parseStatusFile(context, &bytesin, &bytesout,user->getKey().c_str());
79+
this->parseStatusFile(context, &bytesin, &bytesout,user->getStatusFileKey().c_str());
8080

8181
user->setBytesIn(bytesin & 0xFFFFFFFF);
8282
user->setBytesOut(bytesout & 0xFFFFFFFF);
@@ -162,7 +162,7 @@ void AcctScheduler::doAccounting(PluginContext * context)
162162
if (DEBUG (context->getVerbosity()))
163163
cerr << getTime() << "RADIUS-PLUGIN: BACKGROUND-ACCT: Scheduler: Update for User " << iter1->second.getUsername() << ".\n";
164164

165-
this->parseStatusFile(context, &bytesin, &bytesout,iter1->second.getKey().c_str());
165+
this->parseStatusFile(context, &bytesin, &bytesout,iter1->second.getStatusFileKey().c_str());
166166
iter1->second.setBytesIn(bytesin & 0xFFFFFFFF);
167167
iter1->second.setBytesOut(bytesout & 0xFFFFFFFF);
168168
iter1->second.setGigaIn(bytesin >> 32);

ChangeLog

+4-1
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,15 @@ radiusplugin_2.0d_beta:
7979
- close socket in radiuspacket.cpp on retries
8080
- add parenthesize to avoid compiler warnings
8181

82-
- Support of OPENVPN_PLUGIN_FUNC_DEFERRED:
82+
radiusplugin_2.1:
83+
- Support of OPENVPN_PLUGIN_FUNC_DEFERRED:
8384
*** The communication to the radius server for authentication is outsourced in a thread.
8485
*** If an auth control file is defined and "useauthcontrolfile=true" is defined in the config file of plugin the authentication is done the background.
8586
*** The OpenVPN process needs write permission in the OpenVPN directory.
8687
- Timestamps are included in the debug information.
8788
- Adapted to OPENVPN_PLUGIN_VERSION 2
8889
- Internal key is now based on untrusted_ip and untrusted_before.
90+
- Separated key for status file is added.
91+
8992

9093

User.cpp

+17-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ User::User()
2727
this->framedip="";
2828
this->framedroutes="";
2929
this->key="";
30+
this->statusfilekey="";
3031
this->untrustedport="";
3132
this->acctinteriminterval=0;
3233
this->portnumber=0;
@@ -68,6 +69,7 @@ User & User::operator=(const User & u)
6869
this->framedroutes=u.framedroutes;
6970
this->framedip=u.framedip;
7071
this->key=u.key;
72+
this->statusfilekey=u.statusfilekey;
7173
this->callingstationid=u.callingstationid;
7274
this->portnumber=u.portnumber;
7375
this->acctinteriminterval=u.acctinteriminterval;
@@ -96,6 +98,7 @@ User::User(const User & u)
9698
this->framedroutes=u.framedroutes;
9799
this->framedip=u.framedip;
98100
this->key=u.key;
101+
this->statusfilekey=u.statusfilekey;
99102
this->callingstationid=u.callingstationid;
100103
this->portnumber=u.portnumber;
101104
this->acctinteriminterval=u.acctinteriminterval;
@@ -171,14 +174,27 @@ string User::getKey(void)
171174
{
172175
return this->key;
173176
}
174-
/** The setter method for a unique, it is build from commonname, ip and port.
177+
/** The setter method for a unique, it is build from ip and port.
175178
* @param key The unique key.
176179
*/
177180
void User::setKey(string key)
178181
{
179182
this->key=key;
180183
}
181184

185+
/** The getter method for the status file key.
186+
* @return The unique status file key as a string.*/
187+
string User::getStatusFileKey(void)
188+
{
189+
return this->statusfilekey;
190+
}
191+
/** The setter method for a unique, it is build from commonname, ip and port.
192+
* @param key The unique status file key.
193+
*/
194+
void User::setStatusFileKey(string key)
195+
{
196+
this->statusfilekey=key;
197+
}
182198

183199
/** The getter method for the calling station id.
184200
* @return The calling station id as a string.*/

User.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ class User
4747
string framedroutes; /**<The framedroutes, they are stored as a string. if there are more routes, they must be delimted by an ';'*/
4848
string framedip; /**<The framed ip.*/
4949
string callingstationid; /**<The calling station id, in this case the real ip addres of the client.*/
50-
string key; /**<A unique key to find the user in a map. It is the same like the unique identifier in the status log file (version 1) "commonname,untrusted_ip:untrusted_port"*/
50+
string key; /**<A unique key to find the user in a map. */
51+
string statusfilekey; /**<Unique identifier in the status log file (version 1) "commonname,untrusted_ip:untrusted_port"*/
5152
int portnumber; /**<The portnumber.*/
5253
time_t acctinteriminterval; /**<The acct interim interval.*/
5354
string untrustedport; /**<The untrusted port number from OpenVPN for a client.*/
@@ -77,6 +78,9 @@ class User
7778

7879
string getKey(void);
7980
void setKey(string);
81+
82+
string getStatusFileKey(void);
83+
void setStatusFileKey(string);
8084

8185
string getCallingStationId(void);
8286
void setCallingStationId(string);

radiusplugin.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ extern "C"
439439

440440

441441
newuser->setUntrustedPort ( get_env ( "untrusted_port", envp ) );
442-
//newuser->setKey(newuser->getCommonname() +string ( "," ) + untrusted_ip + string ( ":" ) + get_env ( "untrusted_port", envp ) );
442+
newuser->setStatusFileKey(newuser->getCommonname() +string ( "," ) + untrusted_ip + string ( ":" ) + get_env ( "untrusted_port", envp ) );
443443
newuser->setKey(untrusted_ip + string ( ":" ) + get_env ( "untrusted_port", envp ) );
444444
if ( DEBUG ( context->getVerbosity() ) ) cerr << getTime() << "RADIUS-PLUGIN: FOREGROUND: Key: " << newuser->getKey() << ".\n";
445445

@@ -570,6 +570,7 @@ extern "C"
570570
context->acctsocketbackgr.send ( newuser->getAcctInterimInterval() );
571571
context->acctsocketbackgr.send ( newuser->getFramedRoutes() );
572572
context->acctsocketbackgr.send ( newuser->getKey() );
573+
context->acctsocketbackgr.send ( newuser->getStatusFileKey());
573574
context->acctsocketbackgr.send ( newuser->getUntrustedPort() );
574575
context->acctsocketbackgr.send ( newuser->getVsaBuf(), newuser->getVsaBufLen() );
575576
//get the response

0 commit comments

Comments
 (0)