summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-10-06 14:43:25 +0200
committerGitHub <noreply@github.com>2016-10-06 14:43:25 +0200
commit55e72caf9b8b9694d6323525df5f2dd27373c64a (patch)
tree92a611761538dda1278725c5dd33b98384137fa9 /apps
parent4873f0800beb13204648267744e1b6a02abea18c (diff)
parent82c29e120404d8fe731e766c1fcd072072765943 (diff)
downloadnextcloud-server-55e72caf9b8b9694d6323525df5f2dd27373c64a.tar.gz
nextcloud-server-55e72caf9b8b9694d6323525df5f2dd27373c64a.zip
Merge pull request #1616 from nextcloud/downstream_ldap_6
Prevent user with empty uid
Diffstat (limited to 'apps')
-rw-r--r--apps/user_ldap/lib/User/User.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php
index 3d247663b3f..b2fcac10641 100644
--- a/apps/user_ldap/lib/User/User.php
+++ b/apps/user_ldap/lib/User/User.php
@@ -6,6 +6,7 @@
* @author Joas Schilling <coding@schilljs.com>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Thomas Müller <thomas.mueller@tmit.eu>
+ * @author Jörn Friedrich Dreyer <jfd@butonic.de>
*
* @license AGPL-3.0
*
@@ -32,6 +33,7 @@ use OCP\IAvatarManager;
use OCP\IConfig;
use OCP\Image;
use OCP\IUserManager;
+use OCP\Util;
/**
* User
@@ -111,6 +113,14 @@ class User {
IConfig $config, FilesystemHelper $fs, Image $image,
LogWrapper $log, IAvatarManager $avatarManager, IUserManager $userManager) {
+ if ($username === null) {
+ $log->log("uid for '$dn' must not be null!", Util::ERROR);
+ throw new \InvalidArgumentException('uid must not be null!');
+ } else if ($username === '') {
+ $log->log("uid for '$dn' must not be an empty string", Util::ERROR);
+ throw new \InvalidArgumentException('uid must not be an empty string!');
+ }
+
$this->access = $access;
$this->connection = $access->getConnection();
$this->config = $config;