summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/Lib/Storage/SMB.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2018-05-28 16:17:19 +0200
committerRobin Appelman <robin@icewind.nl>2018-06-22 14:25:36 +0200
commit90be8f336cf55a3238aeecacf3a852484d5c342b (patch)
treeb7b987d2f573017c653f64abbe0af0f0a7ec16fd /apps/files_external/lib/Lib/Storage/SMB.php
parentebea6d37c3fb43df4adbcb24cbc00ceb3f75a9b4 (diff)
downloadnextcloud-server-90be8f336cf55a3238aeecacf3a852484d5c342b.tar.gz
nextcloud-server-90be8f336cf55a3238aeecacf3a852484d5c342b.zip
Add support for using kerberos ticket to authenticate to smb servers
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_external/lib/Lib/Storage/SMB.php')
-rw-r--r--apps/files_external/lib/Lib/Storage/SMB.php26
1 files changed, 17 insertions, 9 deletions
diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php
index 93fc020d71b..6213e54dff9 100644
--- a/apps/files_external/lib/Lib/Storage/SMB.php
+++ b/apps/files_external/lib/Lib/Storage/SMB.php
@@ -78,19 +78,27 @@ class SMB extends Common implements INotifyStorage {
protected $statCache;
public function __construct($params) {
- if (isset($params['host']) && isset($params['user']) && isset($params['password']) && isset($params['share'])) {
+ if (!isset($params['host'])) {
+ throw new \Exception('Invalid configuration, no host provided');
+ }
+
+ if (isset($params['auth'])) {
+ $auth = $params['auth'];
+ } else if (isset($params['user']) && isset($params['password']) && isset($params['share'])) {
list($workgroup, $user) = $this->splitUser($params['user']);
$auth = new BasicAuth($user, $workgroup, $params['password']);
- $serverFactory = new ServerFactory();
- $this->server = $serverFactory->createServer($params['host'], $auth);
- $this->share = $this->server->getShare(trim($params['share'], '/'));
-
- $this->root = $params['root'] ?? '/';
- $this->root = '/' . ltrim($this->root, '/');
- $this->root = rtrim($this->root, '/') . '/';
} else {
- throw new \Exception('Invalid configuration');
+ throw new \Exception('Invalid configuration, no credentials provided');
}
+
+ $serverFactory = new ServerFactory();
+ $this->server = $serverFactory->createServer($params['host'], $auth);
+ $this->share = $this->server->getShare(trim($params['share'], '/'));
+
+ $this->root = $params['root'] ?? '/';
+ $this->root = '/' . ltrim($this->root, '/');
+ $this->root = rtrim($this->root, '/') . '/';
+
$this->statCache = new CappedMemoryCache();
parent::__construct($params);
}