+ if daemon.passwords != nil && *daemon.passwords != "" {
+ if client.password == "" {
+ client.ReplyParts("462", "You may not register")
+ client.conn.Close()
+ return
+ }
+ contents, err := ioutil.ReadFile(*daemon.passwords)
+ if err != nil {
+ log.Fatalf("Can no read passwords file %s: %s", *daemon.passwords, err)
+ return
+ }
+ for _, entry := range strings.Split(string(contents), "\n") {
+ if entry == "" {
+ continue
+ }
+ if lp := strings.Split(entry, ":"); lp[0] == client.nickname && lp[1] != client.password {
+ client.ReplyParts("462", "You may not register")
+ client.conn.Close()
+ return
+ }
+ }
+ }
+