1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-25 23:55:24 +00:00

tunnel.py fix socket creation problem

This commit is contained in:
catborise 2020-07-14 15:10:03 +03:00
parent f23e6b000f
commit b6cb81c3bc
2 changed files with 6 additions and 15 deletions

View file

@ -22,7 +22,7 @@ django.setup()
import re import re
import socket import socket
from six.moves import http_cookies as Cookie from six.moves import http_cookies as Cookie
from webvirtcloud.settings import WS_PORT, WS_HOST, WS_CERT from webvirtcloud.settings import WS_PUBLIC_PORT, WS_HOST, WS_CERT
from vrtManager.connection import CONN_SSH, CONN_SOCKET from vrtManager.connection import CONN_SSH, CONN_SOCKET
from console.tunnel import Tunnel from console.tunnel import Tunnel
from optparse import OptionParser from optparse import OptionParser
@ -55,7 +55,7 @@ parser.add_option("-p",
dest="port", dest="port",
action="store", action="store",
help="Listen port", help="Listen port",
default=WS_PORT or 6080) default=WS_PUBLIC_PORT or 6080)
parser.add_option("-c", parser.add_option("-c",
"--cert", "--cert",
@ -145,13 +145,6 @@ class CompatibilityMixIn(object):
if 'token' in cookie: if 'token' in cookie:
token = cookie['token'].value token = cookie['token'].value
# cookie = Cookie.SimpleCookie()
# cookie.load(self.headers.getheader('cookie'))
# if 'token' not in cookie:
# self.msg('No token cookie found !')
# return False
# token = cookie['token'].value
(connhost, connport, connuser, conntype, console_host, console_port, (connhost, connport, connuser, conntype, console_host, console_port,
console_socket) = get_connection_infos(token) console_socket) = get_connection_infos(token)
@ -213,7 +206,6 @@ class CompatibilityMixIn(object):
if tsock: if tsock:
tsock.shutdown(socket.SHUT_RDWR) tsock.shutdown(socket.SHUT_RDWR)
tsock.close() tsock.close()
if tunnel:
tunnel.close() tunnel.close()
raise raise

View file

@ -28,7 +28,6 @@ import signal
import logging import logging
from functools import reduce from functools import reduce
class Tunnel(object): class Tunnel(object):
def __init__(self): def __init__(self):
self.outfd = None self.outfd = None
@ -92,9 +91,9 @@ class Tunnel(object):
os.close(0) os.close(0)
os.close(1) os.close(1)
os.close(2) os.close(2)
os.dup(fds[1].fileno()) os.dup2(fds[1].fileno(), 0)
os.dup(fds[1].fileno()) os.dup2(fds[1].fileno(), 1)
os.dup(errorfds[1].fileno()) os.dup2(errorfds[1].fileno(), 2)
os.execlp(*argv) os.execlp(*argv)
os._exit(1) os._exit(1)
else: else: