This file is indexed.

/usr/share/php/Auth/Container/File.php is in php-auth 1.6.4-1.

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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */

/**
 * Storage driver for use against a generic password file
 *
 * PHP versions 4 and 5
 *
 * LICENSE: This source file is subject to version 3.01 of the PHP license
 * that is available through the world-wide-web at the following URI:
 * http://www.php.net/license/3_01.txt.  If you did not receive a copy of
 * the PHP License and are unable to obtain it through the web, please
 * send a note to license@php.net so we can mail you a copy immediately.
 *
 * @category   Authentication
 * @package    Auth
 * @author     Stefan Ekman <stekman@sedata.org>
 * @author     Martin Jansen <mj@php.net>
 * @author     Mika Tuupola <tuupola@appelsiini.net>
 * @author     Michael Wallner <mike@php.net>
 * @author     Adam Ashley <aashley@php.net>
 * @copyright  2001-2006 The PHP Group
 * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
 * @version    CVS: $Id: File.php 237449 2007-06-12 03:11:27Z aashley $
 * @link       http://pear.php.net/package/Auth
 */

/**
 * Include PEAR File_Passwd package
 */
require_once "File/Passwd.php";
/**
 * Include Auth_Container base class
 */
require_once "Auth/Container.php";
/**
 * Include PEAR package for error handling
 */
require_once "PEAR.php";

/**
 * Storage driver for fetching login data from an encrypted password file.
 *
 * This storage container can handle CVS pserver style passwd files.
 *
 * @category   Authentication
 * @package    Auth
 * @author     Stefan Ekman <stekman@sedata.org>
 * @author     Martin Jansen <mj@php.net>
 * @author     Mika Tuupola <tuupola@appelsiini.net>
 * @author     Michael Wallner <mike@php.net>
 * @author     Adam Ashley <aashley@php.net>
 * @copyright  2001-2006 The PHP Group
 * @license    http://www.php.net/license/3_01.txt  PHP License 3.01
 * @version    Release: @package_version@  File: $Revision: 237449 $
 * @link       http://pear.php.net/package/Auth
 */
class Auth_Container_File extends Auth_Container
{

    // {{{ properties

    /**
     * Path to passwd file
     *
     * @var string
     */
    var $pwfile = '';

    /**
     * Options for container
     *
     * @var array
     */
    var $options = array();

    // }}}
    // {{{ Auth_Container_File() [constructor]

    /**
     * Constructor of the container class
     *
     * @param  string $filename             path to passwd file
     * @return object Auth_Container_File   new Auth_Container_File object
     */
    function Auth_Container_File($filename) {
        $this->_setDefaults();

        // Only file is a valid option here
        if(is_array($filename)) {
            $this->pwfile = $filename['file'];
            $this->_parseOptions($filename);
        } else {
            $this->pwfile = $filename;
        }
    }

    // }}}
    // {{{ fetchData()

    /**
     * Authenticate an user
     *
     * @param   string  username
     * @param   string  password
     * @return  mixed   boolean|PEAR_Error
     */
    function fetchData($user, $pass)
    {
        $this->log('Auth_Container_File::fetchData() called.', AUTH_LOG_DEBUG);
        return File_Passwd::staticAuth($this->options['type'], $this->pwfile, $user, $pass);
    }

    // }}}
    // {{{ listUsers()

    /**
     * List all available users
     *
     * @return   array
     */
    function listUsers()
    {
        $this->log('Auth_Container_File::listUsers() called.', AUTH_LOG_DEBUG);

        $pw_obj = &$this->_load();
        if (PEAR::isError($pw_obj)) {
            return array();
        }

        $users  = $pw_obj->listUser();
        if (!is_array($users)) {
            return array();
        }

        foreach ($users as $key => $value) {
            $retVal[] = array("username" => $key,
                              "password" => $value['passwd'],
                              "cvsuser"  => $value['system']);
        }

        $this->log('Found '.count($retVal).' users.', AUTH_LOG_DEBUG);

        return $retVal;
    }

    // }}}
    // {{{ addUser()

    /**
     * Add a new user to the storage container
     *
     * @param string username
     * @param string password
     * @param mixed  Additional parameters to File_Password_*::addUser()
     *
     * @return boolean
     */
    function addUser($user, $pass, $additional='')
    {
        $this->log('Auth_Container_File::addUser() called.', AUTH_LOG_DEBUG);
        $params = array($user, $pass);
        if (is_array($additional)) {
            foreach ($additional as $item) {
                $params[] = $item;
            }
        } else {
            $params[] = $additional;
        }

        $pw_obj = &$this->_load();
        if (PEAR::isError($pw_obj)) {
            return false;
        }

        $res = call_user_func_array(array(&$pw_obj, 'addUser'), $params);
        if (PEAR::isError($res)) {
            return false;
        }

        $res = $pw_obj->save();
        if (PEAR::isError($res)) {
            return false;
        }

        return true;
    }

    // }}}
    // {{{ removeUser()

    /**
     * Remove user from the storage container
     *
     * @param   string  Username
     * @return  boolean
     */
    function removeUser($user)
    {
        $this->log('Auth_Container_File::removeUser() called.', AUTH_LOG_DEBUG);
        $pw_obj = &$this->_load();
        if (PEAR::isError($pw_obj)) {
            return false;
        }

        $res = $pw_obj->delUser($user);
        if (PEAR::isError($res)) {
            return false;
        }

        $res = $pw_obj->save();
        if (PEAR::isError($res)) {
            return false;
        }

        return true;
    }

    // }}}
    // {{{ changePassword()

    /**
     * Change password for user in the storage container
     *
     * @param string Username
     * @param string The new password
     */
    function changePassword($username, $password)
    {
        $this->log('Auth_Container_File::changePassword() called.', AUTH_LOG_DEBUG);
        $pw_obj = &$this->_load();
        if (PEAR::isError($pw_obj)) {
            return false;
        }

        $res = $pw_obj->changePasswd($username, $password);
        if (PEAR::isError($res)) {
            return false;
        }

        $res = $pw_obj->save();
        if (PEAR::isError($res)) {
            return false;
        }

        return true;
    }

    // }}}
    // {{{ _load()

    /**
     * Load and initialize the File_Passwd object
     *
     * @return  object  File_Passwd_Cvs|PEAR_Error
     */
    function &_load()
    {
        static $pw_obj;

        if (!isset($pw_obj)) {
            $this->log('Instanciating File_Password object of type '.$this->options['type'], AUTH_LOG_DEBUG);
            $pw_obj = File_Passwd::factory($this->options['type']);
            if (PEAR::isError($pw_obj)) {
                return $pw_obj;
            }

            $pw_obj->setFile($this->pwfile);

            $res = $pw_obj->load();
            if (PEAR::isError($res)) {
                return $res;
            }
        }

        return $pw_obj;
    }

    // }}}
    // {{{ _setDefaults()

    /**
     * Set some default options
     *
     * @access private
     * @return void
     */
    function _setDefaults()
    {
        $this->options['type']       = 'Cvs';
    }

    // }}}
    // {{{ _parseOptions()

    /**
     * Parse options passed to the container class
     *
     * @access private
     * @param  array
     */
    function _parseOptions($array)
    {
        foreach ($array as $key => $value) {
            if (isset($this->options[$key])) {
                $this->options[$key] = $value;
            }
        }
    }

    // }}}

}
?>