|f@ddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z dZdZdZe d d ZGd d ej$ZGd dej(j*e Zy))GLibN) SourceEntry) DBusGMainLoop)SoftwarePropertieszcom.ubuntu.SoftwareProperties/T)set_as_defaultcNtjdkr|jdS|S)N3zutf-8)sysversionencode)strings P/usr/lib/python3/dist-packages/softwareproperties/dbus/SoftwarePropertiesDBus.py _to_unicoder(s"[[3 == !! MceZdZdZy)PermissionDeniedByPolicyz6com.ubuntu.SoftwareProperties.PermissionDeniedByPolicyN)__name__ __module__ __qualname___dbus_error_namerrrr.sOrrcTeZdZd+dZfdZfdZejje ddZ ejje ddZ ejje ddZ ejje dd Z ejje dd Zejje d d dd d,dZejje d d dd d,dZejje d d dd d,dZejje d d dd d,dZejje d d dd d,dZejje d d dd d,dZejje d d dd d,dZejje d d dd d,dZejje d d dd d,dZejje d d dd d,dZejje d d dd d,dZejje d d dd d,dZdZdZejje d d dd d,dZejje d d d d d,d!Zejje d d d d d,d"Z ejje d d d d d,d#Z!ejje d d dd d,d$Z"ejje d d dd d,d%Z#ejje d d dd d,d&Z$ejje d d dd d,d'Z%ejje d d dd d,d(Z&ejje d d dd d,d)Z'd*Z(xZ)S)-SoftwarePropertiesDBusc4tj||||dd|_d|_tj j t|}tj jj||td|_ tjdy)NT)optionsdatadirrootdirdeb822)buszwaiting for connections) r__init__ dbus_infopolkitdbusserviceBusNameDBUS_INTERFACE_NAMEObject DBUS_PATHenforce_polkitloggingdebug)selfr rrrbus_names rr!zSoftwarePropertiesDBus.__init__3sw##D'7,3D B <<''(;'E $$T8Y?" /0rcJtt| |jyN)superrsave_sourceslistSourcesListModifiedr- __class__s rr2z'SoftwarePropertiesDBus.save_sourceslistBs $d<>   "rcJtt| |jyr0)r1r write_configConfigModifiedr4s rr7z#SoftwarePropertiesDBus.write_configEs $d8: r)dbus_interface signaturec.tjdy)0 emit signal when the sources.list got modified zSourcesListModified signalNr+r,r-s rr3z*SoftwarePropertiesDBus.SourcesListModifiedJs  23rc.tjdy)r=zConfigModified signalNr>r?s rr8z%SoftwarePropertiesDBus.ConfigModifiedOs  -.rc.tjdy)z, emit signal when the apt keys got modified zKeysModified signalNr>r?s r KeysModifiedz#SoftwarePropertiesDBus.KeysModifiedTs  +,rc.tjdy)z6 emit signal when the policykit authentication failed z Auth signalNr>r?s r AuthFailedz!SoftwarePropertiesDBus.AuthFailedYs  m$rc.tjdy)z( emit signal when adding a cdrom failed zCdrom scan failed signalNr>r?s rCdromScanFailedz&SoftwarePropertiesDBus.CdromScanFailed^s  01rsenderconn)sender_keywordconnection_keyword in_signature out_signaturecJ|j||d|jyNz*com.ubuntu.softwareproperties.applychanges)_check_policykit_privilegerevertr-rGrHs rRevertzSoftwarePropertiesDBus.Revertes$ '' DF H rc$|jyr0)reload_sourceslistrQs rReloadzSoftwarePropertiesDBus.Reloadms !rsc^|j||d|jt|yrN)rOenable_child_sourcerr-templaterGrHs rEnableChildSourcez(SoftwarePropertiesDBus.EnableChildSourcets. '' DF H   X!67rc^|j||d|jt|yrN)rOdisable_child_sourcerrYs rDisableChildSourcez)SoftwarePropertiesDBus.DisableChildSource|s. '' DF H !!+h"78rc^|j||d|jt|yrN)rOenable_componentrr- componentrGrHs rEnableComponentz&SoftwarePropertiesDBus.EnableComponents. '' DF H k)45rc^|j||d|jt|yrN)rOdisable_componentrras rDisableComponentz'SoftwarePropertiesDBus.DisableComponents. '' DF H {956rcJ|j||d|jyrN)rOenable_source_code_sourcesrQs rEnableSourceCodeSourcesz.SoftwarePropertiesDBus.EnableSourceCodeSourcess' '' DF H '')rcj|j||d|j|jyrN)rOdisable_source_code_sourcesr2rQs rDisableSourceCodeSourcesz/SoftwarePropertiesDBus.DisableSourceCodeSourcess3 '' DF H ((* rc^|j||d|jt|yrN)rOtoggle_source_userr-sourcerGrHs rToggleSourceUsez&SoftwarePropertiesDBus.ToggleSourceUses. '' DF H {623rssbcp|j||d|jt|t|SrN)rOreplace_source_entryr)r-oldnewrGrHs rReplaceSourceEntryz)SoftwarePropertiesDBus.ReplaceSourceEntrys= '' DF H((  k#.0 0rc^|j||d|jt|yrN)rOchange_main_download_serverr)r-serverrGrHs rChangeMainDownloadServerz/SoftwarePropertiesDBus.ChangeMainDownloadServers. '' DF H ((V)<=rcJ|j||d|jyrN)rO_add_cdrom_sourcerQs rAddCdromSourcez%SoftwarePropertiesDBus.AddCdromSources' '' DF H  rc tj}dddddddddddd|jzg }tj|}t j d |j||y ) z add a (already inserted) cdrom z apt-cdromaddz-ozDebug::aptcdrom=1zDebug::identcdrom=1zacquire::cdrom::AutoDetect=1zacquire::cdrom::NoMount=1zDir::Etc::sourcelist=%siN)tempfileNamedTemporaryFilename subprocessPopenr timeout_add_wait_for_cdrom_scan_finish)r-tmpcmdps rr~z(SoftwarePropertiesDBus._add_cdrom_sourcesq))+E(*30.9    S ! d>>3Grc6|jy|j}|dk7r|jyd}t|jD]}|}|dk7r?|jj j dt||jy)z= glib timeout helper to wait for the cdrom scanner to finish TrFr9) pollrFopenr sourceslistlistinsertrset_modified_sourceslist)r-rrreslinexs rrz2SoftwarePropertiesDBus._wait_for_cdrom_scan_finishs 668 ffh !8  "chh AD  2:    ! ! ( (K,= >  ) ) +rcL|j||d|j|yrN)rOset_popcon_pariticipation)r- participatesrGrHs rSetPopconPariticipationz.SoftwarePropertiesDBus.SetPopconPariticipations) '' DF H &&|4ricL|j||d|j|yrN)rOset_update_automation_levelr-staterGrHs rSetUpdateAutomationLevelz/SoftwarePropertiesDBus.SetUpdateAutomationLevel) '' DF H ((/rcL|j||d|j|yrN)rOset_release_upgrades_policyrs rSetReleaseUpgradesPolicyz/SoftwarePropertiesDBus.SetReleaseUpgradesPolicyrrc^|j||d|jt|yrN)rOset_update_intervalint)r-daysrGrHs rSetUpdateIntervalz(SoftwarePropertiesDBus.SetUpdateIntervals- '' DF H   T+rc~|j||d|jt||jyrN)rOadd_source_from_linerrB)r- sourceLinerGrHs rAddSourceFromLinez(SoftwarePropertiesDBus.AddSourceFromLines: '' DF H !!+j"9: rc^|j||d|jt|yrN)rO remove_sourcerros r RemoveSourcez#SoftwarePropertiesDBus.RemoveSources. '' DF H ;v./rcr|j||d|j|}|r|j|SrN)rOadd_keyrB)r-pathrGrHrs rAddKeyzSoftwarePropertiesDBus.AddKey!s= '' DF Hll4       rcr|j||d|j|}|r|j|SrN)rOadd_key_from_datarB)r-keyDatarGrHrs rAddKeyFromDataz%SoftwarePropertiesDBus.AddKeyFromData,s? '' DF H$$W-      rcr|j||d|j|}|r|j|SrN)rO remove_keyrB)r-keyidrGrHrs r RemoveKeyz SoftwarePropertiesDBus.RemoveKey7s= '' DF Hooe$      rcp|j||d|j}|r|j|SrN)rO update_keysrB)r-rGrHrs r UpdateKeysz!SoftwarePropertiesDBus.UpdateKeysBs= '' DF H       rc $||y|jsy|j,tj|j dddd|_|jj |}|j >tjtjj dddd|_ |j jdd tj|d if|d d itjd d d \}}}|sAtjd||||t!|fz|j#t%|y#tj$r4}|jdk(rd|_|j|||cYd}~Sd}~wwxYw)aVerify that sender has a given PolicyKit privilege. sender is the sender's (private) D-BUS name, such as ":1:42" (sender_keyword in @dbus.service.methods). conn is the dbus.Connection object (connection_keyword in @dbus.service.methods). privilege is the PolicyKit privilege string. This method returns if the caller is privileged, and otherwise throws a PermissionDeniedByPolicy exception. Nzorg.freedesktop.DBusz/org/freedesktop/DBus/BusFzorg.freedesktop.PolicyKit1z%/org/freedesktop/PolicyKit1/Authorityz$org.freedesktop.PolicyKit1.Authorityzsystem-bus-namer) variant_levelr9iX)timeoutz)org.freedesktop.DBus.Error.ServiceUnknownzW_check_polkit_privilege: sender %s on connection %s pid %i is not authorized for %s: %s)r*r"r$ Interface get_objectGetConnectionUnixProcessIDr# SystemBusCheckAuthorizationStringUInt32 DBusExceptionr_check_polkit_privileger+r,strrDr) r-rGrH privilegepidis_auth_detailses rrOz1SoftwarePropertiesDBus._check_policykit_privilegeNs >dl ""  >> !!^^DOO<>  \\,(0V&(<!<! H * \\,(0V&)=5=5  \\,(0V&)=0=0  \\,(0V&)=0=0  \\,(0V&)=,=, \\,(0V&)==  \\,(0V&)=0=0 \\,(0V&)>> \\,(0V&)>> \\,(0V&)>> \\,(0V&(==06rr) gi.repositoryr dbus.servicer$r+rrr aptsources.sourceslistrdbus.mainloop.glibr%softwareproperties.SoftwarePropertiesr DBUS_BUS_NAMEr)r'rrrr%r(rrrrrsn* .,D/  5 T" Pt11PM6T\\002DM6r