Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Fix #952 better logging
Browse files Browse the repository at this point in the history
Fix issue  creating a group with same id is not checked
Fix #937 Check that file is readable otherwise we cannot compute md5 on it.
  • Loading branch information
cdujeu committed Sep 14, 2015
1 parent 09fa8a1 commit c57989c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion core/src/core/classes/class.AuthService.php
Expand Up @@ -200,7 +200,7 @@ public static function checkBruteForceLogin(&$loginArray)
$loginArray[$serverAddress] = $login;
if ($login["count"] > 3) {
if (AJXP_SERVER_DEBUG || ConfService::getCoreConf("DISABLE_BRUTE_FORCE_CHECK", "auth") === true) {
AJXP_Logger::debug("Warning: failed login 3 time for $login from address $serverAddress! Captcha is disabled.");
AJXP_Logger::debug("Warning: failed login 3 time from address $serverAddress, but ignored because captcha is disabled.");
return true;
}
return FALSE;
Expand Down Expand Up @@ -916,6 +916,10 @@ public static function listChildrenGroups($baseGroup = "/")
public static function createGroup($baseGroup, $groupName, $groupLabel)
{
if(empty($groupName)) throw new Exception("Please provide a name for this new group!");
$currentGroups = self::listChildrenGroups($baseGroup);
if(array_key_exists("/".$groupName, $currentGroups)){
throw new Exception("Group with this name already exists, please pick another name!");
}
if(empty($groupLabel)) $groupLabel = $groupName;
ConfService::getConfStorageImpl()->createGroup(rtrim(self::filterBaseGroup($baseGroup), "/")."/".$groupName, $groupLabel);
}
Expand Down
7 changes: 4 additions & 3 deletions core/src/plugins/meta.filehasher/class.FileHasher.php
Expand Up @@ -197,7 +197,7 @@ public function switchActions($actionName, $httpVars, $fileVars)
if(method_exists($this->accessDriver, "filesystemFileSize")){
$this->accessDriver->filesystemFileSize(null, $stat);
}
if (!$stat) {
if (!$stat || !is_readable($node->getUrl())) {
print '{}';
} else {
if($node->isLeaf()) {
Expand Down Expand Up @@ -227,8 +227,9 @@ public function switchActions($actionName, $httpVars, $fileVars)
if(method_exists($this->accessDriver, "filesystemFileSize")){
$this->accessDriver->filesystemFileSize(null, $stat);
}
if(!$stat) $stat = '{}';
else {
if(!$stat || !is_readable($node->getUrl())) {
$stat = '{}';
} else {
if(!is_dir($node->getUrl())) $hash = $this->getFileHash($node);
else $hash = 'directory';
$stat[13] = $stat["hash"] = $hash;
Expand Down

0 comments on commit c57989c

Please sign in to comment.