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

Commit c57989c

Browse files
committed
Fix #952 better logging
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.
1 parent 09fa8a1 commit c57989c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

core/src/core/classes/class.AuthService.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public static function checkBruteForceLogin(&$loginArray)
200200
$loginArray[$serverAddress] = $login;
201201
if ($login["count"] > 3) {
202202
if (AJXP_SERVER_DEBUG || ConfService::getCoreConf("DISABLE_BRUTE_FORCE_CHECK", "auth") === true) {
203-
AJXP_Logger::debug("Warning: failed login 3 time for $login from address $serverAddress! Captcha is disabled.");
203+
AJXP_Logger::debug("Warning: failed login 3 time from address $serverAddress, but ignored because captcha is disabled.");
204204
return true;
205205
}
206206
return FALSE;
@@ -916,6 +916,10 @@ public static function listChildrenGroups($baseGroup = "/")
916916
public static function createGroup($baseGroup, $groupName, $groupLabel)
917917
{
918918
if(empty($groupName)) throw new Exception("Please provide a name for this new group!");
919+
$currentGroups = self::listChildrenGroups($baseGroup);
920+
if(array_key_exists("/".$groupName, $currentGroups)){
921+
throw new Exception("Group with this name already exists, please pick another name!");
922+
}
919923
if(empty($groupLabel)) $groupLabel = $groupName;
920924
ConfService::getConfStorageImpl()->createGroup(rtrim(self::filterBaseGroup($baseGroup), "/")."/".$groupName, $groupLabel);
921925
}

core/src/plugins/meta.filehasher/class.FileHasher.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public function switchActions($actionName, $httpVars, $fileVars)
197197
if(method_exists($this->accessDriver, "filesystemFileSize")){
198198
$this->accessDriver->filesystemFileSize(null, $stat);
199199
}
200-
if (!$stat) {
200+
if (!$stat || !is_readable($node->getUrl())) {
201201
print '{}';
202202
} else {
203203
if($node->isLeaf()) {
@@ -227,8 +227,9 @@ public function switchActions($actionName, $httpVars, $fileVars)
227227
if(method_exists($this->accessDriver, "filesystemFileSize")){
228228
$this->accessDriver->filesystemFileSize(null, $stat);
229229
}
230-
if(!$stat) $stat = '{}';
231-
else {
230+
if(!$stat || !is_readable($node->getUrl())) {
231+
$stat = '{}';
232+
} else {
232233
if(!is_dir($node->getUrl())) $hash = $this->getFileHash($node);
233234
else $hash = 'directory';
234235
$stat[13] = $stat["hash"] = $hash;

0 commit comments

Comments
 (0)