summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-12-05 11:18:53 +0100
committerYorhel <git@yorhel.nl>2010-12-05 11:18:53 +0100
commit5f84950274d625b01ee1211f2f8a99ddbb5e7cbc (patch)
tree180f2068bc0e765048fa0df5854b482458306f74
parent70d7a53944cdbad062323be453d2061e6e8d84b7 (diff)
API: Removed the limit on the number of open sessions per user
There already is a limit on the number of open connections per IP. An additional limit on the number of sessions per user won't do much, really.
-rw-r--r--ChangeLog1
-rw-r--r--data/docs/113
-rw-r--r--lib/Multi/API.pm7
3 files changed, 4 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 0ac16a6d..d6d2778f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@
- API: Increased the maximum number of results for the "get" command to 25
- API: Added "orig_lang" member and filter to the "get vn .." command
- API: Throttle the commands and sqltime per IP instead of per user
+ - API: Removed the limit on the number of open sessions per user
2.14 - 2010-11-28
- Improved filter selection interface for the release and VN browser
diff --git a/data/docs/11 b/data/docs/11
index d6448782..8fca395c 100644
--- a/data/docs/11
+++ b/data/docs/11
@@ -40,7 +40,6 @@
server resources and prevent abuse of this service.</p>
<ul>
<li>5 connections per IP. All connections that are opened after reaching this limit will be immediately closed.</li>
- <li>3 sessions per user. The login command will reply with a 'sesslimit' error when this limit is reached.</li>
<li>100 commands per 10 minutes per ip. Server will reply with a 'throttled' error (type="cmd") when reaching this limit.</li>
<li>
1 second of SQL time per minute per ip. SQL time is the total time taken to
@@ -916,7 +915,6 @@ however still required.<br />
</dd>
<dt>auth</dt><dd>(login) Incorrect username/password combination.</dd>
<dt>loggedin</dt><dd>(login) Already logged in. Only one successful login command can be issues on one connection.</dd>
- <dt>sesslimit</dt><dd>(login) Too many open sessions for the current user.</dd>
<dt>gettype</dt><dd>(get) Unknown type argument to the 'get' command.</dd>
<dt>getinfo</dt><dd>(get) Unknown info flag to the 'get' command. The name of the unrecognised flag is given in an additional "flag" member.</dd>
<dt>filter</dt><dd>(get) Unknown filter field or invalid combination of field/operator/argument type. Includes three additional members: "field", "op" and "value" of the incorrect expression.</dd>
@@ -938,6 +936,7 @@ however still required.<br />
<li>Increased the maximum number of results for the "get .." command to 25</li>
<li>Added "orig_lang" member and filter to the "get vn .." command</li>
<li>Throttle the commands and sqltime per IP instead of per user</li>
+ <li>Removed the limit on the number of open sessions per user</li>
</ul>
<b>2.12</b>
<ul>
diff --git a/lib/Multi/API.pm b/lib/Multi/API.pm
index 72751478..6b3bd19c 100644
--- a/lib/Multi/API.pm
+++ b/lib/Multi/API.pm
@@ -48,7 +48,6 @@ sub spawn {
port => 19534,
logfile => "$VNDB::M{log_dir}/api.log",
conn_per_ip => 5,
- sess_per_user => 3,
max_results => 25,
default_results => 10,
tcp_keepalive => [ 120, 60, 3 ], # time, intvl, probes
@@ -336,7 +335,7 @@ sub client_input {
# handle login command
return $_[KERNEL]->yield(login => $c, $arg) if $cmd eq 'login';
- return cerr $c, needlogin => 'Not logged in.' if !$c->{username};
+ return cerr $c, needlogin => 'Not logged in.' if !$c->{client};
# handle get command
if($cmd eq 'get') {
@@ -376,7 +375,7 @@ sub login {
# validation (bah)
return cerr $c, parse => 'Argument to login must be a single JSON object' if @$arg != 1 || ref($arg->[0]) ne 'HASH';
$arg = $arg->[0];
- return cerr $c, loggedin => 'Already logged in, please reconnect to start a new session' if $c->{username};
+ return cerr $c, loggedin => 'Already logged in, please reconnect to start a new session' if $c->{client};
for (qw|protocol client clientver username password|) {
!exists $arg->{$_} && return cerr $c, missing => "Required field '$_' is missing", field => $_;
!defined $arg->{$_} && return cerr $c, badarg => "Field '$_' cannot be null", field => $_;
@@ -386,8 +385,6 @@ sub login {
return cerr $c, badarg => 'Unknown protocol version', field => 'protocol' if $arg->{protocol} ne '1';
return cerr $c, badarg => 'Invalid client name', field => 'client' if $arg->{client} !~ /^[a-zA-Z0-9 _-]{3,50}$/;
return cerr $c, badarg => 'Invalid client version', field => 'clientver' if $arg->{clientver} !~ /^[a-zA-Z0-9_.\/-]{1,25}$/;
- return cerr $c, sesslimit => "Too many open sessions for user '$arg->{username}'", max_allowed => $_[HEAP]{sess_per_user}
- if $_[HEAP]{sess_per_user} <= grep $_[HEAP]{c}{$_}{username} && $arg->{username} eq $_[HEAP]{c}{$_}{username}, keys %{$_[HEAP]{c}};
# fetch user info
$_[KERNEL]->post(pg => query => "SELECT rank, salt, encode(passwd, 'hex') as passwd FROM users WHERE username = ?",