PUȹf d Z ddlZddlZddlZddlmZ ej e ZdZ ddl Z n # e$ r dZ Y nw xY wd Zd Z d Zd Zd Zd Zd Zd Zd Zd Zd ZdS )u Thin Python wrapper around the _lvdmap C extension (backed by liblve). Public interface is unchanged — callers (lveapi.py, lvectllib.py) continue to import and use these functions exactly as before. N )LvdErrorz/etc/container/lvd_idsc 2 t t d d S )Nz$_lvdmap C extension is not installed)_lvdmapr "py/websiteisolation/id_registry.py_require_lvdmapr s =>>> r c t j | j }n# t $ r Y dS w xY wt j t t | }t j | sdS |S )zmReturn the registry file path for *username*, or None if the user does not exist or has no registry file.N) pwdgetpwnampw_uidKeyErrorospathjoinLVD_IDS_DIRstrexists)usernameuidr s r registry_path_by_usernamer ! sx l8$$+ tt 7<<SXX..D 7>>$ tKs **c t j dk rt d t t j | | }t d||| |S )zzAssign a domain ID for a docroot. Returns existing ID if already assigned, otherwise allocates the next sequential ID.r "domain ID assignment requires rootz0assigned domain_id %d to docroot '%s' for uid %d)r geteuidr r r assignloginfo)r docroot domain_ids r assign_domain_idr! . sg z||q;<<<sG,,IHH ? &