mirror of
https://github.com/jeremyd/ergo.git
synced 2026-07-27 09:28:09 -07:00
Restrict idents as other servers do
This commit is contained in:
+5
-2
@@ -623,12 +623,15 @@ func (client *Client) HasUsername() bool {
|
||||
return client.username != "" && client.username != "*"
|
||||
}
|
||||
|
||||
// SetNames sets the client's ident and realname.
|
||||
func (client *Client) SetNames(username, realname string) error {
|
||||
usernameCasefolded, err := CasefoldName(username)
|
||||
if err != nil {
|
||||
// do this before casefolding to ensure these are actually ascii
|
||||
if !isIdent(username) {
|
||||
return errInvalidUsername
|
||||
}
|
||||
|
||||
usernameCasefolded := strings.ToLower(username) // only ascii is supported in idents anyway
|
||||
|
||||
client.stateMutex.Lock()
|
||||
defer client.stateMutex.Unlock()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user