prevent traceback. Fixes #7503

This commit is contained in:
Yann Leboulanger 2013-11-06 21:17:15 +01:00
parent a0e84e08cf
commit 52a70f34fe
1 changed files with 8 additions and 2 deletions

View File

@ -810,7 +810,10 @@ class EncryptedStanzaSession(ArchivingStanzaSession):
# the offset of the group we chose (need it to match up with the dhhash) # the offset of the group we chose (need it to match up with the dhhash)
group_order = 0 group_order = 0
self.modp = int(form.getField('modp').getOptions()[group_order][1]) modp_f = form.getField('modp')
if not modp_f:
return
self.modp = int(modp_f.getOptions()[group_order][1])
x.addChild(node=nbxmpp.DataField(name='modp', value=self.modp)) x.addChild(node=nbxmpp.DataField(name='modp', value=self.modp))
g = dh.generators[self.modp] g = dh.generators[self.modp]
@ -818,7 +821,10 @@ class EncryptedStanzaSession(ArchivingStanzaSession):
self.n_o = base64.b64decode(form['my_nonce']) self.n_o = base64.b64decode(form['my_nonce'])
dhhashes = form.getField('dhhashes').getValues() dhhashes_f = form.getField('dhhashes')
if not dhhashes_f:
return
dhhashes = dhhashes_f.getValues()
self.negotiated['He'] = base64.b64decode(dhhashes[group_order].encode( self.negotiated['He'] = base64.b64decode(dhhashes[group_order].encode(
'utf8')) 'utf8'))