[BUGFIX] Invalid SQL result after four login failures 79/18579/2
authorPhilipp Gampe <philipp.gampe@typo3.org>
Sun, 3 Mar 2013 20:07:32 +0000 (21:07 +0100)
committerXavier Perseguers <xavier@typo3.org>
Mon, 4 Mar 2013 08:16:13 +0000 (09:16 +0100)
sql_free_result is called too early.
Move the call after the error handling at the end of the method.

Fixes: #45996
Releases: 6.0, 6.1
Change-Id: I54f1edb48e4c3b70629b46cbba365416c01c0917
Reviewed-on: https://review.typo3.org/18579
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Mattias Nilsson
Tested-by: Mattias Nilsson
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php

index b8d3ab4..7b992e4 100644 (file)
@@ -2189,7 +2189,6 @@ This is a dump of the failures:
                                        $email_body .= date(($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm']), $testRows['tstamp']) . ':  ' . @sprintf($testRows['details'], ('' . $theData[0]), ('' . $theData[1]), ('' . $theData[2]));
                                        $email_body .= LF;
                                }
-                               $GLOBALS['TYPO3_DB']->sql_free_result($res);
                                $from = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFrom();
                                /** @var $mail \TYPO3\CMS\Core\Mail\MailMessage */
                                $mail = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
@@ -2197,6 +2196,7 @@ This is a dump of the failures:
                                $mail->send();
                                // Logout written to log
                                $this->writelog(255, 4, 0, 3, 'Failure warning (%s failures within %s seconds) sent by email to %s', array($GLOBALS['TYPO3_DB']->sql_num_rows($res), $secondsBack, $email));
+                               $GLOBALS['TYPO3_DB']->sql_free_result($res);
                        }
                }
        }