Fix multiple session disconnect when max-same-clients is 0

max-same-clients is used to limit the number of outstanding sessions
(cookies).  If set to 0, it means an unlimited number of active cookies
can be owned by each user.  But it doesn't mean that the same cookie
can be reused for multiple CSTP connections with different IPs, as
the protocol does not normally work this way.
This commit is contained in:
Kevin Cernekee
2013-12-10 22:17:26 -08:00
committed by Nikos Mavrogiannopoulos
parent 791d776320
commit 1176d2b7b8

View File

@@ -472,9 +472,6 @@ int check_multiple_users(main_server_st *s, struct proc_st* proc)
struct proc_st *ctmp = NULL, *cpos;
unsigned int entries = 1; /* that one */
if (s->config->max_same_clients == 0)
return 0; /* ok */
list_for_each_safe(&s->clist.head, ctmp, cpos, list) {
if (ctmp != proc) {
if (memcmp(proc->cookie, ctmp->cookie, sizeof(proc->cookie)) == 0) {
@@ -492,7 +489,7 @@ unsigned int entries = 1; /* that one */
}
}
if (entries > s->config->max_same_clients)
if (s->config->max_same_clients && entries > s->config->max_same_clients)
return -1;
return 0;