From b54d0dab258ecb6e3f5948dbff7072f44e2904d4 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 27 Mar 2009 17:39:37 +0000 Subject: [PATCH] "fixed invinit recursion (causing a segfault) when trying to create a home directory" --- phpgwapi/inc/class.vfs_stream_wrapper.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/phpgwapi/inc/class.vfs_stream_wrapper.inc.php b/phpgwapi/inc/class.vfs_stream_wrapper.inc.php index b5ca3b3340..7c7f9b1d63 100644 --- a/phpgwapi/inc/class.vfs_stream_wrapper.inc.php +++ b/phpgwapi/inc/class.vfs_stream_wrapper.inc.php @@ -709,7 +709,10 @@ class vfs_stream_wrapper implements iface_stream_wrapper } } // check if a failed url_stat was for a home dir, in that case silently create it - if (!$stat && dirname(parse_url($path,PHP_URL_PATH)) == '/home' && ($id = $GLOBALS['egw']->accounts->name2id(basename($path)))) + static $hook_data; // we have to make sure to not call ourself recursivly (eg. mkdir will call stat to make sure the dir does not yet exist!) + if (!$stat && is_null($hook_data) && dirname(parse_url($path,PHP_URL_PATH)) == '/home' && + ($id = $GLOBALS['egw']->accounts->name2id(basename($path))) && + $GLOBALS['egw']->accounts->id2name($id) == basename($path)) // make sure path has the right case! { $hook_data = array( 'location' => $GLOBALS['egw']->accounts->get_type($id) == 'g' ? 'addgroup' : 'addaccount', @@ -718,6 +721,7 @@ class vfs_stream_wrapper implements iface_stream_wrapper 'account_name' => basename($path), ); call_user_func(array('vfs_home_hooks',$hook_data['location']),$hook_data); + $hook_data = null; $stat = self::url_stat($path,$flags,false); } if (!$stat && $check_symlink_components) // check if there's a symlink somewhere inbetween the path