Skip to content

Commit

Permalink
Issue/#977 Remove IRC password functionality (#978)
Browse files Browse the repository at this point in the history
* Remove IRC password functionality

* Remove note about IRC error message from doc
  • Loading branch information
Askaholic authored Oct 17, 2023
1 parent 455912e commit 5c92c84
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 27 deletions.
1 change: 0 additions & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ WARNING GEO_IP_LICENSE_KEY not set! Unable to download GeoIP database!
WARNING Unable to connect to RabbitMQ. Is it running?
ConnectionError: [Errno 111] Connect call failed ('127.0.0.1', 5672)
WARNING Not connected to RabbitMQ, unable to declare exchange.
ERROR Failure updating NickServ password for test
```

**Note:** *The pipenv scripts are NOT meant for production deployment. For
Expand Down
33 changes: 7 additions & 26 deletions server/lobbyconnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@
import asyncio
import contextlib
import json
import os
import random
import urllib.parse
import urllib.request
from binascii import hexlify
from datetime import datetime
from functools import wraps
from hashlib import md5
from typing import Optional

import aiohttp
from sqlalchemy import and_, func, select
from sqlalchemy.exc import DBAPIError, OperationalError, ProgrammingError
from sqlalchemy.exc import DBAPIError

import server.metrics as metrics
from server.db import FAFDatabase
Expand Down Expand Up @@ -511,14 +508,16 @@ async def command_auth(self, message):

username = row.login

new_irc_password = hexlify(os.urandom(16)).decode()
# DEPRECATED: IRC passwords are handled outside of the lobby server.
# This message remains here for backwards compatibility, but the data
# sent is meaningless and can be ignored by clients.
await self.send({
"command": "irc_password",
"password": new_irc_password
"password": "deprecated"
})

await self.on_player_login(
player_id, username, new_irc_password, unique_id, auth_method
player_id, username, unique_id, auth_method
)

async def command_hello(self, message):
Expand All @@ -543,14 +542,13 @@ async def command_hello(self, message):
)

await self.on_player_login(
player_id, username, password, unique_id, "password"
player_id, username, unique_id, "password"
)

async def on_player_login(
self,
player_id: int,
username: str,
password: str,
unique_id: str,
method: str
):
Expand Down Expand Up @@ -582,7 +580,6 @@ async def on_player_login(
last_login=func.now()
)
)
await self.update_irc_password(conn, username, password)

self.player = Player(
login=username,
Expand Down Expand Up @@ -679,22 +676,6 @@ async def on_player_login(

await self.send_game_list()

async def update_irc_password(self, conn, login, password):
# Since the password is hashed on the client, what we get at this point
# is really md5(md5(sha256(password))). This is entirely insane.
temp = md5(password.encode()).hexdigest()
irc_pass = "md5:" + md5(temp.encode()).hexdigest()

try:
await conn.execute(
"UPDATE anope.anope_db_NickCore "
"SET pass = :passwd WHERE display = :display",
passwd=irc_pass,
display=login
)
except (OperationalError, ProgrammingError):
self._logger.error("Failure updating NickServ password for %s", login)

async def command_restore_game_session(self, message):
assert self.player is not None

Expand Down

0 comments on commit 5c92c84

Please sign in to comment.