xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #888: move-socket.patch

File move-socket.patch, 26.6 KB (added by Antoine Martin, 6 years ago)

work in progress patch: deals with a bit more than just sockets

  • xpra/dotxpra.py

     
    2424
    2525
    2626class DotXpra(object):
    27     def __init__(self, sockdir=None, confdir=None, actual_username=""):
    28         from xpra.platform.paths import get_default_socket_dir, get_user_conf_dir
     27    def __init__(self, sockdir=None, sockdirs=[], confdir=None, logdir=None, actual_username=""):
     28        from xpra.platform.paths import get_user_conf_dir
     29        self._sockdir = osexpand(sockdir, actual_username)
     30        self._sockdirs = [osexpand(x) for x in sockdirs]
    2931        self._confdir = osexpand(confdir or get_user_conf_dir(), actual_username)
    30         self._sockdir = osexpand(sockdir or get_default_socket_dir(), actual_username)
     32        self._logdir = osexpand(logdir or get_user_conf_dir(), actual_username)
    3133        if not os.path.exists(self._confdir):
    3234            os.mkdir(self._confdir, 0o700)
    3335        if not os.path.exists(self._sockdir):
     
    5860        return self.norm_make_path(local_display_name[1:], self._sockdir)
    5961
    6062    def log_path(self, local_display_name):
    61         return self.norm_make_path(local_display_name[1:], self._confdir)
     63        return self.norm_make_path(local_display_name[1:], self._logdir)
    6264
    6365    LIVE = "LIVE"
    6466    DEAD = "DEAD"
     
    111113
    112114    def sockets(self, check_uid=0, matching_state=None):
    113115        results = []
    114         base = os.path.join(self._sockdir, self._prefix)
    115         potential_sockets = glob.glob(base + "*")
    116         for path in sorted(potential_sockets):
    117             s = os.stat(path)
    118             if stat.S_ISSOCK(s.st_mode):
    119                 if check_uid>0:
    120                     if s.st_uid!=check_uid:
    121                         #socket uid does not match
     116        for d in [self._sockdir]+self.sockdirs:
     117            if not d:
     118                continue
     119            base = os.path.join(d, self._prefix)
     120            potential_sockets = glob.glob(base + "*")
     121            for path in sorted(potential_sockets):
     122                s = os.stat(path)
     123                if stat.S_ISSOCK(s.st_mode):
     124                    if check_uid>0:
     125                        if s.st_uid!=check_uid:
     126                            #socket uid does not match
     127                            continue
     128                    state = self.get_server_state(path)
     129                    if matching_state and state!=matching_state:
    122130                        continue
    123                 state = self.get_server_state(path)
    124                 if matching_state and state!=matching_state:
    125                     continue
    126                 local_display = ":"+path[len(base):]
    127                 results.append((state, local_display))
     131                    local_display = ":"+path[len(base):]
     132                    results.append((state, local_display))
    128133        return results
  • xpra/platform/darwin/features.py

     
    33# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
    44# later version. See the file COPYING for details.
    55
    6 DEFAULT_SSH_CMD = "ssh"
    7 GOT_PASSWORD_PROMPT_SUGGESTION = "Perhaps you need to set up your ssh agent?\n"
    86SYSTEM_TRAY_SUPPORTED = True
     7
    98CLIPBOARDS=["CLIPBOARD"]
    109CLIPBOARD_WANT_TARGETS = True
    1110CLIPBOARD_GREEDY = True
    1211CLIPBOARD_NATIVE_CLASS = ("xpra.platform.darwin.osx_clipboard", "OSXClipboardProtocolHelper", {})
    13 SHADOW_SUPPORTED = True
    14 CAN_DAEMONIZE = True
     12
    1513UI_THREAD_POLLING = 500    #poll every 500 ms
     14
     15DEFAULT_SSH_CMD = "ssh"
     16GOT_PASSWORD_PROMPT_SUGGESTION = "Perhaps you need to set up your ssh agent?\n"
  • xpra/platform/darwin/paths.py

     
    7575    default_conf_dir = "/Library/Application Support/Xpra"
    7676    return os.environ.get("XPRA_SYSCONF_DIR", default_conf_dir)
    7777
     78def get_socket_dirs():
     79    return ["~/xpra"]
    7880
     81
    7982def get_sound_command():
    8083    cs = os.environ.get("XPRA_SOUND_COMMAND")
    8184    if cs:
  • xpra/platform/features.py

     
    44# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
    55# later version. See the file COPYING for details.
    66
    7 import os.path
    87import sys
    9 
    108#defaults which may be overriden by platform_import:
    119LOCAL_SERVERS_SUPPORTED = sys.version_info[0]<3
    12 SHADOW_SUPPORTED = False
    13 MMAP_SUPPORTED = False
     10SHADOW_SUPPORTED = True
     11CAN_DAEMONIZE = True
     12MMAP_SUPPORTED = True
    1413SYSTEM_TRAY_SUPPORTED = False
    15 DEFAULT_SSH_CMD = False
    16 GOT_PASSWORD_PROMPT_SUGGESTION = ""
     14
    1715CLIPBOARDS = []
    1816CLIPBOARD_WANT_TARGETS = False
    1917CLIPBOARD_GREEDY = False
    2018CLIPBOARD_NATIVE_CLASS = None
    21 CAN_DAEMONIZE = False
     19
    2220UI_THREAD_POLLING = 0
    2321OPEN_COMMAND = "xdg-open"
    24 DOWNLOAD_PATH = "~/Downloads"
    25 if not os.path.exists(os.path.expanduser(DOWNLOAD_PATH)):
    26     DOWNLOAD_PATH = "~"
    2722
    2823DEFAULT_PULSEAUDIO_COMMAND = "pulseaudio --start --daemonize=false --system=false " + \
    2924                                    "--exit-idle-time=-1 -n --load=module-suspend-on-idle " + \
     
    3025                                    "--load=module-null-sink --load=module-native-protocol-unix "+ \
    3126                                    "--log-level=2 --log-target=stderr"
    3227DEFAULT_XVFB_COMMAND = "Xvfb +extension Composite -screen 0 3840x2560x24+32 -nolisten tcp -noreset -auth $XAUTHORITY"
     28DEFAULT_SSH_CMD = False
     29GOT_PASSWORD_PROMPT_SUGGESTION = ""
    3330
    3431
    3532_features_list_ = ["LOCAL_SERVERS_SUPPORTED",
     
    4138                "DEFAULT_PULSEAUDIO_COMMAND",
    4239                "DEFAULT_XVFB_COMMAND",
    4340                "GOT_PASSWORD_PROMPT_SUGGESTION",
    44                 "DOWNLOAD_PATH",
    4541                "CLIPBOARDS",
    4642                "CLIPBOARD_WANT_TARGETS",
    4743                "CLIPBOARD_GREEDY",
  • xpra/platform/paths.py

     
    4141    return os.environ.get("XPRA_USER_CONF_DIR", "~/.xpra")
    4242
    4343
    44 def get_default_socket_dir():
    45     return os.environ.get("XPRA_SOCKET_DIR", "~/.xpra")
     44def get_socket_dirs():
     45    return [os.environ.get("XPRA_SOCKET_DIR", "~/.xpra")]
    4646
     47def get_default_log_dir():
     48    return "~/.xpra"
     49
     50def get_download_dir():
     51    d = "~/Downloads"
     52    if not os.path.exists(os.path.expanduser(d)):
     53        return "~"
     54    return d
     55
    4756#overriden in platform code:
    4857def get_app_dir():
    4958    return default_get_app_dir()
     
    144153                "get_default_conf_dir",
    145154                "get_system_conf_dir",
    146155                "get_user_conf_dir",
    147                 "get_default_socket_dir")
     156                "get_socket_dirs",
     157                "get_default_log_dir",
     158                "get_download_dir")
    148159
    149160def get_info():
    150161    return {
     
    152163            "default_conf.dir"  : get_default_conf_dir(),
    153164            "system_conf.dir"   : get_system_conf_dir(),
    154165            "user_conf.dir"     : get_user_conf_dir(),
    155             "socket"            : get_default_socket_dir(),
     166            "socket.dirs"       : get_socket_dirs(),
     167            "log.dir"           : get_default_log_dir(),
     168            "download.dir"      : get_download_dir(),
    156169            "app.dir"           : get_app_dir(),
    157170            "app.default.dir"   : default_get_app_dir(),
    158171            "resources"         : get_resources_dir(),
  • xpra/platform/win32/features.py

     
    44# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
    55# later version. See the file COPYING for details.
    66
    7 # Platform-specific code for Win32.
    8 import os
    9 
    10 def get_registry_value(key, reg_path, entry):
    11     import win32api             #@UnresolvedImport
    12     hKey = win32api.RegOpenKey(key, reg_path)
    13     value, _ = win32api.RegQueryValueEx(hKey, entry)
    14     win32api.RegCloseKey(hKey)
    15     return    value
    16 
    17 
     7# Platform-specific settings for Win32.
     8CAN_DAEMONIZE = False
     9MMAP_SUPPORTED = False
    1810SYSTEM_TRAY_SUPPORTED = True
    19 SHADOW_SUPPORTED = True
    20 os.environ["PLINK_PROTOCOL"] = "ssh"
    2111DEFAULT_SSH_CMD = "plink"
    22 PRINT_COMMAND = ""
    23 #TODO: use "FOLDERID_Downloads":
    24 # FOLDERID_Downloads = "{374DE290-123F-4565-9164-39C4925E467B}"
    25 # maybe like here:
    26 # https://gist.github.com/mkropat/7550097
    27 #from win32com.shell import shell, shellcon
    28 #shell.SHGetFolderPath(0, shellcon.CSIDL_MYDOCUMENTS, None, 0)
    29 try:
    30     #use the internet explorer registry key:
    31     #HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer
    32     import win32con             #@UnresolvedImport
    33     DOWNLOAD_PATH = get_registry_value(win32con.HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer", "Download Directory")
    34 except:
    35     #fallback to what the documentation says is the default:
    36     DOWNLOAD_PATH = os.path.join(os.environ.get("USERPROFILE", "~"), "My Documents", "Downloads")
    37     if not os.path.exists(DOWNLOAD_PATH):
    38         DOWNLOAD_PATH = os.path.join(os.environ.get("USERPROFILE", "~"), "Downloads")
     12
    3913GOT_PASSWORD_PROMPT_SUGGESTION = \
    4014   'Perhaps you need to set up Pageant, or (less secure) use --ssh="plink -pw YOUR-PASSWORD"?\n'
    4115CLIPBOARDS=["CLIPBOARD"]
     
    4519#these don't make sense on win32:
    4620DEFAULT_PULSEAUDIO_COMMAND = ""
    4721DEFAULT_XVFB_COMMAND = ""
     22PRINT_COMMAND = ""
  • xpra/platform/win32/paths.py

     
    5151    return os.environ.get("XPRA_CONF_DIR", _get_data_dir())
    5252
    5353
    54 def get_default_socket_dir():
     54def get_registry_value(key, reg_path, entry):
     55    import win32api             #@UnresolvedImport
     56    hKey = win32api.RegOpenKey(key, reg_path)
     57    value, _ = win32api.RegQueryValueEx(hKey, entry)
     58    win32api.RegCloseKey(hKey)
     59    return    value
     60
     61def get_download_dir():
     62    #TODO: use "FOLDERID_Downloads":
     63    # FOLDERID_Downloads = "{374DE290-123F-4565-9164-39C4925E467B}"
     64    # maybe like here:
     65    # https://gist.github.com/mkropat/7550097
     66    #from win32com.shell import shell, shellcon
     67    #shell.SHGetFolderPath(0, shellcon.CSIDL_MYDOCUMENTS, None, 0)
     68    try:
     69        #use the internet explorer registry key:
     70        #HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer
     71        import win32con             #@UnresolvedImport
     72        DOWNLOAD_PATH = get_registry_value(win32con.HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer", "Download Directory")
     73    except:
     74        #fallback to what the documentation says is the default:
     75        DOWNLOAD_PATH = os.path.join(os.environ.get("USERPROFILE", "~"), "My Documents", "Downloads")
     76        if not os.path.exists(DOWNLOAD_PATH):
     77            DOWNLOAD_PATH = os.path.join(os.environ.get("USERPROFILE", "~"), "Downloads")
     78
     79
     80def get_socket_dirs():
    5581    #ie: C:\Documents and Settings\Username\Application Data\Xpra
    56     return os.environ.get("XPRA_SOCKET_DIR", _get_data_dir())
     82    return [os.environ.get("XPRA_SOCKET_DIR", _get_data_dir())]
    5783
     84
    5885APP_DIR = None
    5986if hasattr(sys, 'frozen') and sys.frozen in (True, "windows_exe", "console_exe"):    #@UndefinedVariable
    6087    #cx_freeze = sys.frozen == True
  • xpra/platform/xposix/features.py

     
    44# later version. See the file COPYING for details.
    55
    66#don't bother trying to forward system tray with Ubuntu's "unity":
    7 SHADOW_SUPPORTED = True
    87from xpra.util import is_unity
    98SYSTEM_TRAY_SUPPORTED = not is_unity()
    10 MMAP_SUPPORTED = True
    11 CAN_DAEMONIZE = True
    129DEFAULT_SSH_CMD = "ssh"
    1310GOT_PASSWORD_PROMPT_SUGGESTION = "Perhaps you need to set up your ssh agent?\n"
    14 CLIPBOARDS=["CLIPBOARD", "PRIMARY", "SECONDARY"]
    15  No newline at end of file
     11CLIPBOARDS=["CLIPBOARD", "PRIMARY", "SECONDARY"]
  • xpra/platform/xposix/paths.py

     
    4343
    4444def get_icon_dir():
    4545    return os.path.join(get_app_dir(), "icons")
     46
     47def get_socket_dirs():
     48    SOCKET_DIRS = ["~/.xpra"]   #the old default
     49    #added in 0.16, support for /run:
     50    if os.path.exists("/run/user") and os.path.isdir("/run/user"):
     51        #private, per user: /run/user/1000/xpra
     52        SOCKET_DIRS.append("/run/user/$UID/xpra")
     53        #for shared sockets:
     54        SOCKET_DIRS.append("/run/xpra")
     55    return SOCKET_DIRS
  • xpra/scripts/config.py

     
    325325                    "remote-logging"    : bool,
    326326                    "av-sync"           : bool,
    327327                    #arrays of strings:
     328                    "socket-dirs"       : list,
    328329                    "encodings"         : list,
    329330                    "video-encoders"    : list,
    330331                    "csc-modules"       : list,
     
    347348    global GLOBAL_DEFAULTS
    348349    if GLOBAL_DEFAULTS is not None:
    349350        return GLOBAL_DEFAULTS
    350     from xpra.platform.features import DEFAULT_SSH_CMD, DOWNLOAD_PATH, OPEN_COMMAND, DEFAULT_PULSEAUDIO_COMMAND, DEFAULT_XVFB_COMMAND
     351    from xpra.platform.features import DEFAULT_SSH_CMD, DOWNLOAD_PATH, OPEN_COMMAND, DEFAULT_PULSEAUDIO_COMMAND, DEFAULT_XVFB_COMMAND, SOCKET_DIRS, DEFAULT_LOG_DIR
    351352    try:
    352353        from xpra.platform.info import get_username
    353354        username = get_username()
     
    375376                    "ssh"               : DEFAULT_SSH_CMD,
    376377                    "xvfb"              : DEFAULT_XVFB_COMMAND,
    377378                    "socket-dir"        : "",
     379                    "log-dir"           : DEFAULT_LOG_DIR,
    378380                    "log-file"          : "$DISPLAY.log",
    379381                    "border"            : "auto,0",
    380382                    "max-size"          : "",
     
    434436                    "printing"          : True,
    435437                    "open-files"        : False,
    436438                    "swap-keys"         : sys.platform.startswith("darwin"),    #only used on osx
     439                    "socket-dirs"       : SOCKET_DIRS,
    437440                    "encodings"         : ["all"],
    438441                    "video-encoders"    : ["all"],
    439442                    "csc-modules"       : ["all"],
  • xpra/scripts/main.py

     
    2222from xpra.dotxpra import DotXpra, osexpand
    2323from xpra.platform.features import LOCAL_SERVERS_SUPPORTED, SHADOW_SUPPORTED, CAN_DAEMONIZE
    2424from xpra.platform.options import add_client_options
    25 from xpra.platform.paths import get_default_socket_dir
    2625from xpra.scripts.config import OPTION_TYPES, ENCRYPTION_CIPHERS, \
    2726    make_defaults_struct, parse_bool, print_bool, print_number, validate_config, has_sound_support, name_to_field
    2827
     
    357356        group.add_option("--daemon", action="store", metavar="yes|no",
    358357                          dest="daemon", default=defaults.daemon,
    359358                          help="Daemonize when running as a server (default: %s)" % enabled_str(defaults.daemon))
     359        group.add_option("--log-dir", action="store",
     360                      dest="log_dir", default=defaults.log_dir,
     361                      help="The directory where log files are placed"
     362                      )
    360363        group.add_option("--log-file", action="store",
    361364                      dest="log_file", default=defaults.log_file,
    362365                      help="When daemonizing, this is where the log messages will go. Default: '%default'."
    363                       + " If a relative filename is specified the it is relative to --socket-dir,"
     366                      + " If a relative filename is specified the it is relative to --log-dir,"
    364367                      + " the value of '$DISPLAY' will be substituted with the actual display used"
    365368                      )
    366369    else:
    367370        ignore({"daemon"    : False,
    368                 "log_file"  : defaults.log_file})
     371                "log_file"  : defaults.log_file,
     372                "log_dir"   : defaults.log_dir,
     373                })
    369374
    370375    #FIXME: file tranfer command line options:
    371376    legacy_bool_parse("printing")
     
    656661    group.add_option("--dpi", action="store",
    657662                      dest="dpi", default=defaults.dpi,
    658663                      help="The 'dots per inch' value that client applications should try to honour, from 10 to 1000 or 0 for automatic setting. Default: %s." % print_number(defaults.dpi))
    659     default_socket_dir_str = defaults.socket_dir or "$XPRA_SOCKET_DIR or '~/.xpra'"
     664    group.add_option("--socket-dirs", action="append",
     665                      dest="socket_dirs", default=defaults.socket_dirs,
     666                      help="Directories to look for the socket files in. Default: %s." % ", ".join("'%s'" % x for x in defaults.socket_dirs))
     667    default_socket_dir_str = defaults.socket_dir or "$XPRA_SOCKET_DIR or the first valid directory in socket-dirs"
    660668    group.add_option("--socket-dir", action="store",
    661669                      dest="socket_dir", default=defaults.socket_dir,
    662670                      help="Directory to place/look for the socket files in. Default: '%s'." % default_socket_dir_str)
     
    939947        elif mode == "initenv":
    940948            from xpra.scripts.server import xpra_runner_shell_script, write_runner_shell_script
    941949            script = xpra_runner_shell_script(script_file, os.getcwd(), options.socket_dir)
    942             dotxpra = DotXpra(options.socket_dir)
     950            dotxpra = DotXpra()
    943951            write_runner_shell_script(dotxpra, script, False)
    944952            return 0
    945953        else:
     
    10251033                error_cb("invalid ssh port specified: %s" % ssh_port)
    10261034            #grr why bother doing it different?
    10271035            if is_putty:
     1036                #special env used by plink:
     1037                env = os.environ.copy()
     1038                env["PLINK_PROTOCOL"] = "ssh"
     1039                desc["env"] = env
    10281040                full_ssh += ["-P", ssh_port]
    10291041            else:
    10301042                full_ssh += ["-p", ssh_port]
     
    10951107def pick_display(error_cb, opts, extra_args):
    10961108    if len(extra_args) == 0:
    10971109        # Pick a default server
    1098         sockdir = DotXpra(opts.socket_dir or get_default_socket_dir())
     1110        sockdir = DotXpra(opts.socket_dir, opts.socket_dirs)
    10991111        servers = sockdir.sockets()
    11001112        live_servers = [display
    11011113                        for (state, display) in servers
     
    11431155            cmd = proxy_cmd
    11441156        try:
    11451157            kwargs = {}
     1158            if "env" in display_desc:
     1159                kwargs["env"] = display_desc["env"]
    11461160            kwargs["stderr"] = sys.stderr
    11471161            if not display_desc.get("exit_ssh", False) and os.name=="posix" and not sys.platform.startswith("darwin"):
    11481162                def setsid():
     
    14181432        raise InitException("too many existing xpra servers found, cannot guess which one to use")
    14191433    return live[0]
    14201434
    1421 def guess_X11_display(socket_dir):
     1435def guess_X11_display(socket_dir, socket_dirs):
    14221436    displays = [":%s" % x for x in find_X11_displays()]
    14231437    assert len(displays)!=0, "could not detect any live X11 displays"
    14241438    if len(displays)>1:
     
    14251439        #since we are here to shadow,
    14261440        #assume we want to shadow a real X11 server,
    14271441        #so remove xpra's own displays to narrow things down:
    1428         sockdir = DotXpra(socket_dir)
     1442        sockdir = DotXpra(socket_dir, socket_dir)
    14291443        results = sockdir.sockets()
    14301444        xpra_displays = [display for _, display in results]
    14311445        displays = list(set(displays)-set(xpra_displays))
     
    14371451    from xpra.server.proxy import XpraProxy
    14381452    assert "gtk" not in sys.modules
    14391453    if mode in ("_proxy_start", "_shadow_start"):
    1440         dotxpra = DotXpra()
     1454        dotxpra = DotXpra(opts.socket_dir, opts.socket_dirs)
    14411455        #we must use a subprocess to avoid messing things up - yuk
    14421456        cmd = [script_file]
    14431457        if mode=="_proxy_start":
     
    14611475                #display_name was provided:
    14621476                display_name = args[0]
    14631477            else:
    1464                 display_name = guess_X11_display(opts.socket_dir)
     1478                display_name = guess_X11_display(opts.socket_dir, opts.socket_dirs)
    14651479                #we now know the display name, so add it:
    14661480                args = [display_name]
    14671481        #adds the display to proxy start command:
     
    15371551def run_stopexit(mode, error_cb, opts, extra_args):
    15381552    assert "gtk" not in sys.modules
    15391553
    1540     def show_final_state(display):
    1541         sockdir = DotXpra(opts.socket_dir)
     1554    def show_final_state(display_desc):
     1555        display = display_desc["display"]
     1556        sockdir = display_desc["socket_dir"]
     1557        sockdir = DotXpra(sockdir)
    15421558        for _ in range(6):
    15431559            final_state = sockdir.server_state(display)
    15441560            if final_state is DotXpra.LIVE:
     
    15741590        if app:
    15751591            app.cleanup()
    15761592    if display_desc["local"]:
    1577         show_final_state(display_desc["display"])
     1593        show_final_state(display_desc)
    15781594    else:
    15791595        print("Sent shutdown command")
    15801596    return  e
    15811597
    15821598
    1583 def may_cleanup_socket(sockdir, state, display, clean_states=[DotXpra.DEAD]):
     1599def may_cleanup_socket(dotxpra, state, display, clean_states=[DotXpra.DEAD]):
    15841600    sys.stdout.write("\t%s session at %s" % (state, display))
    15851601    if state in clean_states:
    15861602        try:
    1587             os.unlink(sockdir.socket_path(display))
     1603            os.unlink(dotxpra.socket_path(display))
    15881604        except OSError:
    15891605            pass
    15901606        else:
     
    15951611    assert "gtk" not in sys.modules
    15961612    if extra_args:
    15971613        error_cb("too many arguments for mode")
    1598     sockdir = DotXpra(opts.socket_dir)
    1599     results = sockdir.sockets()
     1614    dotxpra = DotXpra(opts.socket_dir, opts.socket_dirs)
     1615    results = dotxpra.sockets()
    16001616    if not results:
    16011617        error_cb("No xpra sessions found")
    16021618    sys.stdout.write("Found the following xpra sessions:\n")
    16031619    for state, display in results:
    1604         may_cleanup_socket(sockdir, state, display)
     1620        may_cleanup_socket(dotxpra, state, display)
    16051621    #now, re-probe the "unknown" ones:
    16061622    unknown = [display for state, display in results if state==DotXpra.UNKNOWN]
    16071623    if len(unknown)>0:
     
    16131629        probe_list = list(unknown)
    16141630        unknown = []
    16151631        for display in probe_list:
    1616             state = sockdir.server_state(display)
     1632            state = dotxpra.server_state(display)
    16171633            if state is DotXpra.DEAD:
    1618                 may_cleanup_socket(sockdir, state, display)
     1634                may_cleanup_socket(dotxpra, state, display)
    16191635            elif state is DotXpra.UNKNOWN:
    16201636                unknown.append(display)
    16211637            else:
     
    16231639    #now cleanup those still unknown:
    16241640    clean_states = [DotXpra.DEAD, DotXpra.UNKNOWN]
    16251641    for display in unknown:
    1626         state = sockdir.server_state(display)
    1627         may_cleanup_socket(sockdir, state, display, clean_states=clean_states)
     1642        state = dotxpra.server_state(display)
     1643        may_cleanup_socket(dotxpra, state, display, clean_states=clean_states)
    16281644    return 0
    16291645
    16301646
  • xpra/server/auth/file_auth.py

     
    2323
    2424password_file = None
    2525socket_dir = None
     26socket_dirs = None
    2627def init(opts):
    27     global password_file, socket_dir
     28    global password_file, socket_dir, socket_dirs
    2829    password_file = opts.password_file
    2930    socket_dir = opts.socket_dir
     31    socket_dirs = opts.socket_dirs
    3032
    3133
    3234def parseOptions(s):
     
    4648auth_data = None
    4749auth_data_time = None
    4850def load_auth_file():
    49     global auth_data, auth_data_time, password_file, socket_dir
     51    global auth_data, auth_data_time, password_file, socket_dir, socket_dirs
    5052    ptime = 0
    5153    if password_file:
    5254        if not os.path.exists(password_file):
     
    8082            if line.find("|")<0:
    8183                #assume old style file with just the password
    8284                #get all the displays for the current user:
    83                 sockdir = DotXpra(socket_dir)
     85                sockdir = DotXpra(socket_dir, socket_dirs)
    8486                results = sockdir.sockets()
    8587                displays = [display for state, display in results if state==DotXpra.LIVE]
    8688                auth_data[""] = line, os.getuid(), os.getgid(), displays, {}, {}
  • xpra/server/auth/sys_auth_base.py

     
    1111
    1212
    1313socket_dir = None
     14socket_dirs = None
    1415def init(opts):
    15     global socket_dir
     16    global socket_dir, socket_dirs
    1617    socket_dir = opts.socket_dir
     18    socket_dirs = opts.socket_dirs
    1719
    1820
    1921class SysAuthenticator(object):
     
    7981        uid = self.get_uid()
    8082        gid = self.get_gid()
    8183        try:
    82             sockdir = DotXpra(socket_dir, actual_username=self.username)
     84            sockdir = DotXpra(socket_dir, socket_dirs, actual_username=self.username)
    8385            results = sockdir.sockets(check_uid=uid)
    8486            displays = [display for state, display in results if state==DotXpra.LIVE]
    8587        except Exception as e:
  • xpra/server/source.py

     
    14251425            location = "on %s (via xpra)" % self.hostname
    14261426        #expand it here so the xpraforwarder doesn't need to import anything xpra:
    14271427        from xpra.dotxpra import osexpand
    1428         from xpra.platform.paths import get_default_socket_dir
    1429         socket_dir = osexpand(self.socket_dir or get_default_socket_dir())
    14301428        attributes = {"display"         : os.environ.get("DISPLAY"),
    14311429                      "source"          : self.uuid,
    1432                       "socket-dir"      : socket_dir}
     1430                      "socket-dir"      : osexpand(self.socket_dir)}
    14331431        for k,v in printers.items():
    14341432            if k in self.printers:
    14351433                #remove existing definition: