2024-03-05 15:10:20 +01:00
|
|
|
diff --git a/internal/ldap/object.go b/internal/ldap/object.go
|
|
|
|
index d4e5c6f..fcefec7 100644
|
|
|
|
--- a/internal/ldap/object.go
|
|
|
|
+++ b/internal/ldap/object.go
|
|
|
|
@@ -8,6 +8,7 @@ package ldap
|
2023-09-01 00:14:41 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2024-03-05 15:10:20 +01:00
|
|
|
+ "regexp"
|
2023-09-01 00:14:41 +02:00
|
|
|
|
2024-03-05 15:10:20 +01:00
|
|
|
"github.com/majewsky/portunus/internal/core"
|
|
|
|
)
|
|
|
|
@@ -94,10 +95,11 @@ func renderUser(u core.User, dnSuffix string, allGroups []core.Group) Object {
|
|
|
|
if u.POSIX.LoginShell != "" {
|
2023-09-01 00:14:41 +02:00
|
|
|
obj.Attributes["loginShell"] = []string{u.POSIX.LoginShell}
|
|
|
|
}
|
2024-03-05 15:10:20 +01:00
|
|
|
+ var nonASCII = regexp.MustCompile("[^\\x00-\\x7F]")
|
2023-09-01 00:14:41 +02:00
|
|
|
if u.POSIX.GECOS == "" {
|
|
|
|
- obj.Attributes["gecos"] = []string{u.FullName()}
|
2024-03-05 15:10:20 +01:00
|
|
|
+ obj.Attributes["gecos"] = []string{nonASCII.ReplaceAllString(u.FullName(), "")}
|
2023-09-01 00:14:41 +02:00
|
|
|
} else {
|
|
|
|
- obj.Attributes["gecos"] = []string{u.POSIX.GECOS}
|
2024-03-05 15:10:20 +01:00
|
|
|
+ obj.Attributes["gecos"] = []string{nonASCII.ReplaceAllString(u.POSIX.GECOS, "")}
|
2023-09-01 00:14:41 +02:00
|
|
|
}
|
|
|
|
obj.Attributes["objectClass"] = append(obj.Attributes["objectClass"], "posixAccount")
|
|
|
|
}
|