Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SQL query for last connection attempts where FreeRADIUS is v3. #99

Merged
merged 1 commit into from
Apr 3, 2019

Conversation

MiguelVis
Copy link
Collaborator

Possibly a fix for #58.

Potential bug in rep-lastconnect.php if we are running daloRADIUS under FreeRadius 3 and we have set $configValues['FREERADIUS_VERSION'] to the value '3':

	if (isset($configValues['FREERADIUS_VERSION']) && ($configValues['FREERADIUS_VERSION'] == '2')) {
		$tableSetting['postauth']['user'] = 'username';
		$tableSetting['postauth']['date'] = 'authdate';
	} elseif (isset($configValues['FREERADIUS_VERSION']) && ($configValues['FREERADIUS_VERSION'] == '1')) {
		$tableSetting['postauth']['user'] = 'user';
		$tableSetting['postauth']['date'] = 'date';
	}

If that is the case, both $tableSetting['postauth']['user'] and $tableSetting['postauth']['date'] will be undefined, so the SQL queries would be bad formed:

$sql = "SELECT ".
			$configValues['CONFIG_DB_TBL_RADPOSTAUTH'].".".$tableSetting['postauth']['user']." 
		FROM ".$configValues['CONFIG_DB_TBL_RADPOSTAUTH']. 
        " WHERE (".$configValues['CONFIG_DB_TBL_RADPOSTAUTH'].".".$tableSetting['postauth']['user']." LIKE '".
	$dbSocket->escapeSimple($usernameLastConnect)."%') $radiusReplySQL ".
		" AND (".$tableSetting['postauth']['date']." >='$startdate' AND ".$tableSetting['postauth']['date']." <='$enddate') ";

@MiguelVis MiguelVis added the bug label Apr 3, 2019
@MiguelVis MiguelVis self-assigned this Apr 3, 2019
@MiguelVis MiguelVis merged commit 2782634 into lirantal:master Apr 3, 2019
@MiguelVis MiguelVis mentioned this pull request Apr 3, 2019
@MiguelVis MiguelVis deleted the last-connection-attempts-fix branch December 6, 2019 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant