mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
Merge branch '3.0' into image-management-refactoring
# Conflicts: # gns3server/api/routes/controller/permissions.py
This commit is contained in:
commit
d8bceaad5d
618 files changed
+4841
-13708
No files matched your search
@@ -357,7 +357,7 @@ if __name__ == "__main__":
|
||||
# Demo using telnet
|
||||
shell = Demo(welcome_message="Welcome!\n")
|
||||
server = create_telnet_shell(shell, loop=loop)
|
||||
coro = asyncio.start_server(server.run, "127.0.0.1", 4444, loop=loop)
|
||||
coro = asyncio.start_server(server.run, "127.0.0.1", 4444)
|
||||
s = loop.run_until_complete(coro)
|
||||
try:
|
||||
loop.run_forever()
|
||||
|
||||
@@ -127,7 +127,7 @@ if __name__ == "__main__":
|
||||
)
|
||||
],
|
||||
)
|
||||
coro = asyncio.start_server(server.run, "0.0.0.0", 4444, loop=loop)
|
||||
coro = asyncio.start_server(server.run, "0.0.0.0", 4444)
|
||||
s = loop.run_until_complete(coro)
|
||||
|
||||
try:
|
||||
|
||||
@@ -420,7 +420,7 @@ if __name__ == "__main__":
|
||||
)
|
||||
server = AsyncioTelnetServer(reader=process.stdout, writer=process.stdin, binary=False, echo=False)
|
||||
|
||||
coro = asyncio.start_server(server.run, "127.0.0.1", 4444, loop=loop)
|
||||
coro = asyncio.start_server(server.run, "127.0.0.1", 4444)
|
||||
s = loop.run_until_complete(coro)
|
||||
|
||||
try:
|
||||
|
||||
@@ -48,7 +48,7 @@ def is_safe_path(file_path: str, basedir: str) -> bool:
|
||||
return Path(basedir).resolve() in test_path.resolve().parents
|
||||
|
||||
|
||||
def check_path_allowed(path):
|
||||
def check_path_allowed(path: str):
|
||||
"""
|
||||
If the server is non local raise an error if
|
||||
the path is outside project directories
|
||||
@@ -62,3 +62,16 @@ def check_path_allowed(path):
|
||||
|
||||
if Config.instance().settings.Server.local is False:
|
||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="The path is not allowed")
|
||||
|
||||
|
||||
def get_mountpoint(path: str):
|
||||
"""
|
||||
Find the mount point of a path.
|
||||
"""
|
||||
|
||||
path = os.path.abspath(path)
|
||||
while path != os.path.sep:
|
||||
if os.path.ismount(path):
|
||||
return path
|
||||
path = os.path.abspath(os.path.join(path, os.pardir))
|
||||
return path
|
||||
Reference in new issue
Block a user