Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple OPERS cause login, then password incorrect. #42

Open
matejkramny opened this issue Jul 19, 2012 · 1 comment
Open

Multiple OPERS cause login, then password incorrect. #42

matejkramny opened this issue Jul 19, 2012 · 1 comment
Labels

Comments

@matejkramny
Copy link
Contributor

Hi. Just discovered a bug. If you add more than one operators to the config file, and then try the OPER user pass command, the server will respond with :You are now an IRC operator followed by :Password Incorrect.

I fixed the issue. Code change in lib/commands.js

Original:

  // TODO: Local ops
  OPER: function(user, name, password) {
    if (!name || !password) {
      user.send(this.host, irc.errors.wasNoSuchNick, user.nick, ':OPER requires a nick and password');
    } else {
      var userConfig,
          self = this;

      Object.keys(this.config.opers).forEach(function(nick) {
        // TODO: ERR_NOOPERHOST (noOperHost)
        ircd.compareHash(password, self.config.opers[nick].password, function(err, res) {
          if (res) {
            user.send(self.host, irc.reply.youAreOper, user.nick, ':You are now an IRC operator');
            user.oper();
          } else {
            user.send(self.host, irc.errors.passwordWrong, user.nick, ':Password incorrect');
          }
        });
      });
    }
  },

Fixed:

  // TODO: Local ops
  OPER: function(user, name, password) {
    if (!name || !password) {
      user.send(this.host, irc.errors.wasNoSuchNick, user.nick, ':OPER requires a nick and password');
    } else {
      var userConfig,
          self = this;

      ircd.compareHash(password, self.config.opers[name].password, function(err, res) {
        if (res) {
          user.send(self.host, irc.reply.youAreOper, user.nick, ':You are now an IRC operator');
          user.oper();
        } else {
          user.send(self.host, irc.errors.passwordWrong, user.nick, ':Password incorrect');
        }
      });
    }
  },
@alexyoung
Copy link
Owner

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants