This file is indexed.

/usr/share/perl5/EBox/CGI/CA/ShowForm.pm is in zentyal-ca 2.3.6+quantal1.

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
# Copyright (C) 2008-2012 eBox Technologies S.L.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2, as
# published by the Free Software Foundation.
#
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

package EBox::CGI::CA::ShowForm;

use strict;
use warnings;

use base 'EBox::CGI::ClientBase';

use EBox::Gettext;
use EBox::Global;
use EBox;

# Method: new
#
#       Constructor for ShowForm CGI.
#       Show a common form (one for revokation and other for renewal)
#
# Returns:
#
#       ShowForm - The object recently created

sub new
  {

    my $class = shift;

    my $self = $class->SUPER::new('title' => __('Certification Authority'),
				  @_);

    bless($self, $class);

    return $self;

  }

# Process the HTTP query

sub _process
  {

    my $self = shift;

    my $ca = EBox::Global->modInstance('ca');

    my @array = ();

    my $cn = $self->unsafeParam('cn');
    unless (defined($cn) and ($cn ne '')) {
        throw EBox::Exceptions::DataMissing(data =>  __('Common Name') );
    }
    # Only valid chars minus '/' plus '*' --> security risk
    unless ( $cn =~ m{^[\w .?&+:\-\@\*]*$} ) {
        throw EBox::Exceptions::External(__('The input contains invalid ' .
                                         'characters. All alphanumeric characters, ' .
					 'plus these non alphanumeric chars: .?&+:-@* ' .
					 'and spaces are allowed.'));
    }

    $self->_requireParam('action', __('Action'));

    my $action = $self->param('action');

    if ($action eq "revoke") {
      $self->{template} = "ca/formRevoke.mas";
    } elsif ($action eq "renew") {
      $self->{template} = "ca/formRenew.mas";
    } elsif ($action eq "reissue") {
      $self->{template} = "ca/formReissue.mas";
    } else {
      throw EBox::Exceptions::External(__('Only revoke, renew and reissue actions are performed'));
    }

    my $cert = $ca->getCertificateMetadata(cn => $cn);

    if (not defined($cert) ) {
      # If the common name does NOT exist sent to Index.pm
      $self->{errorchain} = "CA/Index";
      throw EBox::Exceptions::External(__x("Common name: {cn} does NOT exist in database"
					   , cn => $cn));
    }

    push (@array, metaDataCert => $cert);
    push (@array, reasons => $ca->revokeReasons());
    push (@array, passRequired => $ca->passwordRequired());

    $self->{params} = \@array;

  }

1;