Browse Source

Merge remote-tracking branch 'origin/master' into oauth.5

pull/2122/head
Shivaram Lingamneni 3 months ago
parent
commit
2d09dadf22
5 changed files with 12 additions and 1 deletions
  1. 3
    0
      default.yaml
  2. 1
    0
      irc/config.go
  3. 4
    0
      irc/handlers.go
  4. 1
    1
      irctest
  5. 3
    0
      traditional.yaml

+ 3
- 0
default.yaml View File

@@ -854,6 +854,9 @@ limits:
854 854
     # identlen is the max ident length allowed
855 855
     identlen: 20
856 856
 
857
+    # realnamelen is the maximum realname length allowed
858
+    realnamelen: 150
859
+
857 860
     # channellen is the max channel length allowed
858 861
     channellen: 64
859 862
 

+ 1
- 0
irc/config.go View File

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

+ 4
- 0
irc/handlers.go View File

@@ -3374,6 +3374,10 @@ func userHandler(server *Server, client *Client, msg ircmsg.Message, rb *Respons
3374 3374
 		rb.Add(nil, server.name, ERR_NEEDMOREPARAMS, client.Nick(), "USER", client.t("Not enough parameters"))
3375 3375
 		return false
3376 3376
 	}
3377
+	config := server.Config()
3378
+	if config.Limits.RealnameLen > 0 && len(realname) > config.Limits.RealnameLen {
3379
+		realname = ircmsg.TruncateUTF8Safe(realname, config.Limits.RealnameLen)
3380
+	}
3377 3381
 
3378 3382
 	// #843: we accept either: `USER user:pass@clientid` or `USER user@clientid`
3379 3383
 	if strudelIndex := strings.IndexByte(username, '@'); strudelIndex != -1 {

+ 1
- 1
irctest

@@ -1 +1 @@
1
-Subproject commit 6425e707acb092386b859ef738ee401a0021f65b
1
+Subproject commit df2880e379866c6354fa7ce776b436a2c49c557b

+ 3
- 0
traditional.yaml View File

@@ -826,6 +826,9 @@ limits:
826 826
     # identlen is the max ident length allowed
827 827
     identlen: 20
828 828
 
829
+    # realnamelen is the maximum realname length allowed
830
+    realnamelen: 150
831
+
829 832
     # channellen is the max channel length allowed
830 833
     channellen: 64
831 834
 

Loading…
Cancel
Save