mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-26 02:31:36 +03:00
Add password file path management in the Glances server mode
This commit is contained in:
parent
09224f1476
commit
fe1cf36688
@ -67,7 +67,8 @@ class GlancesXMLRPCHandler(SimpleXMLRPCRequestHandler, object):
|
||||
if username in self.server.user_dict:
|
||||
from glances.password import GlancesPassword
|
||||
|
||||
pwd = GlancesPassword()
|
||||
pwd = GlancesPassword(username=username,
|
||||
config=self.config)
|
||||
return pwd.check_password(self.server.user_dict[username], password)
|
||||
else:
|
||||
return False
|
||||
@ -93,10 +94,14 @@ class GlancesXMLRPCServer(SimpleXMLRPCServer, object):
|
||||
|
||||
finished = False
|
||||
|
||||
def __init__(self, bind_address, bind_port=61209, requestHandler=GlancesXMLRPCHandler):
|
||||
def __init__(self, bind_address,
|
||||
bind_port=61209,
|
||||
requestHandler=GlancesXMLRPCHandler,
|
||||
config=None):
|
||||
|
||||
self.bind_address = bind_address
|
||||
self.bind_port = bind_port
|
||||
self.config = config
|
||||
try:
|
||||
self.address_family = socket.getaddrinfo(bind_address, bind_port)[0][0]
|
||||
except socket.error as e:
|
||||
@ -191,7 +196,10 @@ class GlancesServer(object):
|
||||
|
||||
# Init the XML RPC server
|
||||
try:
|
||||
self.server = GlancesXMLRPCServer(args.bind_address, args.port, requestHandler)
|
||||
self.server = GlancesXMLRPCServer(args.bind_address,
|
||||
args.port,
|
||||
requestHandler,
|
||||
config=config)
|
||||
except Exception as e:
|
||||
logger.critical("Cannot start Glances server: {}".format(e))
|
||||
sys.exit(2)
|
||||
|
Loading…
Reference in New Issue
Block a user