VULN_CHECK_I913V6 ?(f*ddlmZddlmZddlmZmZmZddlZddlZddl Zddl Zddl Z ddl Z ddl Z ddlZddlZej j"Gddej$j&ZdZej,dZej,d Zej,d Zej,d Zd Zy) )absolute_import)unicode_literals)_loggerP_NceZdZdgZedj ejjZ e dZ dZ dZ dZdZy ) ConfigManagerCommandzconfig-managerz4manage {prog} configuration options and repositories)progc |jdddtd|jdddtd  |jd gd d td|jdddtd |jdddtd |j}|jddddtd|jddddtdy)Ncrepo*sectionz2configuration sections to manage, "main" or repoid)nargsmetavarhelp--saveF store_truez/save the current options (useful with --setopt))defaultactionr --add-repoappendURLz8add (and enable) the repo from the specified file or url)rrrr--dumpz,print current configuration values to stdout--dump-variableszprint variable values to stdout --set-enabled set_enabledz"enable repos (automatically saves))rdestrr--set-disabled set_disabledz#disable repos (automatically saves)) add_argumentradd_mutually_exclusive_group)parser enable_groups ?/usr/lib/python3.12/site-packages/dnf-plugins/config_manager.py set_argparserz"ConfigManagerCommand.set_argparser)s 3 GH  J  eLDE  G  "XuMN  P  eLAB  D  l45  7::< !!/5'4\'()M'N " P !!"2E'5l'()N'O " Qc|jj}d|_|jjgk7s|jj s|jj s|jjsz|jjsd|jjsN|jjjtdjdjgd|jjgk7rt!j"td|jj sB|jjs,|jjs|jjrd|_|jj&Dcgc]}|dk7s |j)d}}|Dcgc]}|D] }|dk7r| c}}|j_ycc}wcc}}w)NTz.one of the following arguments is required: {} )rrrrrz--enablerz --disablez{Warning: --enablerepo/--disablerepo arguments have no meaningwith config manager. Use --set-enabled/--set-disabled instead.,)clidemandsavailable_reposoptsadd_reposavedumpdump_variablesrr optparsererrorrformatjoinrepos_edrwarning root_userr split)selfr,x temp_listsublistitems r$ configurezConfigManagerCommand.configureBs|(("""&##r)))''&& HH   $ $Q'W%X&,fSXX7H.I'J K 99   # NN1^_ ` IINNdii33 &&$))*<*< $G ,099??G?aa3hQWWS\? G/8/yG42:  y/ H/s! G/,G/G4cr|jjr|jy|jy)zExecute the util action here.N)r.r/ modify_repo)r;s r$runzConfigManagerCommand.runds$ 99   MMO    r&cN g t fd}jjrmjjD] | d tjdr{jjj D] | d nHtjdr2jjj D] | d  r:t jjtddj zjj}i}tjdr,jjrjj}jjrFjjjj!D]\ }t# d|jjrd jjvrىjj$rR|rPjjj'jjj(d |j|jj*r[t#jj,j/d t#jjj+ sy jj0sjj2rdj_t5 D]z}i}jj0rd |d <njj2rd |d <tjdr^jjj!D]7\}}t7j6|j8|s'|j;|9jj$rH|rFjjj'|j<|j8|j|jj*s't#jj,j/d|j8zt#|j+}y )z< process --set-enabled, --set-disabled and --setopt options c|dk(ryjjj|}|sjy|rj |yy)Nmain)baserepos get_matchingaddextend)keyadd_matching_reposmatchingmatching_reposnamenot_matching_repos_idr;s r$ match_reposz5ConfigManagerCommand.modify_repo..match_reposqsLf}yy33C8H%))$/#%%h/$r&T repo_setoptsFzNo matching repo to modify: %s.z, main_setoptsz = rFN1enabled0zrepo: )setr.r hasattrrSkeysdnf exceptionsErrorrr6rGconfrTr2 substitutionsitemsprintr0write_raw_configfileconfig_file_pathr1output fmtSectionrrsortedfnmatchidupdaterepofile) r;rRsbcmodifyvalrepo repo_modifyrepoidsetoptsrOrPrQs ` @@@r$rBz ConfigManagerCommand.modify_repoks4 # 0 99?? D$'(tyy.1 II22779De,:tyy.1 II22779Dd+: !..&&q)J'K)-3H)I(JK Kiinn 499n -$))2H2HYY++F 99 # #!YY^^99??A c4-.Byy&DIIOO";yy~~& 33DIINN4S4SU[474E4EvOyy~~dii&&11&9:diinn))+,  99 DII$:$:!DIIN>*DKyy$$), I&''), I&tyy.1'+yy'='='C'C'EOFGtww7#**73(Fyy~~+ 33DMM477CL]L]_jkyy~~dii&&11(TWW2DEFdiik"+r&cz|jjj}d}|jjD]}t j jj|jdk(r"dtjj|z}tjtd||jdrtjj!|}tjj#||} |jj%|d}t'j(|j*|tj,|d|j/1t5|}d j7t j8j:|}tjj#|d |z}d |d|d|d} t=|| r|r*t j>jAtCdd|y #t0$r%}|d z }tj2|Yd }~d }~wwxYw)z process --add-repo option rr*zfile://zAdding repo from: %sz.repow+)modeNz$created by {} config-manager from {}z%s.repo[z] name=z baseurl=z enabled=1 zConfiguration of repo failedzConfiguration of repos failed)"rGr^ get_reposdirr.r/r[pycompurlparseschemeospathabspathrinforendswithbasenamer6urlopenshutilcopy2rPchmodcloseIOErrorr4sanitize_url_to_fsr5util MAIN_PROG save_to_filer\r]r) r; myrepodir errors_counturldestnameferpreponamecontents r$r/zConfigManagerCommand.add_reposIINN//  99%%Czz""++C0772="''//#"66 KK013 7||G$77++C077<< 8< ))#D)9ALL2HHXu-GGI,C0AHHI[I[]`a77<< 9v3EF173H#Hg63&4 ..&&r*H*I<(YZ Z  A%LLLOsA#H  H:H55H:N)__name__ __module__ __qualname__aliasesrr5r[rrsummary staticmethodr%r@rCrBr/r&r$r r "sc  GFGNN XX  O!GQQ0 /DB#H#Zr&r c, t|d5}tjj||t j |ddddy#1swYyxYw#t tf$r*}tjtd||Yd}~yd}~wwxYw)Nrsruz&Could not save repo to repofile %s: %sFT) openr[ry write_to_filer|rrOSErrorrr4r)filenamerfdrs r$rrs| (D !R JJ $ $R 1 HHXu %" "  W  Q?@q "s4 A7AAAAAB) BBz^\w+:/*(\w+:|www\.)?z[?/:&#|~\*\[\]\(\)\'\\]+z^[,.]*z[,.]*$c tj|rtjjr!|j dj d}nct|tr!|j dj d}n|j d}t|tr|j d}tjd|}tjd|}t jd|}t"jd|}t%|dkDru|ddj'd}dt%|dz }t)j*}|j-||dj d|d|dz|j/z}d }t1j|d|S#ttttf$rYwxYw) zReturn a filename suitable for the filesystem and for repo id Strips dangerous and common characters to create a filename we can use to store the cache in. idnazutf-8r*rNzE[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.:-]) RE_SCHEMEmatchr[ryPY3encodedecode isinstancestrunicodeUnicodeDecodeErrorUnicodeEncodeError UnicodeError TypeErrorsubRE_SLASHRE_BEGINRE_FINALlenr:hashlibsha256ri hexdigestre)rparts lastindexcsum allowed_regexs r$rrsp  ??3 zz~~jj(//8c3'**W-44Vrs&''((  oZ377??oZoZd  BJJ. / 2::1 2 2::i  2::i "*r&