Skip to content
Snippets Groups Projects
Commit b1306279 authored by Jaime Pérez Crespo's avatar Jaime Pérez Crespo
Browse files

Fix for username set from attributes received. Updated documentation. Port made optional again.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3147 44740490-163a-0410-bde0-09ae8108e29a
parent 48776e07
No related branches found
No related tags found
No related merge requests found
......@@ -18,22 +18,18 @@ authentication source which uses the `radius:Radius` module to
'radius:Radius',
/*
* The hostname of the RADIUS server.
* Required.
* An array with the radius servers to use, up to 10.
* The options are:
* - hostname: the hostname of the radius server, or its IP address. Required.
* - port: the port of the radius server. Optional, defaults to 1812.
* - secret: the radius secret to use with this server. Required.
*/
'hostname' => 'radius.example.org',
/*
* The port number of the radius server.
* Optional, defaults to 1812.
*/
'port' => 1812,
/*
* The shared secret which is used when contacting the RADUIS server.
* Required.
*/
'secret' => 'topsecret',
'servers' => array(array('hostname' => 'radius1.example.org',
'port' => 1812,
'secret' => 'topsecret'),
array('hostname' => 'radius2.example.org',
'port' => 1812,
'secret' => 'topsecret')),
/*
* The timeout for contacting the RADIUS server, in seconds.
......@@ -47,6 +43,12 @@ authentication source which uses the `radius:Radius` module to
*/
'retries' => 3,
/*
* The NAS identifier to use when querying the radius server.
* Optional, defaults to the current host name.
*/
'nas_identifier' => 'client.example.org',
/*
* The attribute name we should store the username in. Ths username
* will not be saved in any attribute if this is NULL.
......
......@@ -115,6 +115,9 @@ class sspmod_radius_Auth_Source_Radius extends sspmod_core_Auth_UserPassBase {
/* Try to add all radius servers, trigger a failure if no one works. */
$success = false;
foreach ($this->servers as $server) {
if (!isset($server['port'])) {
$server['port'] = 1812;
}
if (!radius_add_server($radius, $server['hostname'], $server['port'], $server['secret'],
$this->timeout, $this->retries)) {
SimpleSAML_Logger::info("Could not connect to server: ".radius_strerror($radius));
......@@ -173,8 +176,8 @@ class sspmod_radius_Auth_Source_Radius extends sspmod_core_Auth_UserPassBase {
}
/* Use the received user name */
if ($attr_name == RADIUS_USER_NAME) {
$attributes[$this->usernameAttribute] = array($attr_value);
if ($resa['attr'] == RADIUS_USER_NAME) {
$attributes[$this->usernameAttribute] = array($resa['data']);
continue;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment