Browse Source

Merge pull request #2124 from slingamn/realnamelimit

fix #2123
pull/2126/head
Shivaram Lingamneni 2 months ago
parent
commit
24ac3b68b4
No account linked to committer's email address
4 changed files with 11 additions and 0 deletions
  1. 3
    0
      default.yaml
  2. 1
    0
      irc/config.go
  3. 4
    0
      irc/handlers.go
  4. 3
    0
      traditional.yaml

+ 3
- 0
default.yaml View File

@@ -820,6 +820,9 @@ limits:
820 820
     # identlen is the max ident length allowed
821 821
     identlen: 20
822 822
 
823
+    # realnamelen is the maximum realname length allowed
824
+    realnamelen: 150
825
+
823 826
     # channellen is the max channel length allowed
824 827
     channellen: 64
825 828
 

+ 1
- 0
irc/config.go View File

@@ -484,6 +484,7 @@ type Limits struct {
484 484
 	ChanListModes        int `yaml:"chan-list-modes"`
485 485
 	ChannelLen           int `yaml:"channellen"`
486 486
 	IdentLen             int `yaml:"identlen"`
487
+	RealnameLen          int `yaml:"realnamelen"`
487 488
 	KickLen              int `yaml:"kicklen"`
488 489
 	MonitorEntries       int `yaml:"monitor-entries"`
489 490
 	NickLen              int `yaml:"nicklen"`

+ 4
- 0
irc/handlers.go View File

@@ -3334,6 +3334,10 @@ func userHandler(server *Server, client *Client, msg ircmsg.Message, rb *Respons
3334 3334
 		rb.Add(nil, server.name, ERR_NEEDMOREPARAMS, client.Nick(), "USER", client.t("Not enough parameters"))
3335 3335
 		return false
3336 3336
 	}
3337
+	config := server.Config()
3338
+	if config.Limits.RealnameLen > 0 && len(realname) > config.Limits.RealnameLen {
3339
+		realname = ircmsg.TruncateUTF8Safe(realname, config.Limits.RealnameLen)
3340
+	}
3337 3341
 
3338 3342
 	// #843: we accept either: `USER user:pass@clientid` or `USER user@clientid`
3339 3343
 	if strudelIndex := strings.IndexByte(username, '@'); strudelIndex != -1 {

+ 3
- 0
traditional.yaml View File

@@ -792,6 +792,9 @@ limits:
792 792
     # identlen is the max ident length allowed
793 793
     identlen: 20
794 794
 
795
+    # realnamelen is the maximum realname length allowed
796
+    realnamelen: 150
797
+
795 798
     # channellen is the max channel length allowed
796 799
     channellen: 64
797 800
 

Loading…
Cancel
Save