diff options
author | Pascal Terjan <pterjan@gmail.com> | 2016-12-06 13:54:37 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@gmail.com> | 2016-12-06 13:55:28 +0000 |
commit | 9aa0a5137730d580da32a7ad53f5f12a0057b6dc (patch) | |
tree | 915e3fdecee983fe16bec77559f16099378438f6 | |
parent | 882cb7a0ac0d9c36ed7a1d072f91d1a9f51a3f5b (diff) | |
download | identity-9aa0a5137730d580da32a7ad53f5f12a0057b6dc.tar identity-9aa0a5137730d580da32a7ad53f5f12a0057b6dc.tar.gz identity-9aa0a5137730d580da32a7ad53f5f12a0057b6dc.tar.bz2 identity-9aa0a5137730d580da32a7ad53f5f12a0057b6dc.tar.xz identity-9aa0a5137730d580da32a7ad53f5f12a0057b6dc.zip |
Fix prefix for IPv6 users
Argument "2a00:79e0:d:302:7ce7:3d64:23ac:b212" isn't numeric in right bitshift (>>) at /var/www/identity/script/../lib/CatDap/Controller/user.pm line 123
-rw-r--r-- | lib/CatDap/Controller/user.pm | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/CatDap/Controller/user.pm b/lib/CatDap/Controller/user.pm index e6cc7a1..8c14cfd 100644 --- a/lib/CatDap/Controller/user.pm +++ b/lib/CatDap/Controller/user.pm @@ -116,11 +116,9 @@ sub get_keyprefix : Private { my ( $self, $c ) = @_; my $keyprefix; if ($c->req->address =~ m/:/) { - my $address = $c->req->address; - $address =~ s/\[\]://; - - # if we shift right 104 bits from 128 we have 24 bits left or 3 bytes. - $keyprefix = sprintf( "%06x", $address >> 104 ); + # For IPv6 the first 3 can be special and shared by many people, + # bytes 6-8 are more interesting + $keyprefix = sprintf( "%02x%02x%02x", splice(5, 3, split /:/, $c->req->address)); } else { $keyprefix = sprintf( "%02x%02x%02x", split /\./, $c->req->address ); |