Merge remote-tracking branch 'upstream/master' into issue-714

Conflicts:
	html/includes/authentication/ldap.inc.php
This commit is contained in:
Ultra2D
2015-04-08 08:43:24 +02:00
15 changed files with 12130 additions and 12 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

+36 -8
View File
@@ -15,7 +15,7 @@ if ($config['auth_ldap_starttls'] && ($config['auth_ldap_starttls'] == 'optional
function authenticate($username,$password)
{
global $config, $ds;
if ($username && $ds)
{
if ($config['auth_ldap_version'])
@@ -30,9 +30,15 @@ function authenticate($username,$password)
}
else
{
if (ldap_compare($ds,$config['auth_ldap_group'], $config['auth_ldap_groupmemberattr'],get_membername($username))===true)
{
return 1;
$ldap_groups = get_group_list();
foreach($ldap_groups as $ldap_group) {
$ldap_comparison = ldap_compare($ds,
$ldap_group,
$config['auth_ldap_groupmemberattr'],
get_membername($username));
if($ldap_comparison === true) {
return 1;
}
}
}
}
@@ -154,10 +160,15 @@ function get_userlist()
$realname = $entry['cn'][0];
$user_id = $entry['uidnumber'][0];
$email = $entry[$config['auth_ldap_emailattr']][0];
if (!isset($config['auth_ldap_group']) || ldap_compare($ds,$config['auth_ldap_group'],$config['auth_ldap_groupmemberattr'],get_membername($username))===true)
{
$userlist[] = array('username' => $username, 'realname' => $realname, 'user_id' => $user_id, 'email' => $email);
$ldap_groups = get_group_list();
foreach($ldap_groups as $ldap_group) {
$ldap_comparison = ldap_compare($ds,
$ldap_group,
$config['auth_ldap_groupmemberattr'],
get_membername($username));
if (!isset($config['auth_ldap_group']) || $ldap_comparison === true) {
$userlist[] = array('username' => $username, 'realname' => $realname, 'user_id' => $user_id, 'email' => $email);
}
}
}
}
@@ -197,4 +208,21 @@ function get_membername ($username)
return $membername;
}
function get_group_list() {
global $config;
$ldap_groups = array();
$default_group = 'cn=groupname,ou=groups,dc=example,dc=com';
if(isset($config['auth_ldap_group'])) {
if($config['auth_ldap_group'] !== $default_group) {
$ldap_groups[] = $config['auth_ldap_group'];
}
}
foreach($config['auth_ldap_groups'] as $key => $value) {
$dn = "cn=$key," . $config['auth_ldap_groupbase'];
$ldap_groups[] = $dn;
}
return $ldap_groups;
}
?>
+3 -2
View File
@@ -38,6 +38,7 @@ foreach (dbFetchRows($sql,$param) as $alert) {
$log = dbFetchCell("SELECT details FROM alert_log WHERE rule_id = ? AND device_id = ? ORDER BY id DESC LIMIT 1", array($alert['rule_id'],$alert['device_id']));
$log_detail = json_decode(gzuncompress($log),true);
foreach ( $log_detail['rule'] as $tmp_alerts ) {
$fault_detail = '';
foreach ($tmp_alerts as $k=>$v) {
if (!empty($v) && $k != 'device_id' && (stristr($k,'id') || stristr($k,'desc')) && substr_count($k,'_') <= 1) {
$fault_detail .= $k.' => '.$v."\n ";
@@ -93,8 +94,8 @@ foreach (dbFetchRows($sql,$param) as $alert) {
}
$response[] = array('id'=>"<i>#".$rulei++."</i>",
'rule'=>"<i title=\"".htmlentities($alert['rule'])."\">".htmlentities($alert['name'])."</i></td>",
'hostname'=>"<a href=\"device/device=".$alert['device_id']."\"><i title='".htmlentities($fault_detail)."'>".$alert['hostname']."</i></a></td>",
'rule'=>"<i title=\"".htmlentities($alert['rule'])."\">".htmlentities($alert['name'])."</i>",
'hostname'=>"<a href=\"device/device=".$alert['device_id']."\"><i title='".htmlentities($fault_detail)."'>".$alert['hostname']."</i></a>",
'timestamp'=>($alert['timestamp'] ? $alert['timestamp'] : "N/A"),
'severity'=>$severity,
'ack_col'=>$ack_col,