Browse Source

Fix PASS handling

tags/v0.1.0
Daniel Oaks 8 years ago
parent
commit
41473bb444
2 changed files with 8 additions and 1 deletions
  1. 6
    0
      irc/config.go
  2. 2
    1
      irc/server.go

+ 6
- 0
irc/config.go View File

@@ -51,6 +51,7 @@ type Config struct {
51 51
 
52 52
 	Server struct {
53 53
 		PassConfig
54
+		Password         string
54 55
 		Name             string
55 56
 		Database         string
56 57
 		Listen           []string
@@ -109,6 +110,11 @@ func LoadConfig(filename string) (config *Config, err error) {
109 110
 		return nil, err
110 111
 	}
111 112
 
113
+	// we need this so PasswordBytes returns the correct info
114
+	if config.Server.Password != "" {
115
+		config.Server.PassConfig.Password = config.Server.Password
116
+	}
117
+
112 118
 	if config.Network.Name == "" {
113 119
 		return nil, errors.New("Network name missing")
114 120
 	}

+ 2
- 1
irc/server.go View File

@@ -341,7 +341,8 @@ func passHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
341 341
 	// check the provided password
342 342
 	password := []byte(msg.Params[0])
343 343
 	if ComparePassword(server.password, password) != nil {
344
-		client.Quit("bad password")
344
+		client.Send(nil, server.nameString, ERR_PASSWDMISMATCH, client.nickString, "Password incorrect")
345
+		client.Send(nil, server.nameString, "ERROR", "Password incorrect")
345 346
 		return true
346 347
 	}
347 348
 

Loading…
Cancel
Save