fixed saving accounts with Windows escaping
This commit is contained in:
parent
83a0ff71c9
commit
d991ec578c
|
@ -692,6 +692,19 @@ function escapeRDN($rdn) {
|
||||||
$rdn);
|
$rdn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the comma escaping from Windows to OpenLDAP style.
|
||||||
|
*
|
||||||
|
* @param string $dn DN
|
||||||
|
* @return string DN
|
||||||
|
*/
|
||||||
|
function convertCommaEscaping($dn) {
|
||||||
|
return str_replace(
|
||||||
|
array('\\,'),
|
||||||
|
array('\\2C'),
|
||||||
|
$dn);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connects to an LDAP server using the given URL.
|
* Connects to an LDAP server using the given URL.
|
||||||
*
|
*
|
||||||
|
@ -1213,6 +1226,7 @@ function extractDNSuffix($dn) {
|
||||||
if ($dn == null) {
|
if ($dn == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
$dn = convertCommaEscaping($dn);
|
||||||
return substr($dn, strpos($dn, ',')+1);
|
return substr($dn, strpos($dn, ',')+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1937,9 +1937,9 @@ class accountContainer {
|
||||||
}
|
}
|
||||||
// Set to true if an real error has happened
|
// Set to true if an real error has happened
|
||||||
$stopprocessing = false;
|
$stopprocessing = false;
|
||||||
if (strtolower($this->finalDN) != strtolower($this->dn_orig)) {
|
if (strtolower($this->finalDN) != convertCommaEscaping(strtolower($this->dn_orig))) {
|
||||||
// move existing DN
|
// move existing DN
|
||||||
if ($this->dn_orig!='') {
|
if ($this->dn_orig != '') {
|
||||||
$removeOldRDN = false;
|
$removeOldRDN = false;
|
||||||
if (isset($attributes[$this->finalDN]['modify'])) {
|
if (isset($attributes[$this->finalDN]['modify'])) {
|
||||||
$attributes[$this->finalDN]['modify'] = array_change_key_case($attributes[$this->finalDN]['modify'], CASE_LOWER);
|
$attributes[$this->finalDN]['modify'] = array_change_key_case($attributes[$this->finalDN]['modify'], CASE_LOWER);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2018 Roland Gruber
|
Copyright (C) 2018 - 2019 Roland Gruber
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -128,4 +128,11 @@ class AccountTest extends PHPUnit_Framework_TestCase {
|
||||||
$this->assertEquals('http://base/test.php', getCallingURL('http://base'));
|
$this->assertEquals('http://base/test.php', getCallingURL('http://base'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests convertCommaEscaping().
|
||||||
|
*/
|
||||||
|
function testConvertCommaEscaping() {
|
||||||
|
$this->assertEquals('cn=test\\2C user,ou=People,o=test,c=de', convertCommaEscaping('cn=test\\, user,ou=People,o=test,c=de'));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue