From: hickert Date: Thu, 6 Nov 2008 11:32:23 +0000 (+0000) Subject: Updated Copy&Paste handling X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fe926a39fe320ee9ad4d01ae63a7da13a1d14c83;p=gosa.git Updated Copy&Paste handling -Do not change owner of existing cache dir, only change the owner and permission of the created files. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@12937 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_CopyPasteHandler.inc b/gosa-core/include/class_CopyPasteHandler.inc index 4ceb83a1f..ee772bb30 100644 --- a/gosa-core/include/class_CopyPasteHandler.inc +++ b/gosa-core/include/class_CopyPasteHandler.inc @@ -111,19 +111,19 @@ class CopyPasteHandler { /* Create patch if it doesn't exists */ if(!is_dir(LDAP_DUMP_PATH)){ @mkdir(LDAP_DUMP_PATH); + + /* Update folder permissions */ + if(!@chmod(LDAP_DUMP_PATH,0700)){ + $msg= sprintf(_("Copy and paste failed!")."

"._("Error").": "._("Cannot set permission for '%s'")."" ,LDAP_DUMP_PATH); + msg_dialog::display(_("Configuration error"), $msg, ERROR_DIALOG); + new log("copy","all/all","copy & paste, event queue.",array(), $msg); + return(FALSE); + } } - - /* Update folder permissions */ - if(!@chmod(LDAP_DUMP_PATH,0700)){ - $msg= sprintf(_("Copy and paste failed!")."

"._("Error").": "._("Cannot set permission for '%s'")."" ,LDAP_DUMP_PATH); - msg_dialog::display(_("Configuration error"), $msg, ERROR_DIALOG); - new log("copy","all/all","copy & paste, event queue.",array(), $msg); - return(FALSE); - } /* check if we are able to create a new file the given directory */ if(!is_writeable(LDAP_DUMP_PATH)){ - $msg= _("Copy and paste failed!")."

"._("Error").": ".msgPool::cannotWrite(LDAP_DUMP_PATH).""; + $msg= _("Copy and paste failed!")."

"._("Error").": ".msgPool::cannotWriteFile(LDAP_DUMP_PATH).""; msg_dialog::display(_("Configuration error"), $msg, ERROR_DIALOG); new log("copy","all/all","copy & paste, event queue.",array(), $msg); return(FALSE); @@ -178,14 +178,6 @@ class CopyPasteHandler { return(FALSE); } - /* Update folder permissions */ - if(!@chmod(LDAP_DUMP_PATH,0700)){ - $msg= sprintf(_("Copy and paste failed!")."

"._("Error").": "._("Cannot set permission for '%s'"),LDAP_DUMP_PATH); - msg_dialog::display(_("Configuration error"), $msg, ERROR_DIALOG); - new log("copy","all/all","copy & paste, event queue.",array(), $msg); - return(FALSE); - } - /* Create file handle */ $fp = @fopen($path."/".$filename,"w+"); if(!$fp){ @@ -195,6 +187,14 @@ class CopyPasteHandler { return(FALSE); } + /* Update folder permissions */ + if(!@chmod($path."/".$filename,0700)){ + $msg= sprintf(_("Copy and paste failed!")."

"._("Error").": "._("Cannot set permission for '%s'"),LDAP_DUMP_PATH); + msg_dialog::display(_("Configuration error"), $msg, ERROR_DIALOG); + new log("copy","all/all","copy & paste, event queue.",array(), $msg); + return(FALSE); + } + $data = serialize($ldap->fetch()); fwrite($fp,$data,strlen($data)); fclose($fp);