Added sticky GID permissions (#1615)

This commit is contained in:
Mafoo 2016-05-26 04:51:41 +01:00 committed by FusionPBX
parent 7f1873df99
commit 86c4742347
14 changed files with 25 additions and 25 deletions

View File

@ -217,7 +217,7 @@ else {
echo " <a href='javascript:void(0);' onclick=\"send_cmd('calls_exec.php?cmd='+get_park_cmd(escape('$uuid'), '".$tmp_domain."'));\">".$text['label-park']."</a>&nbsp;\n";
//record start/stop
$tmp_dir = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d");
mkdir($tmp_dir, 0777, true);
mkdir($tmp_dir, 1777, true);
$tmp_file = $tmp_dir."/".$uuid.".wav";
if (file_exists($tmp_file)) {
//stop

View File

@ -52,7 +52,7 @@
//if the public directory doesn't exist then create it
if ($domains_processed == 1) {
if (strlen($_SESSION['switch']['dialplan']['dir']) > 0) {
if (!is_dir($_SESSION['switch']['dialplan']['dir'].'/public')) { mkdir($_SESSION['switch']['dialplan']['dir'].'/public',0777,true); }
if (!is_dir($_SESSION['switch']['dialplan']['dir'].'/public')) { mkdir($_SESSION['switch']['dialplan']['dir'].'/public',2777,true); }
}
}
@ -61,7 +61,7 @@
//make sure the public directory and xml file exist
if (strlen($_SESSION['switch']['dialplan']['dir']) > 0) {
if (!is_dir($_SESSION['switch']['dialplan']['dir'].'/public'.$_SESSION['domains'][$domain_uuid]['domain_name'])) {
mkdir($_SESSION['switch']['dialplan']['dir'].'/public/'.$_SESSION['domains'][$domain_uuid]['domain_name'],0777,true);
mkdir($_SESSION['switch']['dialplan']['dir'].'/public/'.$_SESSION['domains'][$domain_uuid]['domain_name'],2777,true);
}
$file = $_SESSION['switch']['dialplan']['dir']."/public/".$_SESSION['domains'][$domain_uuid]['domain_name'].".xml";
if (!file_exists($file)) {

View File

@ -27,7 +27,7 @@
//if the extensions dir doesn't exist then create it
if ($domains_processed == 1) {
if (strlen($_SESSION['switch']['extensions']['dir']) > 0) {
if (!is_dir($_SESSION['switch']['extensions']['dir'])) { mkdir($_SESSION['switch']['extensions']['dir'],0777,true); }
if (!is_dir($_SESSION['switch']['extensions']['dir'])) { mkdir($_SESSION['switch']['extensions']['dir'],2770,true); }
}
}

View File

@ -397,7 +397,7 @@ if (!class_exists('extension')) {
$xml .= " </user>\n";
if (!is_readable($_SESSION['switch']['extensions']['dir']."/".$row['user_context'])) {
mkdir($_SESSION['switch']['extensions']['dir']."/".$row['user_context'],0755,true);
mkdir($_SESSION['switch']['extensions']['dir']."/".$row['user_context'],2755,true);
}
if (strlen($extension) > 0) {
$fout = fopen($_SESSION['switch']['extensions']['dir']."/".$row['user_context']."/v_".$extension.".xml","w");

View File

@ -134,7 +134,7 @@ else {
//process sampling rate(s)
if (isset($sampling_rate_dirs)) foreach ($sampling_rate_dirs as $sampling_rate_dir) {
if (!is_dir($music_on_hold_dir."/".$path_mod.$new_category_name."/".$sampling_rate_dir)) {
@mkdir($music_on_hold_dir."/".$path_mod.$new_category_name."/".$sampling_rate_dir, 0777, true);
mkdir($music_on_hold_dir."/".$path_mod.$new_category_name."/".$sampling_rate_dir, 2777, true);
}
if (is_dir($music_on_hold_dir."/".$path_mod.$new_category_name."/".$sampling_rate_dir)) {
copy($_FILES['upload_file']['tmp_name'], $music_on_hold_dir."/".$path_mod.$new_category_name."/".$sampling_rate_dir."/".$new_file_name);
@ -149,7 +149,7 @@ else {
//process sampling rate(s)
if (isset($sampling_rate_dirs)) foreach ($sampling_rate_dirs as $sampling_rate_dir) {
if (!is_dir($music_on_hold_dir."/".$path_mod.$_POST['upload_category']."/".$sampling_rate_dir)) {
@mkdir($music_on_hold_dir."/".$path_mod.$_POST['upload_category']."/".$sampling_rate_dir, 0777, true);
mkdir($music_on_hold_dir."/".$path_mod.$_POST['upload_category']."/".$sampling_rate_dir, 2777, true);
}
if (is_dir($music_on_hold_dir."/".$path_mod.$_POST['upload_category']."/".$sampling_rate_dir)) {
copy($_FILES['upload_file']['tmp_name'], $music_on_hold_dir."/".$path_mod.$_POST['upload_category']."/".$sampling_rate_dir."/".$new_file_name);
@ -165,7 +165,7 @@ else {
//process sampling rate(s)
if (isset($sampling_rate_dirs)) foreach ($sampling_rate_dirs as $sampling_rate_dir) {
if (!is_dir($music_on_hold_dir."/".$sampling_rate_dir)) {
@mkdir($music_on_hold_dir."/".$sampling_rate_dir, 0777, true);
mkdir($music_on_hold_dir."/".$sampling_rate_dir, 2777, true);
}
if (is_dir($music_on_hold_dir."/".$sampling_rate_dir)) {
copy($_FILES['upload_file']['tmp_name'], $music_on_hold_dir."/".$sampling_rate_dir."/".$new_file_name);

View File

@ -69,7 +69,7 @@ if ($domains_processed == 1) {
foreach ($conf_lang_folders as $conf_lang_folder) {
//create phrases folder, if necessary
if (!file_exists($conf_lang_folder."/phrases/")) {
mkdir($conf_lang_folder."/phrases/", 0777);
mkdir($conf_lang_folder."/phrases/", 2777);
}
//parse language, open xml file
$conf_lang = substr($conf_lang_folder, -2);

View File

@ -26,7 +26,7 @@
//if the recordings directory doesn't exist then create it
if (strlen($_SESSION['switch']['recordings']['dir']."/".$domain_name) > 0) {
if (!is_readable($_SESSION['switch']['recordings']['dir']."/".$domain_name)) { mkdir($_SESSION['switch']['recordings']['dir']."/".$domain_name,0777,true); }
if (!is_readable($_SESSION['switch']['recordings']['dir']."/".$domain_name)) { mkdir($_SESSION['switch']['recordings']['dir']."/".$domain_name,2770,true); }
}
if ($domains_processed == 1) {

View File

@ -155,7 +155,7 @@ require_once "resources/check_auth.php";
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) == 0 && !file_exists($v_greeting_dir.'/'.$file_name)) {
//move the uploaded greeting
mkdir($v_greeting_dir, 0777, true);
mkdir($v_greeting_dir, 2777, true);
move_uploaded_file($_FILES['file']['tmp_name'], $v_greeting_dir.'/'.$file_name);
//set newly uploaded greeting as active greeting for voicemail box
$sql = "update v_voicemails ";

View File

@ -89,7 +89,7 @@ if ($domains_processed == 1) {
foreach ($voicemails as $row) {
$path = $_SESSION['switch']['voicemail']['dir'].'/default/'.$row['domain_name'].'/'.$row['voicemail_id'];
if (!file_exists($path)) {
mkdir($path, 0777, true);
mkdir($path, 2777, true);
}
}
unset ($prep_statement, $sql);

View File

@ -386,7 +386,7 @@ if (!class_exists('xml_cdr')) {
catch(PDOException $e) {
$tmp_dir = $_SESSION['switch']['log']['dir'].'/xml_cdr/failed/';
if(!file_exists($tmp_dir)) {
mkdir($tmp_dir, 0777, true);
mkdir($tmp_dir, 2777, true);
}
if ($_SESSION['cdr']['format']['text'] == "xml") {
$tmp_file = $uuid.'.xml';
@ -413,7 +413,7 @@ if (!class_exists('xml_cdr')) {
$tmp_day = date("d", $tmp_time);
$tmp_dir = $_SESSION['switch']['log']['dir'].'/xml_cdr/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
if(!file_exists($tmp_dir)) {
mkdir($tmp_dir, 0777, true);
mkdir($tmp_dir, 2777, true);
}
if ($_SESSION['cdr']['format']['text'] == "xml") {
$tmp_file = $uuid.'.xml';

View File

@ -440,7 +440,7 @@
catch(PDOException $e) {
$tmp_dir = $_SESSION['switch']['log']['dir'].'/xml_cdr/failed/';
if(!file_exists($tmp_dir)) {
mkdir($tmp_dir, 0777, true);
mkdir($tmp_dir, 2777, true);
}
if ($_SESSION['cdr']['format']['text'] == "xml") {
$tmp_file = $uuid.'.xml';
@ -467,7 +467,7 @@
$tmp_day = date("d", $tmp_time);
$tmp_dir = $_SESSION['switch']['log']['dir'].'/xml_cdr/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
if(!file_exists($tmp_dir)) {
mkdir($tmp_dir, 0777, true);
mkdir($tmp_dir, 2777, true);
}
if ($_SESSION['cdr']['format']['text'] == "xml") {
$tmp_file = $uuid.'.xml';

View File

@ -99,7 +99,7 @@ include "root.php";
//make sure the conf directory exists
if (!is_dir($this->global_settings->switch_conf_dir())) {
if (!mkdir($this->global_settings->switch_conf_dir(), 0774, true)) {
if (!mkdir($this->global_settings->switch_conf_dir(), 2774, true)) {
throw new Exception("Failed to create the switch conf directory '".$this->global_settings->switch_conf_dir()."'. ");
}
}
@ -117,9 +117,9 @@ include "root.php";
unset($src_dir, $dst_dir);
}
$fax_dir = join( DIRECTORY_SEPARATOR, array($this->global_settings->switch_storage_dir(), 'fax'));
if (!is_readable($fax_dir)) { mkdir($fax_dir,0777,true); }
if (!is_readable($fax_dir)) { mkdir($fax_dir,2777,true); }
$voicemail_dir = join( DIRECTORY_SEPARATOR, array($this->global_settings->switch_storage_dir(), 'voicemail'));
if (!is_readable($voicemail_dir)) { mkdir($voicemail_dir,0777,true); }
if (!is_readable($voicemail_dir)) { mkdir($voicemail_dir,2777,true); }
//write the xml_cdr.conf.xml file
if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/xml_cdr")) {

View File

@ -175,7 +175,7 @@
throw new Exception("recursive_copy() source directory '".$src."' does not exist.");
}
if (!is_dir($dst)) {
if (!mkdir($dst)) {
if (!mkdir($dst,2770,true)) {
throw new Exception("recursive_copy() failed to create destination directory '".$dst."'");
}
}

View File

@ -991,12 +991,12 @@ function save_dialplan_xml() {
$dialplan_filename = $dialplan_order."_v_".$dialplan_name.".xml";
if (strlen($row['dialplan_context']) > 0) {
if (!is_dir($_SESSION['switch']['dialplan']['dir']."/".$row['dialplan_context'])) {
mkdir($_SESSION['switch']['dialplan']['dir']."/".$row['dialplan_context'],0755,true);
mkdir($_SESSION['switch']['dialplan']['dir']."/".$row['dialplan_context'],2755,true);
}
if ($row['dialplan_context'] == "public") {
if (count($_SESSION['domains']) > 1 && strlen($row['domain_uuid']) > 0) {
if (!is_dir($_SESSION['switch']['dialplan']['dir']."/public/".$_SESSION['domains'][$row['domain_uuid']]['domain_name'])) {
mkdir($_SESSION['switch']['dialplan']['dir']."/public/".$_SESSION['domains'][$row['domain_uuid']]['domain_name'],0755,true);
mkdir($_SESSION['switch']['dialplan']['dir']."/public/".$_SESSION['domains'][$row['domain_uuid']]['domain_name'],2755,true);
}
file_put_contents($_SESSION['switch']['dialplan']['dir']."/public/".$_SESSION['domains'][$row['domain_uuid']]['domain_name']."/".$dialplan_filename, $tmp);
}
@ -1006,7 +1006,7 @@ function save_dialplan_xml() {
}
else {
if (!is_dir($_SESSION['switch']['dialplan']['dir']."/".$row['dialplan_context'])) {
mkdir($_SESSION['switch']['dialplan']['dir']."/".$row['dialplan_context'],0755,true);
mkdir($_SESSION['switch']['dialplan']['dir']."/".$row['dialplan_context'],2755,true);
}
file_put_contents($_SESSION['switch']['dialplan']['dir']."/".$row['dialplan_context']."/".$dialplan_filename, $tmp);
}
@ -1383,7 +1383,7 @@ if (!function_exists('save_sip_profile_xml')) {
// make profile dir if needed
$profile_dir = $_SESSION['switch']['conf']['dir']."/sip_profiles";
if (!is_readable($profile_dir)) { mkdir($profile_dir,0775,true); }
if (!is_readable($profile_dir)) { mkdir($profile_dir,2775,true); }
//get the global variables
global $domain_uuid;
@ -1448,7 +1448,7 @@ if (!function_exists('save_sip_profile_xml')) {
}
//if the directory does not exist then create it
if (!is_readable($profile_dir.'/'.$sip_profile_name)) { mkdir($profile_dir.'/'.$sip_profile_name,0775,true); }
if (!is_readable($profile_dir.'/'.$sip_profile_name)) { mkdir($profile_dir.'/'.$sip_profile_name,2775,true); }
} //end foreach
unset($sql, $result, $row_count);