§ ½@¾jÔãó„—ddlZddlZddlZddlmZmZddlmZddlm Z ej e ¦«Z Gd„dee¦«Z dS)éN)ÚModifyDomainHookÚModifyUserHook)Úlve_supported_or_exit)Úregistry_path_by_usernamecóz—eZdZdZdZe dd„¦«Zed„¦«Zed„¦«Ze d d„¦«Z dS) ÚDomainLimitsHookzª Keep the LVD on-disk state (domains.json + binary id-registry) in sync with control-panel domain and user events so that per-domain limits keep working. z/usr/sbin/lvectlNc óN—t|¦«sdS|p|}|jdd|d|g} |r| d|gz } |r| d|gz } tj| dd¬¦«} | jd krNt  d | j| j d ¬ ¦«  ¦«¦«dSdS) Núregenerate-domainsú --usernamez--domainz --old-domainz --old-docrootTF©Úcapture_outputÚcheckrz%regenerate-domains failed (rc=%d): %sÚreplace©Úerrors© rÚLVECTLÚ subprocessÚrunÚ returncodeÚlogÚwarningÚstderrÚdecodeÚstrip) ÚselfÚusernameÚdomainÚ new_domainÚinclude_subdomainsÚ old_docrootÚ new_docrootÚkwargsÚcurrent_domainÚcmdÚresults ú(py/lve_utils/hooks/domain_limits_hook.pyÚpost_modify_domainz#DomainLimitsHook.post_modify_domainså€õ )¨Ñ2Ô2ð Ø ˆFà#Ð- vˆð ŒKÐ-Ø ˜(Ø ˜ð ˆð ð ,Ø �N FÐ+Ñ +ˆCØ ð 2Ø �O [Ð1Ñ 1ˆCå” °DÀÐFÑFÔFˆØ Ô  Ò !Ð !Ý �KŠKØ7ØÔ!Ø” ×$Ò$¨IÐ$Ñ6Ô6×<Ò<Ñ>Ô>ñ ô ð ð ð ð "Ð !óc ó"—t|¦«sdS|jdd|d|g}tj|dd¬¦«}|jdkrNt  d |j|j d ¬ ¦«  ¦«¦«dSdS) açDrop the registrations the deleted domain leaves behind. Nothing else does: the registry entry is written by root, the panel never learns of it, and the single-domain regenerate path needs a docroot the panel can still resolve. Left alone the entry, its domains.json record and its kernel LVE outlive the domain, and every later `lvectl apply` reports the account as holding a registration the panel no longer lists (CLOS-7467). Nr r z--deleted-domainTFr rz;regenerate-domains after domain deletion failed (rc=%d): %srrr)rrrr#r%r&s r'Úpost_delete_domainz#DomainLimitsHook.post_delete_domain8s­€õ)¨Ñ2Ô2ð Ø ˆFð ŒKÐ-Ø ˜(Ø  ð ˆõ ” °DÀÐFÑFÔFˆØ Ô  Ò !Ð !Ý �KŠKØMØÔ!Ø” ×$Ò$¨IÐ$Ñ6Ô6×<Ò<Ñ>Ô>ñ ô ð ð ð ð "Ð !r)c óŒ—t|¦«sdStj|¦«j}|jd|g|jdt |¦«gfD]w}t j|dd¬¦«}|jdkrSt  d|d |j|j   d ¬ ¦«  ¦«¦«ŒxdS) a[Tear down the per-domain state of an account being deleted. Runs before deletion because the marker is keyed by uid, which no longer resolves once the account is gone. Left alone, the marker, lvp and the domain LVEs outlive the account, and the marker keeps counting a dead uid as allowed (CLOS-7502). deny-domain-limits ends with an apply that recreates lve, and listener order is not fixed, so LveLifecycleHook may already have destroyed it; destroy it again here so this hook does not itself leave lve behind. Nzdeny-domain-limitsÚdestroyTFr rz*%s before user deletion failed (rc=%d): %sérr)rÚpwdÚgetpwnamÚpw_uidrÚstrrrrrrrrr)rrr#Úuidr%r&s r'Úpre_delete_userz DomainLimitsHook.pre_delete_userSsÒ€õ)¨Ñ2Ô2ð Ø ˆFÝŒl˜8Ñ$Ô$Ô+ˆà”[Ð"6¸ÐAØ”[ )­S°©X¬XÐ6ð8ð ð ˆCå”^ C¸ÀEÐJÑJÔJˆFØÔ  AÒ%Ð%Ý— ’ Ø@ؘ”FØÔ%Ø”M×(Ò(° Ð(Ñ:Ô:×@Ò@ÑBÔBñ ôðøð ð r)c ó&—|€dSt|¦«sdS|jdd|g}tj|dd¬¦«}|jdkrNt  d|j|j d¬ ¦«  ¦«¦«dSdS) Nr r TFr rz7regenerate-domains after user rename failed (rc=%d): %srrr)rrÚnew_nameÚ new_ownerr#r%r&s r'Úpost_modify_userz!DomainLimitsHook.post_modify_userps³€ð Ð Ø ˆFå(¨Ñ2Ô2ð Ø ˆFð ŒKÐ-Ø ˜(ð ˆõ” °DÀÐFÑFÔFˆØ Ô  Ò !Ð !Ý �KŠKØIØÔ!Ø” ×$Ò$¨IÐ$Ñ6Ô6×<Ò<Ñ>Ô>ñ ô ð ð ð ð "Ð !r))NNNN)NN) Ú__name__Ú __module__Ú __qualname__Ú__doc__rrr(r+r4r8©r)r'rrs«€€€€€ððð  €Fàð15Ø*.ðððñÔðð8ððñÔðð4ððñÔðð8Ø26Ø#'ðððñÔðððr)r)Úloggingr/rÚclcommon.public_hooks.librrÚclcommon.lib.cleditionrÚwebsiteisolation.id_registryrÚ getLoggerr9rrr=r)r'úrCs´ðð€€€Ø € € € ØÐÐÐàFÐFÐFÐFÐFÐFÐFÐFØ8Ð8Ð8Ð8Ð8Ð8ØBÐBÐBÐBÐBÐBà€gÔ˜Ñ!Ô!€ðpðpðpðpðpÐ'¨ñpôpðpðpðpr)