Skip to content

Commit

Permalink
Add certfp support. Closes GH-468.
Browse files Browse the repository at this point in the history
  • Loading branch information
progval committed Nov 10, 2013
1 parent 2b12a33 commit e65a722
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/conf.py
Expand Up @@ -306,6 +306,9 @@ def registerNetwork(name, password='', ssl=False, sasl_username='',
registerGlobalValue(network, 'ssl', registry.Boolean(ssl,
_("""Determines whether the bot will attempt to connect with SSL
sockets to %s.""") % name))
registerGlobalValue(network, 'certfile', registry.String('',
_("""Determines what certificate file (if any) the bot will use to
connect with SSL sockets to %s.""") % name))
registerChannelValue(network.channels, 'key', registry.String('',
_("""Determines what key (if any) will be used to join the
channel."""), private=True))
Expand Down
5 changes: 4 additions & 1 deletion src/drivers/Socket.py
Expand Up @@ -304,7 +304,10 @@ def reconnect(self, wait=False, reset=True):
try:
if getattr(conf.supybot.networks, self.irc.network).ssl():
assert globals().has_key('ssl')
self.conn = ssl.wrap_socket(self.conn)
certfile = getattr(conf.supybot.networks, self.irc.network) \
.certfile()
self.conn = ssl.wrap_socket(self.conn,
certfile=certfile or None)
self.conn.connect((address, server[1]))
def setTimeout():
self.conn.settimeout(conf.supybot.drivers.poll())
Expand Down

0 comments on commit e65a722

Please sign in to comment.