forked from External/ergo
Restrict idents as other servers do
This commit is contained in:
parent
9f25a42c3d
commit
8cd5db1194
5 changed files with 49 additions and 4 deletions
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue