view release on metacpan or search on metacpan
$arg{cookie_name}, $ticket, $domain_elt, $path_elt, $secure_elt;
}
# Returns a hashref representing the original ticket components
# Returns undef if there were any errors
sub validate_ticket
{
my $self = shift;
my $ticket = shift || croak "No ticket passed to validate_ticket";
my %arg = ( %$self, @_ );
$arg{ip_addr} = $arg{ignore_ip} ? '0.0.0.0' : $ENV{REMOTE_ADDR}
unless exists $arg{ip_addr};
# 0 or undef ip_addr treated as 0.0.0.0
}
return $parts;
}
# Alias for compatibility with Jose/Ton's original patch
*valid_ticket = \&validate_ticket;
1;
__END__
Tickets are typically generated by a login web page of some kind
when a user has been authenticated. The ticket contains a username/uid
for the authenticated user, and often also the IP address they
authenticated from, a set of authorisation tokens, and any other user
data required. The ticket also includes an MD5 hash of all the included
user data plus a shared secret, so that tickets can be validated by
mod_auth_tkt without requiring access to the user repository.
See http://www.openfusion.com.au/labs/mod_auth_tkt for mod_auth_tkt
itself.
=back
=head2 TICKET PARSING AND VALIDATION
You may parse and validate existing tickets with the validate_ticket()
method. It takes as its first parameter the ticket to be validated, and
then an optional list of named parameter overrides
(e.g. ip_addr => 'x.x.x.x'). If the ticket is valid, validate_ticket
returns a hashref with the following key/value pairs:
=over 4
=item digest
=item data
=back
validate_ticket() will return undef if any errors with the ticket value
are encountered.
The validate_ticket() method algorithm is analogous to the function with
the same name in the mod_auth_tkt C module.
There is also a parse_ticket() method available that parses the ticket
without running it through the validation phase, and returns the same
data as validate_ticket(). This is only safe to use where you are certain
that the ticket has been validated elsewhere. In general it's considerably
safer to just use validate_ticket.
=head2 DIGEST TYPES
As of version 2.1.0, mod_auth_tkt supports multiple digest types. The
view all matches for this distribution
view release on metacpan or search on metacpan
AuthzLDAP.pm view on Meta::CPAN
# Look up the group
my $filter = qq(($groupattrtype=$group));
$r->log->debug("check_group: Iterating over group $group");
$r->log->debug("check_group: Using filter: $filter");
$r->log->debug("check_group: Using base: $basedn");
# Want to just validate group's existence, not get its contents
my $msg = $ld->search(base => $basedn, filter => $filter,
attrs => [ $nestedattrtype ]);
unless ($msg->code == LDAP_SUCCESS) {
$r->note_basic_auth_failure;
$r->log_reason("user $userinfo: Could not search for $group: " .
view all matches for this distribution
view release on metacpan or search on metacpan
AutoLogin.pm view on Meta::CPAN
my %cookiejar = Apache::Cookie->new($r)->parse;
## If the user has called the predefined logout page,
## invalidate the cookie
if ($r->uri() eq $logout_uri)
{
$log->info("User from $client_identifier logged out (".$r->uri().")");
my $i=0;
AutoLogin.pm view on Meta::CPAN
PerlSetVar AutoLoginEncryptionKey "abcdefghijklmnopqrstuvwxyz123456"
# set the logout page: Important, make
# sure that you specify something
# that gets not cached by proxies, or
# else the cookie won't be invalidated.
PerlSetVar AutoLoginLogoutPage "/logout.php"
# The name of the cookie
AutoLogin.pm view on Meta::CPAN
The encryption key to use. Based on this key via md5 some fairly random 256 bit key will be generated. You may change it regularly.
=head2 AutoLoginLogoutPage "/logout.php"
The logout URI. Make sure, that it does not get cached by any proxies or else the cookie cannot be invalidated and that this URI can be accessed without authentication!
=head2 AutoLoginAuthName "AutoLogin rulez"
The name of the cookie.
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
);
while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
$pattern =~ s{\s+}{\\s+}g;
if ( $license_text =~ /\b$pattern\b/i ) {
if ( $osi and $license_text =~ /All rights reserved/i ) {
warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it.";
}
$self->license($license);
return 1;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/AxKit/Plugin/Session.pm view on Meta::CPAN
}
# ____ End of fixup_redirect ____
# This one can be used as PerlHandler if a non-mod_perl script is doing the login form
# In that case, be sure to validate the login in authen_cred above!
#===============
sub login ($$) {
#---------------
my ($self, $r, $destination ) = @_;
$self->debug(3,"======= login(".join(',',@_).")");
lib/Apache/AxKit/Plugin/Session.pm view on Meta::CPAN
# ____ End of login ____
# Again, this can be used as PerlHandler or called directly
# subclass this one if you want to invalidate a session db
# entry or something like that
#================
sub orig_logout ($$) {
#----------------
my ($self,$r, $location) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/AxKit/Provider/XMLDOMProvider.pm view on Meta::CPAN
# debug
#print STDERR Dumper( "mtime in secs: ", $mtime );
}
else {
# else invalidate cache
$mtime = time();
# debug
#print STDERR Dumper("now: ", $mtime );
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Backend/POE.pm view on Meta::CPAN
This can be used as a simple way to have apache servers establish connections
on process startup. Alias defaults to 'backend'
Apache::Backend::POE->setPingTimeOut($timeout, $alias);
This configures the usage of the ping method, to validate a connection.
Setting the timeout to 0 will always validate the connection using the ping
method (default). Setting the timeout < 0 will de-activate the validation of
the connection object. Setting the timeout > 0 will ping the connection only if
the last access was more than timeout seconds before. Alias defaults to 'backend'
For the menu item 'Backend POE connections' you need to call Apache::Status BEFORE
view all matches for this distribution
view release on metacpan or search on metacpan
mod_dav-1.0.3.patch view on Meta::CPAN
+ array_header *ctx_list;
+ dav_prop_ctx *ctx;
+
+ *propstat_text_ptr = NULL ;
+
+ if (doc == NULL || !dav_validate_root(doc, "propertyupdate")) {
+ /* This supplies additional information for the default message. */
+ ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+ "The request body does not contain "
+ "a \"propertyupdate\" element.");
+ return HTTP_BAD_REQUEST;
+ }
+
+ /* Check If-Headers and existing locks */
+ /* Note: depth == 0. Implies no need for a multistatus response. */
+ if ((err = dav_validate_request(r, resource, 0, NULL, NULL,
+ DAV_VALIDATE_RESOURCE, NULL)) != NULL) {
+ /* ### add a higher-level description? */
+ return dav_handle_err(r, err, NULL);
+ }
+
mod_dav-1.0.3.patch view on Meta::CPAN
+ err);
+ return dav_handle_err(r, err, NULL);
+ }
+ /* ### what to do about closing the propdb on server failure? */
+
+ /* ### validate "live" properties */
+
+ /* set up an array to hold property operation contexts */
+ ctx_list = ap_make_array(r->pool, 10, sizeof(dav_prop_ctx));
+
+ /* do a first pass to ensure that all "remove" properties exist */
mod_dav-1.0.3.patch view on Meta::CPAN
+ ctx->operation = is_remove ? DAV_PROP_OP_DELETE : DAV_PROP_OP_SET;
+ ctx->prop = one_prop;
+
+ ctx->r = r; /* for later use by dav_prop_log_errors() */
+
+ dav_prop_validate(ctx);
+
+ if ( DAV_PROP_CTX_HAS_ERR(*ctx) ) {
+ failure = 1;
+ }
+ }
mod_dav-1.0.3.patch view on Meta::CPAN
result = dav_get_resource(r, &resource);
@@ -1948,103 +2060,9 @@
}
/* note: doc == NULL if no request body */
- if (doc == NULL || !dav_validate_root(doc, "propertyupdate")) {
- /* This supplies additional information for the default message. */
- ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
- "The request body does not contain "
- "a \"propertyupdate\" element.");
- return HTTP_BAD_REQUEST;
- }
-
- /* Check If-Headers and existing locks */
- /* Note: depth == 0. Implies no need for a multistatus response. */
- if ((err = dav_validate_request(r, resource, 0, NULL, NULL,
- DAV_VALIDATE_RESOURCE, NULL)) != NULL) {
- /* ### add a higher-level description? */
- return dav_handle_err(r, err, NULL);
- }
-
mod_dav-1.0.3.patch view on Meta::CPAN
- err);
- return dav_handle_err(r, err, NULL);
- }
- /* ### what to do about closing the propdb on server failure? */
-
- /* ### validate "live" properties */
-
- /* set up an array to hold property operation contexts */
- ctx_list = ap_make_array(r->pool, 10, sizeof(dav_prop_ctx));
-
- /* do a first pass to ensure that all "remove" properties exist */
mod_dav-1.0.3.patch view on Meta::CPAN
- ctx->operation = is_remove ? DAV_PROP_OP_DELETE : DAV_PROP_OP_SET;
- ctx->prop = one_prop;
-
- ctx->r = r; /* for later use by dav_prop_log_errors() */
-
- dav_prop_validate(ctx);
-
- if ( DAV_PROP_CTX_HAS_ERR(*ctx) ) {
- failure = 1;
- }
- }
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/AuthDBI.pm view on Meta::CPAN
UPDATE pwd_table SET log_field = log_string WHERE uid_field = user
Authorization:
When the authorization handler is called, the authentication has already been
done. This means, that the given username/password has been validated.
The handler analyzes and processes the requirements line by line. The request
is accepted if the first requirement is fulfilled.
In case of 'valid-user' the request is accepted.
view all matches for this distribution
view release on metacpan or search on metacpan
Dynagzip.pm view on Meta::CPAN
$r->header_out("X-Module-Sender" => __PACKAGE__);
# Client Local Cache Control (see rfc2068):
# The Expires entity-header field gives the date/time after which the response should be
# considered stale. A stale cache entry may not normally be returned by a cache
# (either a proxy cache or an user agent cache) unless it is first validated with the origin server
# (or with an intermediate cache that has a fresh copy of the entity).
# The format is an absolute date and time as defined by HTTP-date in section 3.3;
# it MUST be in RFC1123-date format: Expires = "Expires" ":" HTTP-date
my $life_length = $r->dir_config('pageLifeTime') || PAGE_LIFE_TIME_DEFAULT;
my $now = time() + $life_length;
Dynagzip.pm view on Meta::CPAN
The control over the lifetime of the response in client's cache is provided
through implementation of C<Expires> HTTP header:
The Expires entity-header field gives the date/time after which the response should be considered stale.
A stale cache entry may not normally be returned by a cache (either a proxy cache or an user agent cache)
unless it is first validated with the origin server (or with an intermediate cache that has a fresh copy
of the entity). The format is an absolute date and time as defined by HTTP-date in section 3.3;
it MUST be in rfc1123-date format:
C<Expires = "Expires" ":" HTTP-date>
view all matches for this distribution
view release on metacpan or search on metacpan
create_srv_config_sv, /* server config creator */
NULL, /* 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
Client/lib/HTTunnel/Client.pod view on Meta::CPAN
=item get_peer_info ( )
The C<get_peer_info> method returns information about the remote connection.
A string containing the IP address and port number, separated by a colon (:)
is returned. This method can be useful with UDP connections to validate the
sender of each packet.
=item request_callback ( REQUEST )
The C<request_callback> method is a callback method that can be used to
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Hadoop/WebHDFS.pm view on Meta::CPAN
=item * renewdelegationtoken() - renews a delegation token from the namenode.
$hdfsclient->renewdelegationtoken();
=item * canceldelegationtoken() - informs the namenode to invalidate the delegation token as it's no longer needed. When calling this method, the delegation token is also removed from the perl WebHDFS object.
$hdfsclient->canceldelegationtoken();
=item * Open() - opens file on HDFS and returns it's content The only required value for Open() is 'file', all others are optional. The values, 'offset', 'length', and 'buffersize', are meant to be sized in bytes.
view all matches for this distribution
view release on metacpan or search on metacpan
mod_aimproxy.c view on Meta::CPAN
aimproxySrvConfig, /* create per-server config structures */
NULL, /* merge per-server config structures */
command_table, /* table of config file commands */
NULL, /* [#8] MIME-typed-dispatched handlers */
NULL, /* [#1] URI to filename translation */
NULL, /* [#4] validate user id from request */
NULL, /* [#5] check if the user is ok _here_ */
NULL, /* [#3] check access by host address */
NULL, /* [#6] determine MIME type */
aimproxyHandler, /* [#7] pre-run fixups */
NULL, /* [#9] log a transaction */
view all matches for this distribution
view release on metacpan or search on metacpan
create_srv_config_sv, /* server config creator */
NULL, /* 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
UPDATE pwd_table SET log_field = log_string WHERE uid_field = user
Authorization:
When the authorization handler is called, the authentication has already been
done. This means, that the given username/password has been validated.
The handler analyzes and processes the requirements line by line. The request
is accepted if the first requirement is fulfilled.
In case of 'valid-user' the request is accepted.
view all matches for this distribution
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/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.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