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
     # identlen is the max ident length allowed
820
     # identlen is the max ident length allowed
821
     identlen: 20
821
     identlen: 20
822
 
822
 
823
+    # realnamelen is the maximum realname length allowed
824
+    realnamelen: 150
825
+
823
     # channellen is the max channel length allowed
826
     # channellen is the max channel length allowed
824
     channellen: 64
827
     channellen: 64
825
 
828
 

+ 1
- 0
irc/config.go View File

484
 	ChanListModes        int `yaml:"chan-list-modes"`
484
 	ChanListModes        int `yaml:"chan-list-modes"`
485
 	ChannelLen           int `yaml:"channellen"`
485
 	ChannelLen           int `yaml:"channellen"`
486
 	IdentLen             int `yaml:"identlen"`
486
 	IdentLen             int `yaml:"identlen"`
487
+	RealnameLen          int `yaml:"realnamelen"`
487
 	KickLen              int `yaml:"kicklen"`
488
 	KickLen              int `yaml:"kicklen"`
488
 	MonitorEntries       int `yaml:"monitor-entries"`
489
 	MonitorEntries       int `yaml:"monitor-entries"`
489
 	NickLen              int `yaml:"nicklen"`
490
 	NickLen              int `yaml:"nicklen"`

+ 4
- 0
irc/handlers.go View File

3334
 		rb.Add(nil, server.name, ERR_NEEDMOREPARAMS, client.Nick(), "USER", client.t("Not enough parameters"))
3334
 		rb.Add(nil, server.name, ERR_NEEDMOREPARAMS, client.Nick(), "USER", client.t("Not enough parameters"))
3335
 		return false
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
 	// #843: we accept either: `USER user:pass@clientid` or `USER user@clientid`
3342
 	// #843: we accept either: `USER user:pass@clientid` or `USER user@clientid`
3339
 	if strudelIndex := strings.IndexByte(username, '@'); strudelIndex != -1 {
3343
 	if strudelIndex := strings.IndexByte(username, '@'); strudelIndex != -1 {

+ 3
- 0
traditional.yaml View File

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

Loading…
Cancel
Save