From fe926a39fe320ee9ad4d01ae63a7da13a1d14c83 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 6 Nov 2008 11:32:23 +0000 Subject: [PATCH] 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 --- gosa-core/include/class_CopyPasteHandler.inc | 34 ++++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) 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); -- 2.30.2