From: naoki i. <am...@us...> - 2008-05-01 15:21:38
|
Update of /cvsroot/popfile/engine/POPFile In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8666/POPFile Modified Files: Module.pm Random.pm Log Message: Change Log 1. New HTML module option 'cookie_cipher' UI/HTML.pm UI/HTTP.pm Users can choose Crypt::DES instead of Crypt::Blowfish. 2. Update POPFile::Random module POPFile/Random.pm POPFile/Module.pm Classifier/Bayes.pm UI/HTML.pm UI/HTTP.pm 3. New test script for POPFile::Random tests/TestRandom.tst 4. Fixed a bug that users couldn't login to the UI on some environment UI/HTTP.pm 5. Add some tests for UI::HTML 6. Update TestHTML.tst to pass tests/TestHTML.script Config bar History tab View log file View text message Session timeout Change language in the multiuser mode 7. Minor fix of the test scripts tests/TestXMLRPC.tst tests/TestPOP3.tst tests/TestHTTP.tst Current state of the test suite: TestBayesScript PASS TestBayes PASS TestConfiguration PASS TestHistory PASS TestHTML PASS TestHTTP PASS TestIMAP PASS TestInsertScript PASS * TestLogger PASS TestMailParse PASS TestModule PASS TestMQ PASS TestMutex PASS TestPipeScript PASS TestPOP3 PASS TestProxy PASS TestWordMangle PASS TestXMLRPC PASS * : TODO : needs to add tests for multi user support Index: Module.pm =================================================================== RCS file: /cvsroot/popfile/engine/POPFile/Module.pm,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** Module.pm 25 Apr 2008 16:26:17 -0000 1.55 --- Module.pm 1 May 2008 15:21:43 -0000 1.56 *************** *** 955,959 **** if ( !defined( $self->{random__} ) ) { ! $self->{random__} = new POPFile::Random(); } --- 955,959 ---- if ( !defined( $self->{random__} ) ) { ! $self->{random__} = new POPFile::Random( $self->global_config_( 'random_module' ) ); } Index: Random.pm =================================================================== RCS file: /cvsroot/popfile/engine/POPFile/Random.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Random.pm 14 Apr 2008 00:58:28 -0000 1.1 --- Random.pm 1 May 2008 15:21:43 -0000 1.2 *************** *** 32,44 **** # Returns the module itself # #---------------------------------------------------------------------------- sub new { ! my $type = shift; my $self; $self->{name__} = "random"; ! return bless $self, $type; } --- 32,63 ---- # Returns the module itself # + # $module The module to use to generate the random string + # #---------------------------------------------------------------------------- sub new { ! my ( $type, $module ) = @_; my $self; $self->{name__} = "random"; + $self->{module__} = 'Crypt::Random'; ! if ( defined( $module ) ) { ! $module = 'Crypt::' . $module if ( $module !~ /^Crypt::/ ); ! ! if ( ( $module eq 'Crypt::Random' ) || # PROFILE BLOCK START ! ( $module eq 'Crypt::OpenSSL::Random' ) || ! ( $module eq 'Crypt::CBC' ) ) { # PROFILE BLOCK STOP ! $self->{module__} = $module; ! } ! } ! ! my $has_module = eval "require $module; 1;"; ! ! if ( $has_module ) { ! return bless $self, $type; ! } else { ! return undef; ! } } *************** *** 50,73 **** # # $length Length of the string ! # $module The module to use to generate the random string ! # $strength The Strength value ( used only if using Crypt::Random ) ! # $device The Device value ( used only if using Crypt::Random ) # #---------------------------------------------------------------------------- sub generate_random_string { ! my ( $self, $module, $length, $strength, $device ) = @_; ! if ( defined($module) && ( $module eq 'Crypt::Random' ) ) { require Crypt::Random; ! return Crypt::Random::makerandom_octet( Length => $length, Strength => $strength, Device => $device, ! ); } ! if ( defined($module) && ( $module eq 'Crypt::OpenSSL::Random' ) ) { require Crypt::OpenSSL::Random; --- 69,97 ---- # # $length Length of the string ! # $strength The Strength value ( valid only if using Crypt::Random ) ! # $device The Device value ( valid only if using Crypt::Random ) # #---------------------------------------------------------------------------- sub generate_random_string { ! my ( $self, $length, $strength, $device ) = @_; ! return undef if ( !defined( $self->{module__} ) ); ! return undef if ( !defined( $length ) ); ! ! $strength = 0 if ( !defined( $strength ) ); ! $device = '' if ( !defined( $device ) ); ! ! if ( $self->{module__} eq 'Crypt::Random' ) { require Crypt::Random; ! return Crypt::Random::makerandom_octet( # PROFILE BLOCK START Length => $length, Strength => $strength, Device => $device, ! ); # PROFILE BLOCK STOP } ! if ( $self->{module__} eq 'Crypt::OpenSSL::Random' ) { require Crypt::OpenSSL::Random; *************** *** 75,86 **** } ! my $result = ''; ! ! for (1 .. $length) { ! my $random = chr( int( rand(255) ) + 1 ); ! $result .= $random; ! } ! return $result; } --- 99,105 ---- } ! require Crypt::CBC; ! return Crypt::CBC->random_bytes( $length ); } *************** *** 91,103 **** # Give a random seed to the module # #---------------------------------------------------------------------------- sub rand_seed { ! my ( $self, ! $seed ) = @_; ! my $module = $self->global_config_( 'random_module' ); ! if ( defined($module) && $module eq 'Crypt::OpenSSL::Random' ) { require Crypt::OpenSSL::Random; --- 110,123 ---- # Give a random seed to the module # + # $seed A seed + # #---------------------------------------------------------------------------- sub rand_seed { ! my ( $self, $seed ) = @_; ! return undef if ( !defined( $self->{module__} ) ); ! if ( $self->{module__} eq 'Crypt::OpenSSL::Random' ) { require Crypt::OpenSSL::Random; |