diff options
author | Michael Scherer <misc@mageia.org> | 2010-12-16 00:34:17 +0000 |
---|---|---|
committer | Michael Scherer <misc@mageia.org> | 2010-12-16 00:34:17 +0000 |
commit | 4282d933bc11034e0cc8ad680a7789482ba4b33f (patch) | |
tree | e3e07cf232ac56bc0de7ece1ff520721b45d2097 /lib/CatDap/Controller | |
parent | 4bfa39af74ce81f646800ab499a891e404c9fe08 (diff) | |
download | identity-4282d933bc11034e0cc8ad680a7789482ba4b33f.tar identity-4282d933bc11034e0cc8ad680a7789482ba4b33f.tar.gz identity-4282d933bc11034e0cc8ad680a7789482ba4b33f.tar.bz2 identity-4282d933bc11034e0cc8ad680a7789482ba4b33f.tar.xz identity-4282d933bc11034e0cc8ad680a7789482ba4b33f.zip |
- fix the keyprefix for ipv6 here too ( patch by Maarten Vanraes )
Diffstat (limited to 'lib/CatDap/Controller')
-rw-r--r-- | lib/CatDap/Controller/admin.pm | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/CatDap/Controller/admin.pm b/lib/CatDap/Controller/admin.pm index b324421..2ae362b 100644 --- a/lib/CatDap/Controller/admin.pm +++ b/lib/CatDap/Controller/admin.pm @@ -47,7 +47,15 @@ sub auto : Private { my $password; my $mesg; my $dn; - my $keyprefix = sprintf( "%02x%02x%02x", split /\./, $c->req->address ); + my $keyprefix; + if ($c->req->address =~ m/:/) { + my $address = $c->req->address; + $address =~ s/\[\]://; + $keyprefix = sprintf( "%06x", $address >> 104 ); # if we shift right 104 bits from 128 we have 24 bits left or 3 bytes. + } + else { + $keyprefix = sprintf( "%02x%02x%02x", split /\./, $c->req->address ); + } if ( !defined $c->user or not $c->req->cookie('key') ) { $c->detach('/user/login') if ( not $c->req->param('username') |