This file is indexed.

/usr/share/php/Horde/Compress/Rar.php is in php-horde-compress 2.2.1-1ubuntu1.

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
<?php
/**
 * Copyright 2008-2017 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 *
 * @author   Michael Cochrane <mike@graftonhall.co.nz>
 * @author   Michael Slusarz <slusarz@horde.org>
 * @category Horde
 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 * @package  Compress
 */

/**
 * This class allows rar files to be read.
 *
 * @author    Michael Cochrane <mike@graftonhall.co.nz>
 * @author    Michael Slusarz <slusarz@horde.org>
 * @category  Horde
 * @copyright 2008-2017 Horde LLC
 * @license   http://www.horde.org/licenses/lgpl21 LGPL 2.1
 * @package   Compress
 */
class Horde_Compress_Rar extends Horde_Compress_Base
{
    const BLOCK_START = "\x52\x61\x72\x21\x1a\x07\x00";

    /**
     */
    public $canDecompress = true;

    /**
     * Rar compression methods
     *
     * @var array
     */
    protected $_methods = array(
        0x30 => 'Store',
        0x31 => 'Fastest',
        0x32 => 'Fast',
        0x33 => 'Normal',
        0x34 => 'Good',
        0x35 => 'Best'
    );

    /**
     * @return array  Info on the compressed file:
     * <pre>
     * KEY: Position in RAR archive
     * VALUES:
     *   attr - File attributes
     *   date - File modification time
     *   csize - Compressed file size
     *   method - Compression method
     *   name - Filename
     *   size - Original file size
     * </pre>
     *
     * @throws Horde_Compress_Exception
     */
    public function decompress($data, array $params = array())
    {
        $blockStart = strpos($data, self::BLOCK_START);
        if ($blockStart === false) {
            throw new Horde_Compress_Exception(Horde_Compress_Translation::t("Invalid RAR data."));
        }

        $data_len = strlen($data);
        $position = $blockStart + 7;
        $return_array = array();

        while ($position < $data_len) {
            if ($position + 7 > $data_len) {
                throw new Horde_Compress_Exception(Horde_Compress_Translation::t("Invalid RAR data."));
            }
            //$head_crc = substr($data, $position, 2);
            $head_type = ord(substr($data, $position + 2, 1));
            $head_flags = unpack('vFlags', substr($data, $position + 3, 2));
            $head_flags = $head_flags['Flags'];
            $head_size = unpack('vSize', substr($data, $position + 5, 2));
            $head_size = $head_size['Size'];

            $position += 7;
            $head_size -= 7;

            switch ($head_type) {
            case 0x73:
                /* Archive header */
                $position += $head_size;
                break;

            case 0x74:
                /* File Header */
                $info = unpack(
                    'VPacked/VUnpacked/COS/VCRC32/VTime/CVersion/CMethod/vLength/vAttrib',
                    substr($data, $position)
                );
                $year = (($info['Time'] >> 25) & 0x7f) + 80;
                $name = substr($data, $position + 25, $info['Length']);
                if ($unicode = strpos($name, "\0")) {
                    $name = substr($name, 0, $unicode);
                }

                $return_array[] = array(
                    'name' => $name,
                    'size' => $info['Unpacked'],
                    'csize' => $info['Packed'],
                    'date' => mktime(
                        (($info['Time'] >> 11) & 0x1f),
                        (($info['Time'] >> 5) & 0x3f),
                        (($info['Time'] << 1) & 0x3e),
                        (($info['Time'] >> 21) & 0x07),
                        (($info['Time'] >> 16) & 0x1f),
                        $year < 1900 ? $year + 1900 : $year
                    ),
                    'method' => $this->_methods[$info['Method']],
                    'attr' => (($info['Attrib'] & 0x10) ? 'D' : '-') .
                              (($info['Attrib'] & 0x20) ? 'A' : '-') .
                              (($info['Attrib'] & 0x03) ? 'S' : '-') .
                              (($info['Attrib'] & 0x02) ? 'H' : '-') .
                              (($info['Attrib'] & 0x01) ? 'R' : '-')
                );

                $position += $head_size + $info['Packed'];
                break;

            default:
                if ($head_size == -7) {
                    /* We've already added 7 bytes above. If we remove those
                     * same 7 bytes, we will enter an infinite loop. */
                    throw new Horde_Compress_Exception(Horde_Compress_Translation::t("Invalid RAR data."));
                }
                $position += $head_size;
                break;
            }
        }

        return $return_array;
    }
}