diff --git a/docs/Usage.md b/docs/Usage.md index cf4260d..a2bce55 100644 --- a/docs/Usage.md +++ b/docs/Usage.md @@ -149,7 +149,7 @@ If placed just after `connect` refers to the main address and all additive coupl -u or --no-reuse > Use this subparser `connect` option not to allow binding / listening to the same ip address - port couple specified with `-n`. -If placed just after `connect` refers to the main address and all additive couples without `-b` or `-u` options. Reusing port is activated by default. +If placed just after `connect` refers to the main address and all additive couples without `-b` or `-u` options. Reusing port is activated by default (except when running inside the Windows Sandbox and the current user is `WDAGUtilityAccount`). -d or --dual > Use this subparser `connect` option to allow listening to an IPv6 address also accepting connections via IPv4. diff --git a/py-kms/pykms_Server.py b/py-kms/pykms_Server.py index 7db3e37..74932b5 100755 --- a/py-kms/pykms_Server.py +++ b/py-kms/pykms_Server.py @@ -13,6 +13,7 @@ import pickle import socketserver import queue as Queue import selectors +import getpass from time import monotonic as time import pykms_RpcBind, pykms_RpcRequest @@ -515,11 +516,11 @@ def server_check(): srv_config['listen'] = addresses def server_create(): - # Create address list. + # Create address list (when the current user indicates execution inside the Windows Sandbox, then we wont allow port reuse - it is not supported). all_address = [( srv_config['ip'], srv_config['port'], (srv_config['backlog_main'] if 'backlog_main' in srv_config else srv_options['backlog']['def']), - (srv_config['reuse_main'] if 'reuse_main' in srv_config else srv_options['reuse']['def']) + (srv_config['reuse_main'] if 'reuse_main' in srv_config else False if getpass.getuser() == 'WDAGUtilityAccount' else srv_options['reuse']['def']) )] log_address = "TCP server listening at %s on port %d" %(srv_config['ip'], srv_config['port'])