This file is indexed.

/usr/share/perl5/Lemonldap/NG/Portal/IssuerDBGet.pm is in liblemonldap-ng-portal-perl 1.9.16-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
## @file
# Get Issuer file
# Enable get parameters for specific applications

## @class
# Get Issuer class
package Lemonldap::NG::Portal::IssuerDBGet;

use strict;
use Lemonldap::NG::Portal::Simple;
use MIME::Base64;
use URI::Escape;
use base qw(Lemonldap::NG::Portal::_LibAccess);

our $VERSION = '1.9.3';

## @method void issuerDBInit()
# Nothing to do
# @return Lemonldap::NG::Portal error code
sub issuerDBInit {
    my $self = shift;

    return PE_OK;
}

## @apmethod int issuerForUnAuthUser()
# Manage Get request for unauthenticated user
# @return Lemonldap::NG::Portal error code
sub issuerForUnAuthUser {
    my $self = shift;

    # Get URLs
    my $issuerDBGetPath = $self->{issuerDBGetPath};
    my $get_login       = 'login';
    my $get_logout      = 'logout';

    # Called URL
    my $url = $self->url();
    my $url_path = $self->url( -absolute => 1 );
    $url_path =~ s#^//#/#;

    # 1. LOGIN
    if ( $url_path =~ m#${issuerDBGetPath}${get_login}#o ) {

        $self->lmLog( "URL $url detected as a Get LOGIN URL", 'debug' );

        # Keep values in hidden fields

    }

    # 2. LOGOUT
    if ( $url_path =~ m#${issuerDBGetPath}${get_logout}#o ) {

        $self->lmLog( "URL $url detected as an Get LOGOUT URL", 'debug' );

        # GET parameters
        my $logout_url = $self->param('url');

        if ($logout_url) {

            # Display a link to the provided URL
            $self->lmLog( "Logout URL $logout_url will be displayed", 'debug' );

            $self->info("<h3>Back to logout url</h3>");
            $self->info("<p><a href=\"$logout_url\">$logout_url</a></p>");
            $self->{activeTimer} = 0;

            return PE_CONFIRM;
        }

        return PE_LOGOUT_OK;

    }

    return PE_OK;
}

## @apmethod int issuerForAuthUser()
# Manage Get request for authenticated user
# @return Lemonldap::NG::Portal error code
sub issuerForAuthUser {
    my $self = shift;

    # Get URLs
    my $issuerDBGetPath = $self->{issuerDBGetPath};
    my $get_login       = 'login';
    my $get_logout      = 'logout';

    # Called URL
    my $url = $self->url();
    my $url_path = $self->url( -absolute => 1 );
    $url_path =~ s#^//#/#;

    # Session ID
    my $session_id = $self->{sessionInfo}->{_session_id} || $self->{id};

    # Session creation timestamp
    my $time = $self->{sessionInfo}->{_utime} || time();

    # 1. LOGIN
    if ( $url_path =~ m#${issuerDBGetPath}${get_login}#o ) {

        $self->lmLog( "URL $url detected as an Get LOGIN URL", 'debug' );

        # Compute GET parameters to send and build urldc accordingly
        &computeGetParams($self);

        $self->lmLog( "Redirect user to " . $self->{urldc}, 'debug' );

        return $self->_subProcess(qw(autoRedirect));
    }

    # 2. LOGOUT
    if ( $url_path =~ m#${issuerDBGetPath}${get_logout}#o ) {

        $self->lmLog( "URL $url detected as an Get LOGOUT URL", 'debug' );

        # GET parameters
        my $logout_url = $self->param('url');

        # Delete local session
        unless (
            $self->_deleteSession( $self->getApacheSession( $session_id, 1 ) ) )
        {
            $self->lmLog( "Fail to delete session $session_id ", 'error' );
        }

        if ($logout_url) {

            # Display a link to the provided URL
            $self->lmLog( "Logout URL $logout_url will be displayed", 'debug' );

            $self->info("<h3>back to logout url</h3>");
            $self->info("<p><a href=\"$logout_url\">$logout_url</a></p>");
            $self->{activeTimer} = 0;

            return PE_CONFIRM;
        }

        return PE_LOGOUT_OK;

    }

    return PE_OK;
}

## @apmethod int issuerLogout()
# Does nothing
# @return Lemonldap::NG::Portal error code
sub issuerLogout {
    my $self = shift;

    # Session ID
    my $session_id = $self->{sessionInfo}->{_session_id} || $self->{id};

    # Delete linked Get sessions

    return PE_OK;
}

## @apmethod string computeGetParams()
# compute GET parameters to send to application
# build urldc accordingly
# @return nothing
sub computeGetParams {
    my $self = shift;

    # Additional GET variables
    my $getVars = "";
    if ( exists $self->{issuerDBGetParameters} ) {
        my $issuerDBGetParameters = $self->{issuerDBGetParameters};
        foreach my $vhost ( keys %$issuerDBGetParameters ) {

            # if vhost is matching
            if ( index( $self->{urldc}, $vhost ) != -1 ) {
                my $params = $issuerDBGetParameters->{$vhost};
                foreach my $param ( keys %$params ) {
                    my $value = $self->{sessionInfo}->{ $params->{$param} };

                    # Chain GET parameters unless there are evaluation errors
                    $getVars .= "&" . $param . "=" . uri_escape($value)
                      unless $@;
                }
            }
        }
    }
    $getVars =~ s/^\&//;         # remove first &
    $getVars =~ s/[\r\n\t]//;    # remove invalid characters

    # If there are some GET variables to send
    # Add them to URL string
    if ( $getVars ne "" ) {
        my $urldc = $self->{urldc};

        $urldc .= ( $urldc =~ /\?\w/ )
          ?

          # there are already get variables
          "&" . $getVars
          :

          # there are no get variables
          "?" . $getVars;
        $self->{urldc} = $urldc;
    }

}

1;

__END__

=head1 NAME

=encoding utf8

Lemonldap::NG::Portal::IssuerDBGet - Get IssuerDB for LemonLDAP::NG

=head1 DESCRIPTION

Get Issuer implementation in LemonLDAP::NG

=head1 SEE ALSO

L<Lemonldap::NG::Portal>,

=head1 AUTHOR

=over

=item David Coutadeur, E<lt>dcoutadeur@linagora.comE<gt>

=back

=head1 BUG REPORT

Use OW2 system to report bug or ask for features:
L<https://gitlab.ow2.org/lemonldap-ng/lemonldap-ng/issues>

=head1 DOWNLOAD

Lemonldap::NG is available at
L<http://forge.objectweb.org/project/showfiles.php?group_id=274>

=head1 COPYRIGHT AND LICENSE

=over

=item Copyright (C) 2016 by David Coutadeur, E<lt>dcoutadeur@linagora.comE<gt>

=back

This library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see L<http://www.gnu.org/licenses/>.

=cut