This file is indexed.

/usr/bin/horde-prefs is in php-horde-prefs 2.7.0-3.

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

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
#!/usr/bin/php
<?php
/**
 * Horde Preferences toolkit.
 *
 * Usage: horde-prefs CONFIG USER (list|print|export|import) [[SCOPE] [FILE]]
 *
 * The CONFIG file needs to provide the complete configuration for the
 * preferences storage backend.
 *
 * This is an example for the file based storage backend:
 *
 * <pre>
 * <?php
 *   $conf['driver'] = 'File';
 *   $conf['params']['directory'] = '/var/www/data/horde/prefs';
 * </pre>
 *
 * The following example is the necessary setup for a SQL database:
 *
 * <pre>
 * <?php
 *   $conf['driver'] = 'Sql';
 *   $conf['params']['db'] = new Horde_Db_Adapter_Mysql(
 *     array(
 *      'persistent' => false,
 *      'username' => 'root',
 *      'password' => 'PASSWORD',
 *      'socket' => '/var/run/mysqld/mysqld.sock',
 *      'protocol' => 'unix',
 *      'database' => 'horde',
 *      'charset' => 'utf-8',
 *      'ssl' => true,
 *      'splitread' => false,
 *      'phptype' => 'mysql',
 *    )
 *  );
 * </pre>
 *
 * Configuring for the Kolab storage backend is more complex:
 *
 * <pre>
 * <?php
 *   $conf['driver'] = 'KolabImap';
 *   $factory = new Horde_Kolab_Storage_Factory(
 *       array(
 *           'driver' => 'horde',
 *           'params' => array(
 *               'host' => 'example.org',
 *               'username' => 'user@example.org',
 *               'password' => 'test',
 *               'port'     => 993,
 *               'secure'   => true
 *           ),
 *           'queryset' => array(
 *               'list' => array('queryset' => 'horde'),
 *               'data' => array('queryset' => 'horde'),
 *           ),
 *           'cache' => new Horde_Cache(new Horde_Cache_Storage_Mock()),
 *           //'logger' => new Horde_Log_Logger(new Horde_Log_Handler_Stream(STDOUT)),
 *       )
 *   );
 *   $conf['params']['kolab'] = $factory->create();
 * </pre>
 *
 *
 * Copyright 2011-2014 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 Gunnar Wrobel <wrobel@horde.org>
 */

if (strpos('@php_dir@', '@php_dir') === 0) {
    set_include_path(__DIR__ . '/../../../lib' . PATH_SEPARATOR . get_include_path());
}

@include 'Horde/Autoloader/Default.php';
if (!class_exists('Horde_Autoloader_Default')) {
   die('The "Horde_Autoloader" PEAR package is unavailable. Install it with "pear install Horde_Autoloader" first!' . "\n");
}

$args = $_SERVER['argv'];
array_shift($args);

if (empty($args) || empty($args[0])) {
   die('You must specify a path to the configuration file as the first argument!' . "\n");
}

@include realpath($args[0]);
if (empty($conf)) {
    die(sprintf('%s did not provide the expected "$conf" configuration array!', $args[0]) . "\n");
}

if (!isset($conf['driver'])) {
    die(sprintf('%s did not provide the expected driver configuration ($conf[\'driver\'])!', $args[0]) . "\n");
}
$storage_class = 'Horde_Prefs_Storage_' . ucfirst($conf['driver']);

if (empty($args[1])) {
   die('You must specify a the id of the user you want to work with as second argument!' . "\n");
}
$storage = new $storage_class($args[1], $conf['params']);

if (empty($args[2])) {
   die('You must specify the action to perform as third argument (one of list, print, export, write)!' . "\n");
}

class ScopeExporter
{
    public $scope;

    public $data;

    public function __construct($scope)
    {
        $this->scope = $scope;
    }

    public function set($name, $val)
    {
        $this->data[$name] = $val;
    }
}

class ScopeImporter
{
    public $scope;

    public $data;

    public function __construct($scope, $data)
    {
        $this->scope = $scope;
        $this->data = $data;
    }

    public function getDirty()
    {
        return array_keys($this->data);
    }

    public function get($name)
    {
        return $this->data[$name];
    }
}

switch ($args[2]) {
case 'list':
    foreach ($storage->listScopes() as $scope) {
        print $scope . "\n";
    }
    break;
case 'print':
    if (empty($args[3])) {
        die('You must specify the scope to act upon as fourth argument!' . "\n");
    }
    $scope = new ScopeExporter($args[3]);
    $storage->get($scope);
    foreach ($scope->data as $name => $val) {
        print $name . ": " . $val . "\n";
    }
    break;
case 'export':
    if (empty($args[3])) {
        die('You must specify the scope to act upon as fourth argument!' . "\n");
    }
    $scope = new ScopeExporter($args[3]);
    $storage->get($scope);
    if (empty($args[4])) {
        die('You must specify the file to export to as fifth argument!' . "\n");
    }
    file_put_contents($args[4], serialize($scope->data));
    break;
case 'import':
    if (empty($args[3])) {
        die('You must specify the scope to act upon as fourth argument!' . "\n");
    }
    if (empty($args[4])) {
        die('You must specify the file to import to as fifth argument!' . "\n");
    }
    $data = unserialize(file_get_contents($args[4]));
    if ($data) {
        $scope = new ScopeImporter($args[3], $data);
        $storage->store($scope);
    } else {
        die(sprintf('Failed importing preference data from %s!', $args[4]) . "\n");
    }
    break;
}