view release on metacpan or search on metacpan
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
'debug' => { type => BOOLEAN, optional => 1, default => 1 },
'quiet' => { type => BOOLEAN, optional => 1, default => 0 },
'test_ok' => { type => BOOLEAN, optional => 1 },
);
my %p = validate( @_,
{ toaster=> { type => OBJECT, optional => 1 },
%std_opts,
}
);
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub ask {
my $self = shift;
my $question = shift;
my %p = validate(
@_,
{ default => { type => SCALAR|UNDEF, optional => 1 },
timeout => { type => SCALAR, optional => 1 },
password => { type => BOOLEAN, optional => 1, default => 0 },
test_ok => { type => BOOLEAN, optional => 1 },
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
sub audit {
my $self = shift;
my $mess = shift;
my %p = validate( @_, { %std_opts } );
if ($mess) {
push @{ $log->{audit} }, $mess;
print "$mess\n" if $self->{debug} || $p{debug};
}
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub archive_file {
my $self = shift;
my $file = shift or return $log->error("missing filename in request");
my %p = validate( @_,
{ 'sudo' => { type => BOOLEAN, optional => 1, default => 1 },
'mode' => { type => SCALAR, optional => 1 },
destdir => { type => SCALAR, optional => 1 },
%std_opts,
}
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
return;
};
sub chmod {
my $self = shift;
my %p = validate(
@_,
{ 'file' => { type => SCALAR, optional => 1, },
'file_or_dir' => { type => SCALAR, optional => 1, },
'dir' => { type => SCALAR, optional => 1, },
'mode' => { type => SCALAR, optional => 0, },
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub chown {
my $self = shift;
my $file = shift;
my %p = validate( @_,
{ 'uid' => { type => SCALAR },
'gid' => { type => SCALAR },
'sudo' => { type => BOOLEAN, optional => 1 },
%std_opts,
}
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub chown_system {
my $self = shift;
my $dir = shift;
my %p = validate( @_,
{ 'user' => { type => SCALAR, optional => 0, },
'group' => { type => SCALAR, optional => 1, },
'recurse' => { type => BOOLEAN, optional => 1, },
%std_opts,
}
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub clean_tmp_dir {
my $self = shift;
my $dir = shift or die "missing dir name";
my %p = validate( @_, { %std_opts } );
my %args = $self->get_std_args( %p );
my $before = cwd; # remember where we started
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub cwd_source_dir {
my $self = shift;
my $dir = shift or die "missing dir in request\n";
my %p = validate( @_,
{ 'src' => { type => SCALAR, optional => 1, },
'sudo' => { type => BOOLEAN, optional => 1, },
%std_opts,
}
);
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
return 1;
}
sub dump_audit {
my $self = shift;
my %p = validate( @_, { %std_opts } );
my $audit = $log->{audit} or return;
return if ! $log->{last_audit};
return if $log->{last_audit} == scalar @$audit; # nothing new
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub error {
my $self = shift;
my $message = shift;
my %p = validate( @_,
{ location => { type => SCALAR, optional => 1, },
%std_opts,
},
);
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub extract_archive {
my $self = shift;
my $archive = shift or die "missing archive name";
my %p = validate( @_, { %std_opts } );
my %args = $self->get_std_args( %p );
my $r;
if ( !-e $archive ) {
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub file_delete {
my $self = shift;
my $file = shift or die "missing file argument";
my %p = validate( @_,
{ 'sudo' => { type => BOOLEAN, optional => 1, default => 0 },
%std_opts,
}
);
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
return -e $file ? 0 : 1;
}
sub file_is_newer {
my $self = shift;
my %p = validate( @_,
{ f1 => { type => SCALAR },
f2 => { type => SCALAR },
%std_opts,
}
);
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub file_read {
my $self = shift;
my $file = shift or return $log->error("missing filename in request");
my %p = validate(
@_,
{ 'max_lines' => { type => SCALAR, optional => 1 },
'max_length' => { type => SCALAR, optional => 1 },
%std_opts
}
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
return @lines;
}
sub file_mode {
my $self = shift;
my %p = validate( @_,
{ 'file' => { type => SCALAR },
%std_opts
}
);
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub file_write {
my $self = shift;
my $file = shift or return $log->error("missing filename in request");
my %p = validate(
@_,
{ 'lines' => { type => ARRAYREF },
'append' => { type => BOOLEAN, optional => 1, default => 0 },
'mode' => { type => SCALAR, optional => 1 },
%std_opts
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
return 1;
}
sub files_diff {
my $self = shift;
my %p = validate(
@_,
{ f1 => { type => SCALAR },
f2 => { type => SCALAR },
type => { type => SCALAR, optional => 1, default => 'text' },
%std_opts,
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub find_bin {
my $self = shift;
my $bin = shift or die "missing argument to find_bin\n";
my %p = validate( @_,
{ 'dir' => { type => SCALAR, optional => 1, },
%std_opts,
},
);
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub find_config {
my $self = shift;
my $file = shift or die "missing file name";
my %p = validate( @_,
{ etcdir => { type => SCALAR | UNDEF, optional => 1, },
%std_opts,
}
);
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
return $self->find_readable( $file, @_ );
}
sub fstab_list {
my $self = shift;
my %p = validate( @_, { %std_opts, } );
if ( $OSNAME eq "darwin" ) {
return ['fstab not used on Darwin!'];
}
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub get_dir_files {
my $self = shift;
my $dir = shift or die "missing dir name";
my %p = validate( @_, { %std_opts } );
my %args = $self->get_std_args( %p );
my @files;
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
# : exclude_ipv6
# Comments : exclude options are boolean and enabled by default.
# tested on Mac OS X and FreeBSD
my $self = shift;
my %p = validate(
@_,
{ 'only' => { type => SCALAR, optional => 1, default => 0 },
'exclude_localhost' =>
{ type => BOOLEAN, optional => 1, default => 1 },
'exclude_internals' =>
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
return %args;
};
sub get_the_date {
my $self = shift;
my %p = validate(
@_,
{ 'bump' => { type => SCALAR, optional => 1, },
%std_opts
}
);
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
return $dd, $mm, $yy, undef, $hh, $mn, $ss;
}
sub get_mounted_drives {
my $self = shift;
my %p = validate( @_, { %std_opts } );
my %args = $log->get_std_args( %p );
my $mount = $self->find_bin( 'mount', %args );
-x $mount or return $log->error( "I couldn't find mount!", %args );
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub get_url {
my $self = shift;
my $url = shift;
my %p = validate(
@_,
{ dir => { type => SCALAR, optional => 1 },
timeout => { type => SCALAR, optional => 1 },
%std_opts,
}
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub get_url_system {
my $self = shift;
my $url = shift;
my %p = validate(
@_,
{ dir => { type => SCALAR, optional => 1 },
timeout => { type => SCALAR, optional => 1, },
%std_opts,
}
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
!$EVAL_ERROR;
};
sub install_if_changed {
my $self = shift;
my %p = validate(
@_,
{ newfile => { type => SCALAR, optional => 0, },
existing=> { type => SCALAR, optional => 0, },
mode => { type => SCALAR, optional => 1, },
uid => { type => SCALAR, optional => 1, },
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
$email_message->close;
};
sub install_from_source {
my $self = shift;
my %p = validate(
@_,
{ 'site' => { type => SCALAR, optional => 0, },
'url' => { type => SCALAR, optional => 0, },
'package' => { type => SCALAR, optional => 0, },
'targets' => { type => ARRAYREF, optional => 1, },
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
return;
}
sub install_module_from_src {
my $self = shift;
my %p = validate( @_, {
module => { type=>SCALAR, optional=>0, },
archive => { type=>SCALAR, optional=>0, },
site => { type=>SCALAR, optional=>0, },
url => { type=>SCALAR, optional=>0, },
src => { type=>SCALAR, optional=>1, default=>'/usr/local/src' },
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub is_readable {
my $self = shift;
my $file = shift or die "missing file or dir name\n";
my %p = validate( @_, { %std_opts } );
my %args = ( debug => $p{debug}, fatal => $p{fatal} );
-e $file or return $log->error( "$file does not exist.", %args);
-r $file or return $log->error( "$file is not readable by you ("
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
sub is_writable {
my $self = shift;
my $file = shift or die "missing file or dir name\n";
my %p = validate( @_, { %std_opts } );
my %args = $self->get_std_args( %p );
my $nl = "\n";
$nl = "<br>" if ( $ENV{GATEWAY_INTERFACE} );
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
return 1;
}
sub logfile_append {
my $self = shift;
my %p = validate(
@_,
{ 'file' => { type => SCALAR, optional => 0, },
'lines' => { type => ARRAYREF, optional => 0, },
'prog' => { type => BOOLEAN, optional => 1, default => 0, },
%std_opts,
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
$self->install_module( 'Mail::Toaster' );
}
sub mkdir_system {
my $self = shift;
my %p = validate(
@_,
{ 'dir' => { type => SCALAR, optional => 0, },
'mode' => { type => SCALAR, optional => 1, },
'sudo' => { type => BOOLEAN, optional => 1, default => 0 },
%std_opts,
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub check_pidfile {
my $self = shift;
my $file = shift;
my %p = validate( @_, { %std_opts } );
my %args = $self->get_std_args( %p );
return $log->error( "missing filename", %args) if ! $file;
return $log->error( "$file is not a regular file", %args)
if ( -e $file && !-f $file );
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub parse_config {
my $self = shift;
my $file = shift or die "missing file name";
my %p = validate( @_, {
etcdir => { type=>SCALAR, optional=>1, },
%std_opts,
},
);
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub parse_line {
my $self = shift;
my $line = shift;
my %p = validate( @_, {
strip => { type => BOOLEAN, optional=>1, default=>1 },
},
);
my $strip = $p{strip};
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
$self->install_module( 'Provision::Unix' );
}
sub regexp_test {
my $self = shift;
my %p = validate(
@_,
{ 'exp' => { type => SCALAR },
'string' => { type => SCALAR },
'pbp' => { type => BOOLEAN, optional => 1, default => 0 },
%std_opts,
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
return;
}
sub sources_get {
my $self = shift;
my %p = validate(
@_,
{ 'package' => { type => SCALAR, optional => 0 },
site => { type => SCALAR, optional => 0 },
path => { type => SCALAR, optional => 1 },
%std_opts,
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
return $log->error( "unable to get $package", %args );
}
sub source_warning {
my $self = shift;
my %p = validate(
@_,
{ 'package' => { type => SCALAR, },
'clean' => { type => BOOLEAN, optional => 1, default => 1 },
'src' => {
type => SCALAR,
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
return 1;
}
sub sudo {
my $self = shift;
my %p = validate( @_, { %std_opts } );
# if we are running as root via $<
if ( $REAL_USER_ID == 0 ) {
$log->audit( "sudo: you are root, sudo isn't necessary.");
return ''; # return an empty string, purposefully
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
}
sub syscmd {
my $self = shift;
my $cmd = shift or die "missing command!\n";
my %p = validate(
@_,
{ 'timeout' => { type => SCALAR, optional => 1 },
%std_opts,
},
);
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
};
sub yes_or_no {
my $self = shift;
my $question = shift;
my %p = validate(
@_,
{ 'timeout' => { type => SCALAR, optional => 1 },
'force' => { type => BOOLEAN, optional => 1, default => 0 },
%std_opts
},
view all matches for this distribution
view release on metacpan or search on metacpan
eg/Model/MyPageKit/MyModel.pm view on Meta::CPAN
messages => {
email => "The E-mail address, <b>%%VALUE%%</b>, is invalid.",
phone => "The phone number, <b>%%VALUE%%</b>, is invalid.",
},
};
# validate user input
unless($model->pkit_validate_input($input_profile)){
$model->pkit_internal_redirect('form_validation');
return;
}
$model->pkit_redirect('index');
}
eg/Model/MyPageKit/MyModel.pm view on Meta::CPAN
email => "The E-mail address, <b>%%VALUE%%</b>, is invalid.",
phone => "The phone number you entered is invalid.",
passwd1 => "The passwords you entered do not match.",
},
};
# validate user input
unless($model->pkit_validate_input($input_profile)){
$model->pkit_internal_redirect('newacct1');
return;
}
my $login = $model->input('login');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/SMTP.pm view on Meta::CPAN
my $smtp = Apache::SMTP::Server->new(
handle_in => $ath,
handle_out => $ath,
);
$smtp->my_config($c);
$smtp->set_callback(HELO => \&validate_hostname);
$smtp->set_callback(RCPT => \&validate_recipient);
$smtp->set_callback(DATA => \&queue_message);
$smtp->set_callback(MAIL => \&validate_sender);
$smtp->process;
Apache::OK;
}
sub validate_hostname {
my ($session, $hostname) = @_;
return(1, 250, "ok");
}
sub validate_recipient {
my ($session, $recipient) = @_;
return(1, 250, "ok");
}
sub validate_sender {
my ($session, $sender) = @_;
return(1, 250, "ok");
}
sub queue_message {
lib/Apache/SMTP.pm view on Meta::CPAN
on
port PerlSetVar MailPort
Because of the above behavior, this module _may_ act as an ***OPEN RELAY***
which is a bad thing. So please do not configure it as such. Instead,
subclass this module and write your own validate_sender() and
validate_recipient() methods. Alternatively, do not have your mail server
allow relaying from this server's ip, and you should be ok.
Also, this module, despite the methods "add_queue" and "queue_message" does
not actually implement a queue in the normal MTA sense of the word. Maybe
you would like to implement one?
lib/Apache/SMTP.pm view on Meta::CPAN
=over 4
You may want to subclass this module and write your own version of the
following
=item validate_hostname
sub validate_hostname {
my ($session, $hostname) = @_;
return(1, 250, "ok");
}
=item validate_sender
sub validate_sender {
my ($session, $sender) = @_;
return(1, 250, "ok");
}
=item validate_recipient
sub validate_recipient {
my ($session, $recipient) = @_;
return(1, 250, "ok");
}
=item queue_message
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/SWIT/HTPage.pm view on Meta::CPAN
$err .= "\nRollback exception: $@" if $@;
EXCEPTION:
return $class->ht_swit_die('ht_swit_update_die', $err, $r, $tested);
}
sub ht_swit_validate_die {
my ($class, $errs, $r, $root) = @_;
$class->swit_die("ht_validate failed", $r, $root, $errs);
}
sub swit_update {
my ($class, $r) = @_;
my %args = %{ $r->param || {} };
if ($r->body_status eq 'Success') {
$args{ $r->upload($_)->name } = $r->upload($_) for $r->upload;
}
my $tested = $class->ht_root_class->ht_load_from_params(%args);
my @errs = $tested->ht_validate;
return $class->ht_swit_die('ht_swit_validate_die', \@errs, $r, $tested)
if @errs;
return $class->ht_swit_transactional_update($r, $tested, \%args);
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
",'hash',
v => [ $s->{cookies}{IL} ],
);
if ($hash{$s->{o}{id}}) {
my $validate = $s->_interface_cookie_key(
id => $hash{$s->{o}{id}},
password => $hash{interface_password},
);
if ($validate eq $s->{cookies}{IL}) {
$s->{$s->{o}{id}} = $hash{$s->{o}{id}};
$s->{$s->{o}{interface}} = { %hash };
return 1;
} else {
push @{$s->{r}{set_cookie}}, 'IL=; path=/;';
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
",'hash',
v => [ $s->{cookies}{L} ],
);
if ($hash{employee_id}) {
my $validate = $s->_cookie_key(
employee_id => $hash{employee_id},
passwd => $hash{passwd} || $hash{ip_addr},
);
if ($validate eq $s->{cookies}{L} && !$hash{account_expired}) {
$s->{employee_id} = $hash{employee_id};
$s->{employee} = { %hash };
_employee_permissions($s);
return 1;
} else {
view all matches for this distribution
view release on metacpan or search on metacpan
unless ($r->is_initial_req) { return OK; }
$log->debug(ref($self), "->authen():");
$cred = $self->getCredentials($r);
$resp = $self->validateCredentials($r, $cred);
if (ref($resp)) {
if ($msg = $resp->{message}) { $log->info($msg); }
unless ($resp->{uri}) { return SERVER_ERROR; }
$r->header_out(Location => $resp->{uri});
return REDIRECT;
unless ($r->is_initial_req) { return OK; }
$log->debug(ref($self), "->renew():");
$cred = $self->getCredentials($r);
$resp = $self->validateCredentials($r, $cred);
unless (ref($resp)) { $log->error($resp); return SERVER_ERROR; }
unless ($resp->{renew}) { # make sure credentials are sufficiently fresh
$log->warn("Timeout before renewal."); # or replay attempt?
if ($msg = $resp->{message}) { $log->info($msg); }
unless ($resp->{uri}) { return SERVER_ERROR; }
unless ($r->dir_config('SecSess::AllowRemoteAdmin') eq 'true') {
$log->error('Remote administration not permitted.');
return FORBIDDEN;
}
## get credentials and validate them in usual way
$cred = $self->getCredentials($r);
$resp = $self->validateCredentials($r, $cred);
if (ref($resp)) {
if ($msg = $resp->{message}) { $log->info($msg); }
unless ($resp->{uri}) { return SERVER_ERROR; }
$r->header_out(Location => $resp->{uri});
return REDIRECT;
#
# routines
#
## validate common hash credentials from
sub validateCredentials {
my $self = shift;
my($r, $cred) = @_;
my $log = $r->log;
my($uri, $requri, $resp, $uid);
$log->debug(ref($self), "->validateCredentials():");
## were illegitimate credentials found?
unless (defined($cred)) { # probably a key-change, treat as timeout
# but possibly tampering, so log as warning
$log->warn("Decryption Error");
$uid = $cred->{uid};
$log->debug("Setting user ID: '$uid'.");
$r->user($uid);
## checksum is good, examine the protection qualities and freshness
if ($resp = $self->validateQOP($r, $cred)) { return $resp; }
if ($resp = $self->validateAge($r, $cred)) { return $resp; }
## user authenticated
$log->info("User '$uid' authenticated.");
return undef;
}
## validate quality of protection
sub validateQOP {
my $self = shift;
my($r, $cred) = @_;
my($uri, $requri);
unless ($cred->{qop} >= $self->minSessQOP) {
}
return undef;
}
## validated time stamp
sub validateAge {
my $self = shift;
my($r, $cred) = @_;
my($life, $idle, $renew, $uid, $ts, $t, $uri, $requri);
## get object timing constants
## check times
$uid = $cred->{uid};
$ts = $cred->{timestamp};
$t = time;
$r->log->debug(sprintf(
"validateAge(): uid = '%s', time - ts = %.02f (min):"
. " vs renew = %d, idle = %d, life = %d",
$uid, ($t-$ts)/60.0, $renew, $idle, $life
));
if ($t > $ts + 60*$life) { # hard timeout
$uri = $self->timeoutURL;
=head2 Quality of Protection Arguments
minSessQOP => 128, minAuthQOP => 128, authQOP => 128, sessQOP => 128
When credentials are validated during a request, two checks of the
qualities of protection (QOP's) are made, namely that
qop >= minSessQOP
and
authqop >= minAuthQOP
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/Browseable/Cassandra.pm view on Meta::CPAN
$self->{object_store} =
new Apache::Session::Browseable::Store::Cassandra $self;
$self->{lock_manager} = new Apache::Session::Lock::Null $self;
$self->{generate} = \&Apache::Session::Generate::SHA256::generate;
$self->{validate} = \&Apache::Session::Generate::SHA256::validate;
$self->{serialize} = \&Apache::Session::Serialize::JSON::serialize;
$self->{unserialize} = \&Apache::Session::Serialize::JSON::unserialize;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/CacheAny.pm view on Meta::CPAN
my $self = shift;
$self->{object_store} = Apache::Session::Store::CacheAny->new($self);
$self->{lock_manager} = Apache::Session::Lock::Null->new($self);
$self->{generate} = \&Apache::Session::Generate::MD5::generate;
$self->{validate} = \&Apache::Session::Generate::MD5::validate;
$self->{serialize} = \&Apache::Session::Serialize::Storable::serialize;
$self->{unserialize} = \&Apache::Session::Serialize::Storable::unserialize;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/DBMS.pm view on Meta::CPAN
my $self = shift;
$self->{object_store} = new Apache::Session::Store::DBMS $self;
$self->{lock_manager} = new Apache::Session::Lock::Null $self;
$self->{generate} = \&Apache::Session::Generate::DBMS::generate;
$self->{validate} = \&Apache::Session::Generate::DBMS::validate;
if( exists $self->{args}->{Serialize} ) {
my $ser = "Apache::Session::Serialize::$self->{args}->{Serialize}";
if (!exists $incl->{$ser}) {
view all matches for this distribution
view release on metacpan or search on metacpan
AutoIncrement.pm view on Meta::CPAN
$session->{data}->{_session_id} = substr($cntstr, length($cntstr)-$length);
}
sub validate {
#This routine checks to ensure that the session ID is in the form
#we expect. This must be called before we start diddling around
#in the database or the disk.
my $session = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/Generate/Random.pm view on Meta::CPAN
sub generate {
my ($session) = @_;
return $session->{'data'}->{'_session_id'} = unpack( 'H*', Crypt::SysRandom::random_bytes(20) );
}
sub validate {
my ($session) = @_;
if ( $session->{data}->{_session_id} =~ /^[0-9a-f]{40}$/ ) {
return $session->{data}->{_session_id};
}
die "Invalid session ID: " . $session->{data}->{_session_id};
lib/Apache/Session/Generate/Random.pm view on Meta::CPAN
This module extends L<Apache::Session> to create secure random session ids using the system's source of randomness.
=for Pod::Coverage generate
=for Pod::Coverage validate
=head1 SEE ALSO
L<Apache::Session>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/Generate/UUID.pm view on Meta::CPAN
sub generate {
my ($session) = @_;
return $session->{'data'}->{'_session_id'} = Data::UUID->new->create_str();
}
sub validate {
my ($session) = @_;
if ($session->{'data'}->{'_session_id'} !~ /^[a-fA-F0-9\-]+$/xm) { die; }
return 1;
}
lib/Apache/Session/Generate/UUID.pm view on Meta::CPAN
=head1 FUNCTIONS
=head2 generate
=head2 validate
=head1 AUTHOR
Nick Gerakines, C<< <nick at socklabs.com> >>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/LDAP.pm view on Meta::CPAN
my $self = shift;
$self->{object_store} = new Apache::Session::Store::LDAP $self;
$self->{lock_manager} = new Apache::Session::Lock::Null $self;
$self->{generate} = \&Apache::Session::Generate::MD5::generate;
$self->{validate} = \&Apache::Session::Generate::MD5::validate;
$self->{serialize} = \&Apache::Session::Serialize::Base64::serialize;
$self->{unserialize} = \&Apache::Session::Serialize::Base64::unserialize;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/MariaDB.pm view on Meta::CPAN
my $self = shift;
$self->{object_store} = new Apache::Session::Store::MariaDB $self;
$self->{lock_manager} = new Apache::Session::Lock::MariaDB $self;
$self->{generate} = \&Apache::Session::Generate::MD5::generate;
$self->{validate} = \&Apache::Session::Generate::MD5::validate;
$self->{serialize} = \&Apache::Session::Serialize::Storable::serialize;
$self->{unserialize} = \&Apache::Session::Serialize::Storable::unserialize;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/Memcached.pm view on Meta::CPAN
sub populate {
my $self = shift;
$self->{object_store} = Apache::Session::Store::Memcached->new($self);
$self->{lock_manager} = Apache::Session::Lock::Null->new($self);
$self->{generate} = \&Apache::Session::Generate::MD5::generate;
$self->{validate} = \&Apache::Session::Generate::MD5::validate;
$self->{serialize} = \&Apache::Session::Serialize::Storable::serialize;
$self->{unserialize} = \&Apache::Session::Serialize::Storable::unserialize;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/Memorycached.pm view on Meta::CPAN
my $self = shift;
$self->{object_store} = new Apache::Session::Store::Memorycached $self;
$self->{lock_manager} = new Apache::Session::Lock::Memorycached $self;
$self->{generate} = \&Apache::Session::Generate::MD5::generate;
$self->{validate} = \&Apache::Session::Generate::MD5::validate;
$self->{serialize} = \&Apache::Session::Memorycached::none;
$self->{unserialize} = \&Apache::Session::Memorycached::none;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/MongoDB.pm view on Meta::CPAN
my $self = shift;
$self->{object_store} = Apache::Session::Store::MongoDB->new($self);
$self->{lock_manager} = Apache::Session::Lock::Null->new($self);
$self->{generate} = \&Apache::Session::Generate::MD5::generate;
$self->{validate} = \&Apache::Session::Generate::MD5::validate;
$self->{serialize} = \&Apache::Session::Serialize::MongoDB::serialize;
$self->{unserialize} = \&Apache::Session::Serialize::MongoDB::unserialize;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/NoSQL.pm view on Meta::CPAN
my $self = shift;
$self->{object_store} = new Apache::Session::Store::NoSQL $self;
$self->{lock_manager} = new Apache::Session::Lock::Null $self;
$self->{generate} = \&Apache::Session::Generate::MD5::generate;
$self->{validate} = \&Apache::Session::Generate::MD5::validate;
$self->{serialize} = \&Apache::Session::Serialize::Base64::serialize;
$self->{unserialize} = \&Apache::Session::Serialize::Base64::unserialize;
#$self->{serialize} = \&Apache::Session::Serialize::Storable::serialize;
#$self->{unserialize} = \&Apache::Session::Serialize::Storable::unserialize;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/PHP.pm view on Meta::CPAN
my $self = shift;
$self->{object_store} = Apache::Session::Store::PHP->new($self);
$self->{lock_manager} = Apache::Session::Lock::Null->new($self);
$self->{generate} = \&Apache::Session::Generate::MD5::generate;
$self->{validate} = \&Apache::Session::Generate::MD5::validate;
$self->{serialize} = \&Apache::Session::Serialize::PHP::serialize;
$self->{unserialize} = \&Apache::Session::Serialize::PHP::unserialize;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/SQLite.pm view on Meta::CPAN
my $self = shift;
$self->{object_store} = Apache::Session::Store::MySQL->new($self);
$self->{lock_manager} = Apache::Session::Lock::Null->new($self);
$self->{generate} = \&Apache::Session::Generate::MD5::generate;
$self->{validate} = \&Apache::Session::Generate::MD5::validate;
$self->{serialize} = \&Apache::Session::Serialize::Base64::serialize;
$self->{unserialize} = \&Apache::Session::Serialize::Base64::unserialize;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/SQLite3.pm view on Meta::CPAN
my $self = shift;
$self->{object_store} = Apache::Session::Store::SQLite3->new($self);
$self->{lock_manager} = Apache::Session::Lock::Null->new($self);
$self->{generate} = \&Apache::Session::Generate::MD5::generate;
$self->{validate} = \&Apache::Session::Generate::MD5::validate;
$self->{serialize} = \&Apache::Session::Serialize::Storable::serialize;
$self->{unserialize} = \&Apache::Session::Serialize::Storable::unserialize;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/SharedMem.pm view on Meta::CPAN
$self->{object_store} = new Apache::Session::Store::SharedMem $self;
$self->{lock_manager} = new Apache::Session::Lock::Null $self;
$self->{generate} = \&Apache::Session::Generate::MD5::generate;
$self->{validate} = \&Apache::Session::Generate::MD5::validate;
$self->{serialize} = \&Apache::Session::Serialize::Storable::serialize;
$self->{unserialize} = \&Apache::Session::Serialize::Storable::unserialize;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/Wrapper.pm view on Meta::CPAN
{ description => 'An invalid parameter or set of parameters was given',
alias => 'param_error' },
);
use Params::Validate 0.70;
use Params::Validate qw( validate SCALAR UNDEF BOOLEAN ARRAYREF OBJECT );
Params::Validate::validation_options( on_fail => sub { param_error( join '', @_ ) } );
use Scalar::Util ();
lib/Apache/Session/Wrapper.pm view on Meta::CPAN
return $string;
}
sub RegisterClass {
my $class = shift;
my %p = validate( @_, { name => { type => SCALAR },
required => { type => SCALAR | ARRAYREF, default => [ [ ] ] },
optional => { type => SCALAR | ARRAYREF, default => [ ] },
},
);
lib/Apache/Session/Wrapper.pm view on Meta::CPAN
$class->_SetValidParams();
}
sub RegisterFlexClass {
my $class = shift;
my %p = validate( @_, { type => { type => SCALAR,
regex => qr/^(?:store|lock|generate|serialize)/,
},
name => { type => SCALAR },
required => { type => SCALAR | ARRAYREF, default => [ [ ] ] },
optional => { type => SCALAR | ARRAYREF, default => [ ] },
lib/Apache/Session/Wrapper.pm view on Meta::CPAN
}
sub session
{
my $self = shift;
my %p = validate( @_,
{ session_id =>
{ type => SCALAR,
optional => 1,
},
} );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/libmemcached.pm view on Meta::CPAN
my ($self) = @_;
$self->{object_store} = Apache::Session::Store::libmemcached->new($self);
$self->{lock_manager} = Apache::Session::Lock::Null->new($self);
$self->{generate} = \&Apache::Session::Generate::MD5::generate;
$self->{validate} = \&Apache::Session::Generate::MD5::validate;
$self->{serialize} = \&Apache::Session::Serialize::Storable::serialize;
$self->{unserialize} = \&Apache::Session::Serialize::Storable::unserialize;
return $self;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session.pm view on Meta::CPAN
#get the session data back out again during some other request
my %session;
tie %session, 'Apache::Session::MySQL', $id;
validate($session{visa_number});
#delete a session from the object store permanently
tied(%session)->delete;
lib/Apache/Session.pm view on Meta::CPAN
if (defined $session_id && $session_id) {
#check the session ID for remote exploitation attempts
#this will die() on suspicious session IDs.
&{$self->{validate}}($self);
if (exists $args->{Transaction} && $args->{Transaction}) {
$self->acquire_write_lock;
}
view all matches for this distribution
view release on metacpan or search on metacpan
SessionX.pm view on Meta::CPAN
if (defined $session_id && $session_id)
{
#check the session ID for remote exploitation attempts
#this will die() on suspicious session IDs.
#eval { &{$self->{validate}}($self); } ;
&{$self->{validate}}($self);
#if (!$@)
{ # session id is ok
$self->{status} &= ($self->{status} ^ NEW);
SessionX.pm view on Meta::CPAN
return new {$self -> {'args'}{'lock_manager'}} $self;
}
#
# Default validate for Apache::Session < 1.53
#
sub validate {
#This routine checks to ensure that the session ID is in the form
#we expect. This must be called before we start diddling around
#in the database or the disk.
my $session = shift;
SessionX.pm view on Meta::CPAN
$self->{object_store} = new $store $self if ($store) ;
$self->{lock_manager} = new $lock $self if ($lock);
$self->{generate} = \&{$gen . '::generate'} if ($gen);
$self->{'validate'} = \&{$gen . '::validate'} if ($gen && defined (&{$gen . '::validate'}));
$self->{serialize} = \&{$ser . '::serialize'} if ($ser);
$self->{unserialize} = \&{$ser . '::unserialize'} if ($ser) ;
if (!defined ($self->{'validate'}))
{
$self->{'validate'} = \&validate ;
}
$self->{populated} = 1 ;
}
else
{ # recreate only store & lock classes as far as necessary
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/SiteControl/User.pm view on Meta::CPAN
my $r = shift;
if(!defined($this) || !defined($r)) {
croak "INVALID CALL TO LOGOUT. You forgot to use OO syntax, or you forgot to pass the request object.";
}
eval("$this->{manager}" . '->invalidate($r, $this)');
if($@) {
$r->log_error("Logout failed: $@");
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/TS/AdminClient.pm view on Meta::CPAN
proxy.config.http.cache.required_headers
proxy.config.http.cache.vary_default_images
proxy.config.http.cache.vary_default_other
proxy.config.http.cache.vary_default_text
proxy.config.http.cache.when_to_add_no_cache_to_msie_requests
proxy.config.http.cache.when_to_revalidate
proxy.config.http.chunking_enabled
proxy.config.http.congestion_control.default.client_wait_interval
proxy.config.http.congestion_control.default.congestion_scheme
proxy.config.http.congestion_control.default.dead_os_conn_retries
proxy.config.http.congestion_control.default.dead_os_conn_timeout
view all matches for this distribution
view release on metacpan or search on metacpan
Template.xs view on Meta::CPAN
create_srv_config_sv, /* server config creator */
perl_perl_merge_srv_config, /* server config merger */
mod_cmds, /* command table */
NULL, /* [7] list of handlers */
NULL, /* [2] filename-to-URI translation */
NULL, /* [5] check/validate user_id */
NULL, /* [6] check user_id is valid *here* */
NULL, /* [4] check access by host address */
NULL, /* [7] MIME type checker/setter */
NULL, /* [8] fixups */
NULL, /* [10] logger */
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/TestConfig.pm view on Meta::CPAN
-e $vars->{t_conf_file} &&
-M $exe < -M $vars->{t_conf_file};
# any .in files are newer than their derived versions?
if (my @files = $self->extra_conf_files_needing_update) {
# invalidate the vhosts cache, since a different port could be
# assigned on reparse
$self->{vhosts} = {};
for my $file (@files) {
push @reasons, "$file.in is newer than $file";
}
view all matches for this distribution