2 namespace TYPO3\CMS\Sv;
35 if ($passwordTransmissionStrategy ===
'normal') {
36 $loginData[
'uident_text'] = $loginData[
'uident'];
49 if ($this->login[
'status'] !==
'login') {
52 if (!$this->login[
'uident']) {
54 $this->
writelog(255, 3, 3, 2,
'Login-attempt from %s (%s) for username \'%s\' with an empty password!', array(
55 $this->authInfo[
'REMOTE_ADDR'], $this->authInfo[
'REMOTE_HOST'], $this->login[
'uname']
57 GeneralUtility::sysLog(sprintf(
'Login-attempt from %s (%s), for username \'%s\' with an empty password!', $this->authInfo[
'REMOTE_ADDR'], $this->authInfo[
'REMOTE_HOST'], $this->login[
'uname']),
'Core',
GeneralUtility::SYSLOG_SEVERITY_WARNING);
62 if (!is_array($user)) {
64 $this->
writelog(255, 3, 3, 2,
'Login-attempt from %s (%s), username \'%s\' not found!!', array($this->authInfo[
'REMOTE_ADDR'], $this->authInfo[
'REMOTE_HOST'], $this->login[
'uname']));
66 GeneralUtility::sysLog(sprintf(
'Login-attempt from %s (%s), username \'%s\' not found!', $this->authInfo[
'REMOTE_ADDR'], $this->authInfo[
'REMOTE_HOST'], $this->login[
'uname']),
'core',
GeneralUtility::SYSLOG_SEVERITY_WARNING);
68 if ($this->writeDevLog) {
91 if ($this->login[
'uident'] && $this->login[
'uname']) {
96 if ($this->writeAttemptLog) {
97 $this->
writelog(255, 3, 3, 1,
'Login-attempt from %s (%s), username \'%s\', password not accepted!', array($this->authInfo[
'REMOTE_ADDR'], $this->authInfo[
'REMOTE_HOST'], $this->login[
'uname']));
98 GeneralUtility::sysLog(sprintf(
'Login-attempt from %s (%s), username \'%s\', password not accepted!', $this->authInfo[
'REMOTE_ADDR'], $this->authInfo[
'REMOTE_HOST'], $this->login[
'uname']),
'core',
GeneralUtility::SYSLOG_SEVERITY_WARNING);
100 if ($this->writeDevLog) {
101 GeneralUtility::devLog(
'Password not accepted: ' . $this->login[
'uident'], AuthenticationService::class, 2);
105 if ($OK && $user[
'lockToDomain'] && $user[
'lockToDomain'] !== $this->authInfo[
'HTTP_HOST']) {
107 if ($this->writeAttemptLog) {
108 $this->
writelog(255, 3, 3, 1,
'Login-attempt from %s (%s), username \'%s\', locked domain \'%s\' did not match \'%s\'!', array($this->authInfo[
'REMOTE_ADDR'], $this->authInfo[
'REMOTE_HOST'], $user[$this->db_user[
'username_column']], $user[
'lockToDomain'], $this->authInfo[
'HTTP_HOST']));
109 GeneralUtility::sysLog(sprintf(
'Login-attempt from %s (%s), username \'%s\', locked domain \'%s\' did not match \'%s\'!', $this->authInfo[
'REMOTE_ADDR'], $this->authInfo[
'REMOTE_HOST'], $user[$this->db_user[
'username_column']], $user[
'lockToDomain'], $this->authInfo[
'HTTP_HOST']),
'core',
GeneralUtility::SYSLOG_SEVERITY_WARNING);
131 $groupDataArr = array();
132 if ($this->mode ===
'getGroupsFE') {
134 if (is_array($user) && $user[$this->db_user[
'usergroup_column']]) {
135 $groupList = $user[$this->db_user[
'usergroup_column']];
140 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'IPmaskMountGroups'])) {
141 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'IPmaskMountGroups'] as $IPel) {
142 if ($this->authInfo[
'REMOTE_ADDR'] && $IPel[0] &&
GeneralUtility::cmpIP($this->authInfo[
'REMOTE_ADDR'], $IPel[0])) {
143 $groups[] = (int)$IPel[1];
147 $groups = array_unique($groups);
148 if (!empty($groups)) {
149 $list = implode(
',', $groups);
150 if ($this->writeDevLog) {
153 $lockToDomain_SQL =
' AND (lockToDomain=\'\' OR lockToDomain IS NULL OR lockToDomain=\'' . $this->authInfo[
'HTTP_HOST'] .
'\')
';
154 $hiddenP = !$this->authInfo['showHiddenRecords
'] ? 'AND hidden=0
' : '';
155 $res = $this->getDatabaseConnection()->exec_SELECTquery('*
', $this->db_groups['table
'], 'deleted=0
' . $hiddenP . ' AND uid IN (
' . $list . ')
' . $lockToDomain_SQL);
156 while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) {
157 $groupDataArr[$row['uid
']] = $row;
160 $this->getDatabaseConnection()->sql_free_result($res);
163 if ($this->writeDevLog) {
164 GeneralUtility::devLog('No usergroups found.
', AuthenticationService::class, 2);
168 return $groupDataArr;
182 public function getSubGroups($grList, $idList = '', &$groups)
184 // Fetching records of the groups in $grList (which are not blocked by lockedToDomain either):
185 $lockToDomain_SQL = ' AND (lockToDomain=\
'\' OR lockToDomain IS NULL OR lockToDomain=\
'' . $this->authInfo[
'HTTP_HOST'] .
'\')
';
186 $hiddenP = !$this->authInfo['showHiddenRecords
'] ? 'AND hidden=0
' : '';
187 $res = $this->getDatabaseConnection()->exec_SELECTquery('uid,subgroup
', 'fe_groups
', 'deleted=0
' . $hiddenP . ' AND uid IN (
' . $grList . ')
' . $lockToDomain_SQL);
188 // Internal group record storage
189 $groupRows = array();
190 // The groups array is filled
191 while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) {
192 if (!in_array($row['uid
'], $groups)) {
193 $groups[] = $row['uid
'];
195 $groupRows[$row['uid
']] = $row;
197 // Traversing records in the correct order
198 $include_staticArr = GeneralUtility::intExplode(',
', $grList);
200 foreach ($include_staticArr as $uid) {
202 $row = $groupRows[$uid];
203 // Must be an array and $uid should not be in the idList, because then it is somewhere previously in the grouplist
204 if (is_array($row) && !GeneralUtility::inList($idList, $uid)) {
205 // Include sub groups
206 if (trim($row['subgroup
'])) {
208 $theList = implode(',
', GeneralUtility::intExplode(',
', $row['subgroup
']));
209 // Call recursively, pass along list of already processed groups so they are not processed again.
210 $this->getSubGroups($theList, $idList . ',
' . $uid, $groups);
221 protected function getDatabaseConnection()
223 return $GLOBALS['TYPO3_DB
'];