Revision f9ed5d57
Added by James Webb over 5 years ago
src/etc/inc/auth.inc | ||
---|---|---|
447 | 447 |
} |
448 | 448 |
|
449 | 449 |
foreach($u2del as $user) { |
450 |
if ($user['uid'] < 2000 || $user['uid'] > 65000) { |
|
450 |
if ($user['uid'] > 65000) { |
|
451 |
continue; |
|
452 |
} else if ($user['uid'] < 2000 && !in_array($user, $u2add)) { |
|
451 | 453 |
continue; |
452 | 454 |
} |
453 | 455 |
|
... | ... | |
774 | 776 |
} |
775 | 777 |
|
776 | 778 |
function local_user_set_password(&$user, $password) { |
779 |
global $config; |
|
780 |
|
|
777 | 781 |
unset($user['password']); |
778 | 782 |
unset($user['md5-hash']); |
779 | 783 |
$user['bcrypt-hash'] = password_hash($password, PASSWORD_BCRYPT); |
784 |
if (($user['name'] == $config['hasync']['username']) && |
|
785 |
($config['hasync']['adminsync'] == 'on')) { |
|
786 |
$config['hasync']['new_password'] = $password; |
|
787 |
} |
|
780 | 788 |
} |
781 | 789 |
|
782 | 790 |
function local_user_get_groups($user, $all = false) { |
... | ... | |
1641 | 1649 |
} |
1642 | 1650 |
if (!is_ipaddr($nasip)) { |
1643 | 1651 |
$nasip = get_interface_ip($nasip); |
1644 |
|
|
1652 |
|
|
1645 | 1653 |
if (!is_ipaddr($nasip)) { |
1646 | 1654 |
$nasip = get_interface_ip();//We use wan interface IP as fallback for NAS-IP-Address |
1647 | 1655 |
} |
... | ... | |
1650 | 1658 |
|
1651 | 1659 |
$rauth->putAttribute(RADIUS_NAS_IP_ADDRESS, $nasip, "addr"); |
1652 | 1660 |
$rauth->putAttribute(RADIUS_NAS_IDENTIFIER, $nasid); |
1653 |
|
|
1661 |
|
|
1654 | 1662 |
if(!empty($attributes['calling_station_id'])) { |
1655 | 1663 |
$rauth->putAttribute(RADIUS_CALLING_STATION_ID, $attributes['calling_station_id']); |
1656 | 1664 |
} |
... | ... | |
1661 | 1669 |
} |
1662 | 1670 |
if(!empty($attributes['nas_port_type'])) { |
1663 | 1671 |
$rauth->putAttribute(RADIUS_NAS_PORT_TYPE, $attributes['nas_port_type']); |
1664 |
}
|
|
1672 |
} |
|
1665 | 1673 |
if(!empty($attributes['nas_port'])) { |
1666 | 1674 |
$rauth->putAttribute(RADIUS_NAS_PORT, intval($attributes['nas_port']), 'integer'); |
1667 | 1675 |
} |
... | ... | |
1684 | 1692 |
$ret = false; |
1685 | 1693 |
} |
1686 | 1694 |
|
1687 |
|
|
1695 |
|
|
1688 | 1696 |
// Get attributes, even if auth failed. |
1689 | 1697 |
if ($rauth->getAttributes()) { |
1690 | 1698 |
$attributes = array_merge($attributes,$rauth->listAttributes()); |
... | ... | |
1695 | 1703 |
$stt = strtotime(preg_replace("/\+(\d+):(\d+)$/", " +\${1}\${2}", preg_replace("/(\d+)T(\d+)/", "\${1} \${2}",$stt))); |
1696 | 1704 |
} |
1697 | 1705 |
} |
1698 |
|
|
1706 |
|
|
1699 | 1707 |
// close OO RADIUS_AUTHENTICATION |
1700 | 1708 |
$rauth->close(); |
1701 | 1709 |
|
... | ... | |
1888 | 1896 |
} |
1889 | 1897 |
|
1890 | 1898 |
/* |
1891 |
Possible return values :
|
|
1899 |
Possible return values : |
|
1892 | 1900 |
true : authentication worked |
1893 | 1901 |
false : authentication failed (invalid login/password, not enought permission, etc...) |
1894 | 1902 |
null : error during authentication process (unable to reach remote server, etc...) |
Also available in: Unified diff
Synchronize admin accounts. Issue #9622