summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-12-04 20:26:31 +0100
committerYorhel <git@yorhel.nl>2010-12-04 20:26:31 +0100
commit4084e0411d4ff92723499836b5f957a3ec54feec (patch)
treec8690d527f714b656b254ffabd8a30ce7b648f07
parentfa4de2123498d3f240d09a12811af80b8af7fa72 (diff)
API: Allow non-numbers as "clientver" for the login command
`git describe` strings are also valid version "numbers", after all. Although it's less useful in the sense that we can't check for "older" and "newer" versions now.
-rw-r--r--ChangeLog1
-rw-r--r--data/docs/113
-rw-r--r--lib/Multi/API.pm2
3 files changed, 4 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 3fb2d17b..7bcca8a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
2.14 - ?
- API: Allow extra whitespace after "get .." command
+ - API: Allow non-numbers as "clientver" for the login command
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 a12bcbcb..b05cf6cd 100644
--- a/data/docs/11
+++ b/data/docs/11
@@ -222,7 +222,7 @@ however still required.<br />
must contain only alphanumeric ASCII characters, space, underscore and hyphens.
When writing a client, think of a funny (unique) name and hardcode it into
your application.
- </dd><dt>clientver</dt><dd>A positive number indicating the software version of the client.</dd>
+ </dd><dt>clientver</dt><dd>A number or string indicating the software version of the client.</dd>
<dt>username</dt><dd>String containing the username of the person using the client.</dd>
<dt>password</dt><dd>String, password of that user in plain text.</dd>
</dl>
@@ -907,6 +907,7 @@ however still required.<br />
<b>2.15</b>
<ul>
<li>Fixed a bug with the server not allowing extra whitespace after a "get .. " command</li>
+ <li>Allow non-numbers as "clientver" for the login command</li>
</ul>
<b>2.12</b>
<ul>
diff --git a/lib/Multi/API.pm b/lib/Multi/API.pm
index 8d146d32..d4a84cbf 100644
--- a/lib/Multi/API.pm
+++ b/lib/Multi/API.pm
@@ -377,7 +377,7 @@ 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} !~ /^\d+(\.\d+)?$/;
+ 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}};