File: _Slave.pm

package info (click to toggle)
lemonldap-ng 1.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 13,084 kB
  • ctags: 2,440
  • sloc: perl: 25,708; makefile: 622; sh: 176; php: 6; sql: 5
file content (28 lines) | stat: -rw-r--r-- 599 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
##@file
# Slave common functions

##@class
# Slave common functions
package Lemonldap::NG::Portal::_Slave;

use Exporter;
use base qw(Exporter);
use strict;

our @EXPORT  = qw(checkIP);
our $VERSION = '1.2.0';

## @method Lemonldap::NG::Portal::_Slave checkIP()
# @return true if remote IP is accredited in LL::NG conf
sub checkIP {
    my $self     = shift;
    my $remoteIP = $self->remote_addr;
    return 1
      if (!$self->{slaveMasterIP}
        || $self->{slaveMasterIP} =~ /\b$remoteIP\b/ );

    $self->_sub( 'userError', "Client IP not accredited for Slave module" );
    return 0;
}

1;