fixes
This commit is contained in:
parent
d7132e5e9a
commit
3c3e18056f
|
@ -764,7 +764,12 @@ class BitcoinGUI:
|
||||||
|
|
||||||
def set_send_tab(self, payto, amount, message, label, identity, signature, cmd):
|
def set_send_tab(self, payto, amount, message, label, identity, signature, cmd):
|
||||||
if signature:
|
if signature:
|
||||||
signing_address = self.get_alias(identity, interactive = True)
|
if re.match('^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$', identity):
|
||||||
|
signing_address = self.get_alias(identity, interactive = True)
|
||||||
|
elif self.wallet.is_valid(identity):
|
||||||
|
signing_address = identity
|
||||||
|
else:
|
||||||
|
signing_address = None
|
||||||
if not signing_address:
|
if not signing_address:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
|
@ -827,8 +832,8 @@ class BitcoinGUI:
|
||||||
if auth_name is None:
|
if auth_name is None:
|
||||||
a = self.wallet.aliases.get(alias)
|
a = self.wallet.aliases.get(alias)
|
||||||
if not a:
|
if not a:
|
||||||
if interactive and self.question( "Warning: the alias is self-signed. Do you want to trust address %s ?"%to_address ):
|
if interactive and self.question( "Warning: the alias '%s' is self-signed. Do you want to trust address %s ?"%(alias,signing_address) ):
|
||||||
self.wallet.aliases[r] = signing_address
|
self.wallet.aliases[alias] = signing_address
|
||||||
else:
|
else:
|
||||||
target = None
|
target = None
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -734,44 +734,42 @@ class Wallet:
|
||||||
def read_alias(self, alias):
|
def read_alias(self, alias):
|
||||||
# this might not be the right place for this function.
|
# this might not be the right place for this function.
|
||||||
import urllib
|
import urllib
|
||||||
if self.is_valid(alias):
|
|
||||||
return alias
|
m1 = re.match('([\w\-\.]+)@((\w[\w\-]+\.)+[\w\-]+)', alias)
|
||||||
|
m2 = re.match('((\w[\w\-]+\.)+[\w\-]+)', alias)
|
||||||
|
if m1:
|
||||||
|
url = 'http://' + m1.group(2) + '/bitcoin.id/' + m1.group(1)
|
||||||
|
elif m2:
|
||||||
|
url = 'http://' + alias + '/bitcoin.id'
|
||||||
else:
|
else:
|
||||||
m1 = re.match('([\w\-\.]+)@((\w[\w\-]+\.)+[\w\-]+)', alias)
|
return ''
|
||||||
m2 = re.match('((\w[\w\-]+\.)+[\w\-]+)', alias)
|
try:
|
||||||
if m1:
|
lines = urllib.urlopen(url).readlines()
|
||||||
url = 'http://' + m1.group(2) + '/bitcoin.id/' + m1.group(1)
|
except:
|
||||||
elif m2:
|
return ''
|
||||||
url = 'http://' + alias + '/bitcoin.id'
|
|
||||||
else:
|
|
||||||
return ''
|
|
||||||
try:
|
|
||||||
lines = urllib.urlopen(url).readlines()
|
|
||||||
except:
|
|
||||||
return ''
|
|
||||||
|
|
||||||
# line 0
|
# line 0
|
||||||
line = lines[0].strip().split(':')
|
line = lines[0].strip().split(':')
|
||||||
if len(line) == 1:
|
if len(line) == 1:
|
||||||
auth_name = None
|
auth_name = None
|
||||||
target = signing_addr = line[0]
|
target = signing_addr = line[0]
|
||||||
else:
|
else:
|
||||||
target, auth_name, signing_addr, signature = line
|
target, auth_name, signing_addr, signature = line
|
||||||
msg = "alias:%s:%s:%s"%(alias,target,auth_name)
|
msg = "alias:%s:%s:%s"%(alias,target,auth_name)
|
||||||
print msg, signature
|
print msg, signature
|
||||||
self.verify_message(signing_addr, signature, msg)
|
self.verify_message(signing_addr, signature, msg)
|
||||||
|
|
||||||
|
# other lines are signed updates
|
||||||
|
for line in lines[1:]:
|
||||||
|
line = line.strip()
|
||||||
|
if not line: continue
|
||||||
|
line = line.split(':')
|
||||||
|
previous = target
|
||||||
|
print repr(line)
|
||||||
|
target, signature = line
|
||||||
|
self.verify_message(previous, signature, "alias:%s:%s"%(alias,target))
|
||||||
|
|
||||||
# other lines are signed updates
|
if not self.is_valid(target):
|
||||||
for line in lines[1:]:
|
raise BaseException("Invalid bitcoin address")
|
||||||
line = line.strip()
|
|
||||||
if not line: continue
|
|
||||||
line = line.split(':')
|
|
||||||
previous = target
|
|
||||||
print repr(line)
|
|
||||||
target, signature = line
|
|
||||||
self.verify_message(previous, signature, "alias:%s:%s"%(alias,target))
|
|
||||||
|
|
||||||
if not self.is_valid(target):
|
return target, signing_addr, auth_name
|
||||||
raise BaseException("Invalid bitcoin address")
|
|
||||||
|
|
||||||
return target, signing_addr, auth_name
|
|
||||||
|
|
Loading…
Reference in New Issue