fix wait_thread and two add to trusted

develop
Спиридонов Денис 12 years ago
parent 6a9fcb9ff0
commit d4c3c50f0e

@ -204,9 +204,6 @@ def connect_with_cert(cert, path_to_cert, url, args, wait_thread, clVarsCore,
if not rsa:
store_passwd = get_password_from_daemon(args.host, args.port,
wait_thread)
if not wait_thread.isAlive():
wait_thread = StoppableThread()
wait_thread.start()
if 'store_passwd' in locals():
key_passwd = store_passwd
else:
@ -215,9 +212,6 @@ def connect_with_cert(cert, path_to_cert, url, args, wait_thread, clVarsCore,
client = Client_suds(url, transport=HTTPSClientCertTransport \
(CERT_KEY, CERT_FILE, path_to_cert, password=key_passwd,
wait_thread = wait_thread))
if not wait_thread.isAlive():
wait_thread = StoppableThread()
wait_thread.start()
client.wsdl.services[0].setlocation(url)
client.set_parameters (path_to_cert, CERT_FILE, CERT_KEY)
client_post_cert(client, clVarsCore)
@ -352,6 +346,9 @@ def main():
client, Connect_Error, crypto_Error, passwd_flag, e = \
connect_with_cert (serv_hostname, path_to_cert, url, args,
wait_thread, clVarsCore, crypto_Error, Connect_Error)
if not wait_thread.isAlive():
wait_thread = StoppableThread()
wait_thread.start()
get_name_flag = True
if Connect_Error:
if crypto_Error and passwd_flag:
@ -395,7 +392,6 @@ def main():
print _("Exception: %s") %e
tb.print_exc()
wait_thread.stop()
try:
client = Client_suds(url, \
transport = HTTPSClientCertTransport(None,None, path_to_cert))
@ -408,7 +404,7 @@ def main():
wait_thread.stop()
print '\b' + _('Failed to connect')+':', e
return 1
print server_host_name
try:
import glob
all_cert_list = glob.glob(os.path.join(path_to_cert, '*.crt'))
@ -421,11 +417,15 @@ def main():
fit_cert_list.sort(key = len)
Connect_Error = 1
crypto_Error = 0
e = None
for i in range (0, len(fit_cert_list)):
cert_name = fit_cert_list.pop()
client, Connect_Error, crypto_Error, passwd_flag, e = \
connect_with_cert (cert_name, path_to_cert, url, args,
wait_thread, clVarsCore, crypto_Error, Connect_Error)
if not wait_thread.isAlive():
wait_thread = StoppableThread()
wait_thread.start()
if Connect_Error == 0:
break

@ -411,7 +411,10 @@ class CheckingClientHTTPSConnection(CheckingHTTPSConnection):
elif result_server_con == 3:
continue
elif result_server_con == 4:
raise Exception (_('This server is not trusted'))
print _('This server is not trusted')
self.wait_thread.stop()
sys.exit(1)
# raise Exception (_('This server is not trusted'))
elif result_root_con == 2:
raise Exception (1)
elif result_user_root == 2:

Loading…
Cancel
Save