mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-25 13:38:19 -05:00
fixed the issue that led to correct update but the 404 response code when renaming an existing user to a string with capital letters
This commit is contained in:
committed by
Ralf Haferkamp
parent
ede78425da
commit
2745669feb
+16
-3
@@ -148,18 +148,31 @@ func ServerApplyFilter(f *ber.Packet, entry *ldap.Entry) (bool, LDAPResultCode)
|
||||
|
||||
func ServerFilterScope(baseDN string, scope int, entry *ldap.Entry) (bool, LDAPResultCode) {
|
||||
// constrained search scope
|
||||
parsedBaseDn, err := ldap.ParseDN(baseDN)
|
||||
if err != nil {
|
||||
return false, ldap.LDAPResultOperationsError
|
||||
}
|
||||
parsedDn, err := ldap.ParseDN(entry.DN)
|
||||
if err != nil {
|
||||
return false, ldap.LDAPResultOperationsError
|
||||
}
|
||||
switch scope {
|
||||
case ldap.ScopeWholeSubtree: // The scope is constrained to the entry named by baseObject and to all its subordinates.
|
||||
case ldap.ScopeBaseObject: // The scope is constrained to the entry named by baseObject.
|
||||
if entry.DN != baseDN {
|
||||
if !parsedDn.EqualFold(parsedBaseDn) {
|
||||
return false, ldap.LDAPResultSuccess
|
||||
}
|
||||
case ldap.ScopeSingleLevel: // The scope is constrained to the immediate subordinates of the entry named by baseObject.
|
||||
parts := strings.Split(entry.DN, ",")
|
||||
if len(parts) < 2 && entry.DN != baseDN {
|
||||
if len(parts) < 2 && !parsedDn.EqualFold(parsedBaseDn) {
|
||||
return false, ldap.LDAPResultSuccess
|
||||
}
|
||||
if dn := strings.Join(parts[1:], ","); dn != baseDN {
|
||||
subDn := strings.Join(parts[1:], ",")
|
||||
parsedSubDn, err := ldap.ParseDN(subDn)
|
||||
if err != nil {
|
||||
return false, ldap.LDAPResultOperationsError
|
||||
}
|
||||
if !parsedSubDn.EqualFold(parsedBaseDn) {
|
||||
return false, ldap.LDAPResultSuccess
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user