[Pkg-owncloud-commits] [owncloud] 17/67: normalize paths for dir and statcache in smb stream wrapper

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:10:33 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v4.5.1
in repository owncloud.

commit a0847dc8520d1a6e76f0d11e4b81878d33c95cd4
Author: Robin Appelman <icewind at owncloud.com>
Date:   Thu Oct 11 21:27:44 2012 +0200

    normalize paths for dir and statcache in smb stream wrapper
---
 3rdparty/smb4php/smb.php |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/3rdparty/smb4php/smb.php b/3rdparty/smb4php/smb.php
index c50b26b..c080c1b 100644
--- a/3rdparty/smb4php/smb.php
+++ b/3rdparty/smb4php/smb.php
@@ -229,6 +229,8 @@ class smb {
 	}
 
 	function addstatcache ($url, $info) {
+		$url = str_replace('//', '/', $url);
+		$url = rtrim($url, '/');
 		global $__smb_cache;
 		$is_file = (strpos ($info['attr'],'D') === FALSE);
 		$s = ($is_file) ? stat ('/etc/passwd') : stat ('/tmp');
@@ -238,11 +240,15 @@ class smb {
 	}
 
 	function getstatcache ($url) {
+		$url = str_replace('//', '/', $url);
+		$url = rtrim($url, '/');
 		global $__smb_cache;
 		return isset ($__smb_cache['stat'][$url]) ? $__smb_cache['stat'][$url] : FALSE;
 	}
 
 	function clearstatcache ($url='') {
+		$url = str_replace('//', '/', $url);
+		$url = rtrim($url, '/');
 		global $__smb_cache;
 		if ($url == '') $__smb_cache['stat'] = array (); else unset ($__smb_cache['stat'][$url]);
 	}
@@ -358,16 +364,22 @@ class smb_stream_wrapper extends smb {
 	# cache
 
 	function adddircache ($url, $content) {
+		$url = str_replace('//', '/', $url);
+		$url = rtrim($url, '/');
 		global $__smb_cache;
 		return $__smb_cache['dir'][$url] = $content;
 	}
 
 	function getdircache ($url) {
+		$url = str_replace('//', '/', $url);
+		$url = rtrim($url, '/');
 		global $__smb_cache;
 		return isset ($__smb_cache['dir'][$url]) ? $__smb_cache['dir'][$url] : FALSE;
 	}
 
 	function cleardircache ($url='') {
+		$url = str_replace('//', '/', $url);
+		$url = rtrim($url, '/');
 		global $__smb_cache;
 		if ($url == ''){
 			$__smb_cache['dir'] = array ();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list