aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@karoshi.org.uk>2015-03-20 15:55:53 +0000
committerRobin McCorkell <rmccorkell@karoshi.org.uk>2015-03-20 16:24:30 +0000
commit1f3fdf17ef0501fbd0efcb2c8db5c167739cddf1 (patch)
treebc0bd11094f624241b48e22ae7ff3ff6449a2c22 /apps/files_external
parenta45e45df1ec357f9b390463ed74100e6c8b07fe7 (diff)
downloadnextcloud-server-1f3fdf17ef0501fbd0efcb2c8db5c167739cddf1.tar.gz
nextcloud-server-1f3fdf17ef0501fbd0efcb2c8db5c167739cddf1.zip
Support constructing an SMB_OC without saved session credentials
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/lib/smb_oc.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/apps/files_external/lib/smb_oc.php b/apps/files_external/lib/smb_oc.php
index 245d1ed79b3..c2301d8589c 100644
--- a/apps/files_external/lib/smb_oc.php
+++ b/apps/files_external/lib/smb_oc.php
@@ -21,13 +21,20 @@ class SMB_OC extends SMB {
* @throws \Exception
*/
public function __construct($params) {
- if (isset($params['host']) && \OC::$server->getSession()->exists('smb-credentials')) {
+ if (isset($params['host'])) {
$host = $params['host'];
$this->username_as_share = ($params['username_as_share'] === 'true');
- $params_auth = json_decode(\OC::$server->getCrypto()->decrypt(\OC::$server->getSession()->get('smb-credentials')), true);
- $user = \OC::$server->getSession()->get('loginname');
- $password = $params_auth['password'];
+ // dummy credentials, unused, to satisfy constructor
+ $user = 'foo';
+ $password = 'bar';
+ if (\OC::$server->getSession()->exists('smb-credentials')) {
+ $params_auth = json_decode(\OC::$server->getCrypto()->decrypt(\OC::$server->getSession()->get('smb-credentials')), true);
+ $user = \OC::$server->getSession()->get('loginname');
+ $password = $params_auth['password'];
+ } else {
+ // assume we are testing from the admin section
+ }
$root = isset($params['root']) ? $params['root'] : '/';
$share = '';