summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2017-01-25 09:00:51 +0100
committerYorhel <git@yorhel.nl>2017-01-25 09:00:51 +0100
commit3101cdeb7c12eacad1706ceea57e7cbf6c1c92d8 (patch)
tree55d899a32cf3c96632e91adf693ff0f7bf989f17 /lib
parent5847daf777439187c49a70ccdf2dd0610f0ddcda (diff)
API: Fix Unicode password login + some messages
Diffstat (limited to 'lib')
-rw-r--r--lib/Multi/API.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Multi/API.pm b/lib/Multi/API.pm
index 566b8ada..4d856aad 100644
--- a/lib/Multi/API.pm
+++ b/lib/Multi/API.pm
@@ -177,7 +177,7 @@ sub cmd_read {
# this code wouldn't require a few protocol specific chunks.
$c->{h}->push_read(line => "\x04", sub {
my $cmd = $c->{filt}->get([$_[1], "\x04"]);
- die "No or too many commands in a single message" if @$cmd != 1;
+ die "None or too many commands in a single message" if @$cmd != 1;
my @arg;
($cmd, @arg) = @{$cmd->[0]};
@@ -228,7 +228,7 @@ sub cmd_handle {
# dbstats
if($cmd eq 'dbstats') {
- return cerr $c, parse => 'Invalid arguments to get command' if @arg > 0;
+ return cerr $c, parse => 'Too many arguments to dbstats command' if @arg > 0;
return dbstats($c);
}
@@ -305,7 +305,7 @@ sub login_verify {
my $token = urandom(20);
my($N, $r, $p, $salt) = unpack 'NCCa8', pack 'H*', $sargs;
- my $passwd = pack 'NCCa8a*', $N, $r, $p, $salt, scrypt_raw($arg->{password}, $VNDB::S{scrypt_salt} . $salt, $N, $r, $p, 32);
+ my $passwd = pack 'NCCa8a*', $N, $r, $p, $salt, scrypt_raw(encode_utf8($arg->{password}), $VNDB::S{scrypt_salt} . $salt, $N, $r, $p, 32);
cpg $c, 'SELECT user_login($1, decode($2, \'hex\'), decode($3, \'hex\'))', [ $uid, unpack('H*', $passwd), unpack('H*', $token) ], sub {
if($_[0]->nRows == 1 && ($_[0]->value(0,0)||'') =~ /t/) {