lib/TWiki/Configure/Checkers/Htpasswd/Encoding.pm
changeset 0 414e01d06fd5
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lib/TWiki/Configure/Checkers/Htpasswd/Encoding.pm	Sat Jan 26 15:50:53 2008 +0100
     1.3 @@ -0,0 +1,46 @@
     1.4 +#
     1.5 +# TWiki Enterprise Collaboration Platform, http://TWiki.org/
     1.6 +#
     1.7 +# Copyright (C) 2000-2006 TWiki Contributors.
     1.8 +#
     1.9 +# This program is free software; you can redistribute it and/or
    1.10 +# modify it under the terms of the GNU General Public License
    1.11 +# as published by the Free Software Foundation; either version 2
    1.12 +# of the License, or (at your option) any later version. For
    1.13 +# more details read LICENSE in the root of this distribution.
    1.14 +#
    1.15 +# This program is distributed in the hope that it will be useful,
    1.16 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.17 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    1.18 +#
    1.19 +# As per the GPL, removal of this notice is prohibited.
    1.20 +package TWiki::Configure::Checkers::Htpasswd::Encoding;
    1.21 +use base 'TWiki::Configure::Checker';
    1.22 +
    1.23 +use strict;
    1.24 +
    1.25 +sub check {
    1.26 +    my $this = shift;
    1.27 +
    1.28 +    my $enc = $TWiki::cfg{Htpasswd}{Encoding};
    1.29 +    my $e = '';
    1.30 +
    1.31 +    if ($enc eq 'digest') {
    1.32 +        $e .= $this->checkPerlModules(
    1.33 +            name => 'Digest::MD5',
    1.34 +            usage => "MD5 encoded passwords",
    1.35 +            minimumVersion => 1,
    1.36 +            disposition => 'required' );
    1.37 +    } elsif ($enc eq 'sha1') {
    1.38 +        $e .= $this->checkPerlModules(
    1.39 +            name => 'MIME::Base64',
    1.40 +            usage => "SHA1 password encoding",
    1.41 +            minimumVersion => 1,
    1.42 +            disposition => 'required');
    1.43 +    }
    1.44 +    my $pe = $this->checkTreePerms($TWiki::cfg{Htpasswd}{FileName}, 'r');
    1.45 +    $e .= $this->ERROR($pe) if $pe;
    1.46 +    return $e;
    1.47 +}
    1.48 +
    1.49 +1;