Skip to content

Commit

Permalink
Merge pull request #1616 from nextcloud/downstream_ldap_6
Browse files Browse the repository at this point in the history
Prevent user with empty uid
  • Loading branch information
MorrisJobke authored Oct 6, 2016
2 parents 4873f08 + 82c29e1 commit 55e72ca
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/user_ldap/lib/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -32,6 +33,7 @@
use OCP\IConfig;
use OCP\Image;
use OCP\IUserManager;
use OCP\Util;

/**
* User
Expand Down Expand Up @@ -111,6 +113,14 @@ public function __construct($username, $dn, IUserTools $access,
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;
Expand Down

0 comments on commit 55e72ca

Please sign in to comment.