|
|
|
@ -13,9 +13,10 @@
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from PySide import QtGui, QtCore
|
|
|
|
|
import urllib2
|
|
|
|
|
from calculate.lib.utils.tools import Locker
|
|
|
|
|
|
|
|
|
|
from more import show_msg, LabelWordWrap, get_ip_mac, get_sid
|
|
|
|
|
|
|
|
|
@ -27,23 +28,24 @@ def client_sid(sid, client, cert_id, lang):
|
|
|
|
|
server_host_name = client.server_host_name
|
|
|
|
|
|
|
|
|
|
find_flag = False
|
|
|
|
|
fs = open(client.SID_FILE, 'r')
|
|
|
|
|
lines = fs.readlines()
|
|
|
|
|
fs.close()
|
|
|
|
|
|
|
|
|
|
fi = open(client.SID_FILE, 'w')
|
|
|
|
|
for line in lines:
|
|
|
|
|
word = line.split()
|
|
|
|
|
if word:
|
|
|
|
|
if word[0] == server_host_name:
|
|
|
|
|
find_flag = True
|
|
|
|
|
line = '%s %s\n' %(word[0], sid)
|
|
|
|
|
fi.write(line)
|
|
|
|
|
|
|
|
|
|
if not find_flag:
|
|
|
|
|
fi = open(client.SID_FILE, 'a')
|
|
|
|
|
fi.write('%s %s\n' %(server_host_name, sid))
|
|
|
|
|
fi.close()
|
|
|
|
|
with Locker(fn=client.SID_LOCK):
|
|
|
|
|
fs = open(client.SID_FILE, 'r')
|
|
|
|
|
lines = fs.readlines()
|
|
|
|
|
fs.close()
|
|
|
|
|
|
|
|
|
|
fi = open(client.SID_FILE, 'w')
|
|
|
|
|
for line in lines:
|
|
|
|
|
word = line.split()
|
|
|
|
|
if word:
|
|
|
|
|
if word[0] == server_host_name:
|
|
|
|
|
find_flag = True
|
|
|
|
|
line = '%s %s\n' %(word[0], sid)
|
|
|
|
|
fi.write(line)
|
|
|
|
|
|
|
|
|
|
if not find_flag:
|
|
|
|
|
fi = open(client.SID_FILE, 'a')
|
|
|
|
|
fi.write('%s %s\n' %(server_host_name, sid))
|
|
|
|
|
fi.close()
|
|
|
|
|
# if new_sid[0][1] == 1:
|
|
|
|
|
return [sid, new_sid[0][1]]
|
|
|
|
|
|
|
|
|
@ -75,7 +77,7 @@ class ViewSessionInfo (QtGui.QWidget):
|
|
|
|
|
def __init__(self, parent, client, window):
|
|
|
|
|
QtGui.QWidget.__init__(self)
|
|
|
|
|
self.layout = QtGui.QGridLayout()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sid = get_sid(client)
|
|
|
|
|
try:
|
|
|
|
|
results = client.service.post_cert()
|
|
|
|
@ -83,9 +85,9 @@ class ViewSessionInfo (QtGui.QWidget):
|
|
|
|
|
self.layout.addWidget(LabelWordWrap (_('Not connected!')))
|
|
|
|
|
self.setLayout(self.layout)
|
|
|
|
|
return 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ip, mac = get_ip_mac()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if results[0][0] == -4:
|
|
|
|
|
self.layout.addWidget(LabelWordWrap(_('Certificate not found in'
|
|
|
|
|
' the server!'), self), 0,0,1,2)
|
|
|
|
|