summaryrefslogtreecommitdiff
path: root/accel-pppd/session.c
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2016-04-02 20:25:13 +0300
committerDmitry Kozlov <xeb@mail.ru>2016-04-02 20:25:13 +0300
commit7def2aa4a0af5eb26fc290257585a8c2901c0c3c (patch)
tree5aa0750758e7d48865d3c017db2a107a35baf440 /accel-pppd/session.c
parent60a945d8f075a5b90882455fa50678e2888b1d0f (diff)
downloadaccel-ppp-7def2aa4a0af5eb26fc290257585a8c2901c0c3c.tar.gz
accel-ppp-7def2aa4a0af5eb26fc290257585a8c2901c0c3c.zip
for single-session=deny make early check for duplicate username (before calling radius)
Diffstat (limited to 'accel-pppd/session.c')
-rw-r--r--accel-pppd/session.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/accel-pppd/session.c b/accel-pppd/session.c
index 1fbac101..ad164f3f 100644
--- a/accel-pppd/session.c
+++ b/accel-pppd/session.c
@@ -428,6 +428,26 @@ int __export ap_session_set_username(struct ap_session *s, char *username)
return 0;
}
+int __export ap_check_username(const char *username)
+{
+ struct ap_session *ses;
+ int r = 0;
+
+ if (conf_single_session)
+ return 0;
+
+ pthread_rwlock_rdlock(&ses_lock);
+ list_for_each_entry(ses, &ses_list, entry) {
+ if (ses->username && !strcmp(ses->username, username)) {
+ r = 1;
+ break;
+ }
+ }
+ pthread_rwlock_unlock(&ses_lock);
+
+ return r;
+}
+
static void save_seq(void)
{
FILE *f;