summaryrefslogtreecommitdiff
path: root/accel-pppd/session.c
diff options
context:
space:
mode:
authorxebd <xeb@mail.ru>2019-11-19 09:55:43 +0300
committerGitHub <noreply@github.com>2019-11-19 09:55:43 +0300
commit385349450d42f6e1b92e08cabe97ed52cb740fab (patch)
tree40f9ea88f794bba40d79aaafdeed2d8e7a3e9c09 /accel-pppd/session.c
parent646c760f70c0492de6b88419199c4cbe1e687ee4 (diff)
parentbcbf847c111d9780581e38ef656ea9ad6eaf7636 (diff)
downloadaccel-ppp-385349450d42f6e1b92e08cabe97ed52cb740fab.tar.gz
accel-ppp-385349450d42f6e1b92e08cabe97ed52cb740fab.zip
Merge pull request #102 from svlobanov/master
Added single-session-ignore-case option
Diffstat (limited to 'accel-pppd/session.c')
-rw-r--r--accel-pppd/session.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/accel-pppd/session.c b/accel-pppd/session.c
index f96c193..bf7d712 100644
--- a/accel-pppd/session.c
+++ b/accel-pppd/session.c
@@ -31,6 +31,7 @@
static int conf_sid_ucase;
static int conf_single_session = -1;
+static int conf_single_session_ignore_case;
static int conf_sid_source;
static int conf_seq_save_timeout = 10;
static const char *conf_seq_file;
@@ -418,7 +419,7 @@ int __export ap_session_set_username(struct ap_session *s, char *username)
pthread_rwlock_wrlock(&ses_lock);
if (conf_single_session >= 0) {
list_for_each_entry(ses, &ses_list, entry) {
- if (ses->username && ses->terminate_cause != TERM_AUTH_ERROR && !strcmp(ses->username, username)) {
+ if (ses->username && ses->terminate_cause != TERM_AUTH_ERROR && !(conf_single_session_ignore_case == 1 ? strcasecmp(ses->username, username) : strcmp(ses->username, username))) {
if (conf_single_session == 0) {
pthread_rwlock_unlock(&ses_lock);
log_ppp_info1("%s: second session denied\n", username);
@@ -455,7 +456,7 @@ int __export ap_check_username(const char *username)
pthread_rwlock_rdlock(&ses_lock);
list_for_each_entry(ses, &ses_list, entry) {
- if (ses->username && !strcmp(ses->username, username)) {
+ if (ses->username && !(conf_single_session_ignore_case == 1 ? strcasecmp(ses->username, username) : strcmp(ses->username, username))) {
r = 1;
break;
}
@@ -510,6 +511,12 @@ static void load_config(void)
} else
conf_single_session = -1;
+ opt = conf_get_opt("common", "single-session-ignore-case");
+ if (opt)
+ conf_single_session_ignore_case = atoi(opt);
+ else
+ conf_single_session_ignore_case = 0;
+
opt = conf_get_opt("common", "sid-source");
if (opt) {
if (strcmp(opt, "seq") == 0)