--- horde4/framework/Vfs/lib/Horde/Vfs/Smb.php.orig	2012-10-03 14:12:41.304258999 +0300
+++ horde4/framework/Vfs/lib/Horde/Vfs/Smb.php	2012-11-27 15:40:00.422544379 +0200
@@ -454,6 +454,44 @@
     }
 
     /**
+     * Returns the size of a share.
+     *
+     * @param string $path  The path of the file.
+     * @param string $name  The filename.
+     *
+     * @return integer  The size of the folder in bytes.
+     * @throws Horde_Vfs_Exception
+     */
+    function getFolderSize($path = '', $name = null)
+    {
+        list($path) = $this->_escapeShellCommand($path);
+        $cmd = array('ls');
+        try {
+            $res = $this->_command($path, $cmd);
+        } catch (Horde_Vfs_Exception $e) {
+            throw new Horde_Vfs_Exception(sprintf('getFolderSize failed: %s', $path));
+        }
+        $num_lines = count($res);
+        for ($r = 0; $r < $num_lines; $r++) {
+            if (preg_match('/blocks of size/', $res[$r])) {
+                $block_total = preg_replace('/^\s+(\d+)\s+blocks of size.*/', '\1', $res[$r]);
+                $block_size = preg_replace('/^.*blocks of size\s+(\d+).*/', '\1', $res[$r]);
+                $block_avail = preg_replace('/^.*\s+(\d+)\s+blocks available.*/', '\1', $res[$r]);
+                is_numeric($block_total)? 1 : $block_total = 0;
+                is_numeric($block_size)? 1 : $block_size= 0;
+                is_numeric($block_avail)? 1 : $block_avail = 0;
+                $size = ($block_total - $block_avail) * $block_size;
+            }
+        }
+
+        if ((!empty($block_total)) && (!empty($block_size))) {
+            $this->_params['vfs_quotalimit'] = $block_total * $block_size;
+        }
+
+        return empty($size)? 0 : $size;
+    }
+
+    /**
      * Copies a file through the backend.
      *
      * @param string $path         The path to store the file in.