portunus: add patch to fix non-ascii character bug

This commit is contained in:
Lyn Fugmann 2023-09-01 00:14:41 +02:00
parent 202381d181
commit 7fdb6f9218
Signed by: fugi
GPG key ID: 4472A20091BFA792
2 changed files with 25 additions and 0 deletions

View file

@ -0,0 +1,24 @@
diff --git a/internal/core/user.go b/internal/core/user.go
index e74ccfe..291c75b 100644
--- a/internal/core/user.go
+++ b/internal/core/user.go
@@ -8,6 +8,7 @@ package core
import (
"fmt"
+ "strconv"
)
// User represents a single user account.
@@ -86,9 +87,9 @@ func (u User) RenderToLDAP(suffix string, allGroups map[string]Group) LDAPObject
obj.Attributes["loginShell"] = []string{u.POSIX.LoginShell}
}
if u.POSIX.GECOS == "" {
- obj.Attributes["gecos"] = []string{u.FullName()}
+ obj.Attributes["gecos"] = []string{strconv.QuoteToASCII(u.FullName())}
} else {
- obj.Attributes["gecos"] = []string{u.POSIX.GECOS}
+ obj.Attributes["gecos"] = []string{strconv.QuoteToASCII(u.POSIX.GECOS)}
}
obj.Attributes["objectClass"] = append(obj.Attributes["objectClass"], "posixAccount")
}

View file

@ -59,6 +59,7 @@ in
patches = [ patches = [
./0001-update-user-validation-regex.patch ./0001-update-user-validation-regex.patch
./0002-both-ldap-and-ldaps.patch ./0002-both-ldap-and-ldaps.patch
./0003-gecos-ascii-escape.patch
]; ];
}); });