owncloud/3rdparty — pull request #26 by kzoli (2013-04-29 08:59:31+00:00)
Title: Various bugfixes and enhancements

We (my colleague Gyula Annár and I) are working on implementation of OC in a publisher company, where about 150 notebooks and workstations and about 5 TB of storage used. Storage is mainly Samba, accessed directly by SSH tunnel or from OC using files_external app. Modifications included in this pull request were created during this project. We were modifying some files in files_external app as well, these changes will be proposed separately.

Summary of changes:

* A session array: $_SESSION['SMB4PHP'][$host][$attribute] introduced as storage for configurations static (but not to hardwire) for smb4php itself (e.g. smbclient binary pathname) and for remote hosts (e.g. LANG to use contacting this host via SMB, or time zone offset added by this host in mtime results). External applications (e.g. ownCloud, Drupal, etc.) may set values in this array overriding autoconfigurated settings or hardwired defaults.

* New get_remote() function introduced to collect attributes from remote hosts at first relevant contact.

* In mtime calculation, time zone offset added by remote storage (and asked once in session by 'net time zone' call, if was not set) considered as well.

* The LANG environment variable is set within smbclient command line itself, then environment restore isn't necessary. Side effects of an existing smb.conf were avoided using /dev/null as a config file.

* In a secured PHP environment, using '/tmp' or '/etc/passwd' probably violates open_basedir restriction. Hardwired '/tmp' were replaced by PHP upload temp folder (if was set) or system temp folder got from PHP settings. Script file itself were used as a file template for stat data structure.

* Bugfix: if unknown SMB error found, the client returns now with boolean false. Some previously unknown NT_STATUS responses were added.

* Bugfix: some methods prototyped in PHP streamWrapper class and implemented here now returns with boolean value as defined.

* Sub-subversioning proposal.