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
+1
-1
@@ -56,7 +56,7 @@ If the code is running on a machine with multiple cores, then you can decrease t
|
||||
params := &argon2id.Params{
|
||||
Memory: 128 * 1024,
|
||||
Iterations: 4,
|
||||
Parallelism: 4,
|
||||
Parallelism: uint8(runtime.NumCPU()),
|
||||
SaltLength: 16,
|
||||
KeyLength: 32,
|
||||
}
|
||||
|
||||
+2
-1
@@ -12,6 +12,7 @@ import (
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/crypto/argon2"
|
||||
@@ -45,7 +46,7 @@ var (
|
||||
var DefaultParams = &Params{
|
||||
Memory: 64 * 1024,
|
||||
Iterations: 1,
|
||||
Parallelism: 2,
|
||||
Parallelism: uint8(runtime.NumCPU()),
|
||||
SaltLength: 16,
|
||||
KeyLength: 32,
|
||||
}
|
||||
|
||||
+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