# user is on a different host # copy the original file to this host: $origfile = $tmpfile_base . '.alaw'; $cmd = 'sudo scp -o StrictHostKeyChecking=no -o BatchMode=yes ' . qsa('root@' . $info['host'] . ':' . $origorigfile) . ' ' . qsa($origfile); $err = 0; $out = array(); @exec($cmd . ' 1>>/dev/null 2>>/dev/null', $out, $err); if ($err != 0) { gs_log(GS_LOG_WARNING, "Could not get voicemail \"{$origorigfile}\" from node \"" . $info['host'] . "\"."); _not_found('Could not get file from remote node.'); } } else { # user is on this host if (!file_exists($origorigfile)) { gs_log(GS_LOG_WARNING, "Voicemail \"{$origorigfile}\" not found on this node."); _not_found('File not found on this node.'); } $origfile = $origorigfile; } $err = 0; $out = array(); @exec('sudo chmod a+r ' . qsa($origfile) . ' 1>>/dev/null 2>>/dev/null', $out, $err); if ($err != 0) { gs_log(GS_LOG_WARNING, 'Can\'t read \\"$origfile\\".'); _server_error('Failed to convert file.'); } error_reporting(0); ini_set('display_errors', false); @set_time_limit(10); $outfile = $tmpfile_base . '.' . $formats[$fmt]['ext']; if ($fmt === 'mp3') {
{ @header('HTTP/1.0 404 Not Found', true, 404); @header('Status: 404 Not Found', true, 404); @header('Content-Type: text/plain; charset=utf-8'); echo '/* ', $errmsg ? $errmsg : 'Not found.', ' */'; gs_log(GS_LOG_DEBUG, $errmsg ? $errmsg : 'LDAP lookup: User not found'); exit(1); } if (!is_array($_SESSION) || !@array_key_exists('sudo_user', @$_SESSION) || !@array_key_exists('info', @$_SESSION['sudo_user']) || !@array_key_exists('id', @$_SESSION['sudo_user']['info'])) { _not_allowed(); } if ($_SESSION['real_user']['name'] !== 'sysadmin' && !gs_user_is_admin(@$_SESSION['real_user']['name'])) { _not_allowed(); } if (!array_key_exists('u', $_REQUEST)) { _not_found('Username not specified.'); } $user = $_REQUEST['u']; include_once GS_DIR . 'inc/gs-fns/gs_ldap_user_search.php'; $user_info = gs_ldap_user_search($user); if (isGsError($user_info)) { _server_error($user_info->getMsg()); } if (!is_array($user_info)) { _server_error('Failed to look up user "' . $user . '" in LDAP.'); } require_once GS_DIR . 'lib/utf8-normalize/gs_utf_normal.php'; @header('Content-Type: application/json'); # RFC 4627 ob_start(); echo "{\n";