X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=bin%2Fnameserver.py;h=58982b877103fa7bb7f179d6eb9524534aa4d7f6;hb=d8edd4804d9e6513a17c497c1a30326d4ba0d677;hp=37cbdbf6b6df6f48e490c0e07af9dd8c193ccc94;hpb=e8663d13644933c1f05229374726b39e0fc20cb3;p=modules%2Fkernel.git diff --git a/bin/nameserver.py b/bin/nameserver.py old mode 100755 new mode 100644 index 37cbdbf6b..58982b877 --- a/bin/nameserver.py +++ b/bin/nameserver.py @@ -1,6 +1,5 @@ -#!/usr/bin/env python3 # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -25,7 +24,7 @@ import os, sys, re, socket #import commands from server import Server -from Utils_Identity import getShortHostName +from salome_utils import getHostName from launchConfigureParser import verbose # ----------------------------------------------------------------------------- @@ -46,13 +45,8 @@ class NamingServer(Server): except: pass - if verbose(): print("Name Service... ", end=' ') - #hname=os.environ["HOST"] #commands.getoutput("hostname") - if sys.platform == "win32": - hname = getShortHostName(); - else: - hname = socket.gethostname(); - # print("hname=",hname) + if verbose(): print("Name Service... ", end =' ') + hname = getHostName() with open(os.environ["OMNIORB_CONFIG"]) as f: ss = re.findall("NameService=corbaname::" + hname + ":\d+", f.read()) @@ -93,9 +87,16 @@ class NamingServer(Server): self.CMD = ['omniNames', '-start' , aPort , '-nohostname', '-logdir' , os.path.realpath(upath), '-errlog', os.path.realpath(os.path.join(upath,'omniNameErrors.log'))] #os.system("start omniNames -start " + aPort + " -logdir " + upath) else: - #self.CMD=['omniNames -start ' , aPort , ' -logdir ' , upath , ' &'] - self.CMD = ['omniNames','-start' , aPort, '-logdir' , upath, '-errlog', upath+'/omniNameErrors.log'] - #os.system("omniNames -start " + aPort + " -logdir " + upath + " &") + # get ip address on default interface (for instance eth0) to limit listening on this interface (cyber security request) + from subprocess import check_output + ips = check_output(['hostname', '--all-ip-addresses']) + if ips.strip(): + ipDefault = ips.split()[0].decode() + else: + ip = check_output(['hostname', '--ip-address']) + ipDefault = ip.split()[-1].decode() + self.CMD = ['omniNames','-start' , aPort] + self.CMD += ['-logdir' , upath, '-errlog', upath+'/omniNameErrors.log'] if verbose(): print("... ok") if verbose(): print("to list contexts and objects bound into the context with the specified name : showNS ")