0
     +ˆ¾Æƒ ÷ÀÈ Ø    +#!/usr/local/cpanel/3rdparty/bin/perl

# cpanel - scripts/restorecpuserfromcache          Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

use Cpanel::FileUtils::Copy     ();
use Cpanel::Rand                ();
use Cpanel::Config::CpUserGuard ();

$| = 1;

my $user = $ARGV[0];
if ( !$user ) {
    print "Enter the user to restore from /var/cpanel/users.cache to /var/cpanel/users? ";
    $user = <STDIN>;
}
chomp($user);
$user =~ s/\///g;
if ( !-e '/var/cpanel/users.cache/' . $user ) {
    print "Sorry, $user file does not exist in /var/cpanel/users.cache\n";
    exit 1;
}
if ( -e '/var/cpanel/users/' . $user ) {
    print "Sorry, $user file does already exists in /var/cpanel/users, please move it away first.\n";
    exit 1;
}

my $tmpfile  = Cpanel::Rand::get_tmp_file_by_name( '/var/cpanel/users.cache/' . $user, undef, $Cpanel::Rand::TYPE_FILE, $Cpanel::Rand::SKIP_OPEN );    # audit case 46806 ok
my @PATH     = split( /\//, $tmpfile );
my $basefile = pop(@PATH);

Cpanel::FileUtils::Copy::safecopy( '/var/cpanel/users.cache/' . $user, $tmpfile );
open( my $rf, '>', '/var/cpanel/users/' . $basefile );
print {$rf} "#dummy file\n";
close($rf);
chmod( 0640, '/var/cpanel/users/' . $basefile );
utime 0, 0, '/var/cpanel/users/' . $basefile;

print "Trying to load cache file....";
my $cpuser_guard = Cpanel::Config::CpUserGuard->new($user);
if ( !$cpuser_guard || !$cpuser_guard->{'data'} ) {
    print "Failed to load cpusers file for user: $user.\n";
    unlink($tmpfile);
    exit 1;
}
print "Loaded OK!\n";
$cpuser_guard->save();

chmod( 0640, '/var/cpanel/users/' . $user );
system( 'chown', '0:' . $user, '/var/cpanel/users/' . $user );
unlink( '/var/cpanel/users/' . $basefile );
unlink($tmpfile);

print "$user file restored to /var/cpanel/users/$user\n\n";
exit 0;
     -�ÊÀÈ      -File not found.
  9   /ˆl–äY>”ªC]Ši@¿pA¸ÛJbÑ¿ÇƒpN‡a–Ým_J*j"Tâ€ÆÅq¶”Å£Ê     /§
   Ó
H‚±ÅKã                   ó`   — 	 d dl Z d dlZd dlZd dlZg d¢Zi Zd„ Zd	d„Zd	d„Zd	d„Z	d	d„Z
d„ ZdS )
é    N)ÚgetlineÚ
clearcacheÚ
checkcacheÚ	lazycachec                  ó:   — 	 t                                ¦   «          d S ©N)ÚcacheÚclear© ó    ú0/opt/alt/python311/lib64/python3.11/linecache.pyr   r      s   € Ø#Ý	‡K‚K�M„M€M€M€Mr   c                 óx   — 	 t          | |¦  «        }d|cxk    rt          |¦  «        k    rn n||dz
           S dS )Né   Ú )ÚgetlinesÚlen)ÚfilenameÚlinenoÚmodule_globalsÚliness       r   r   r      sU   € ðNõ �X˜~Ñ.Ô.€EØˆFÐ Ð Ò Ð •c˜%‘j”jÒ Ð Ð Ð Ð Ø�V˜a‘ZÔ Ð Øˆ2r   c                 óÞ   — 	 | t           v r3t           |          }t          |¦  «        dk    rt           |          d         S 	 t          | |¦  «        S # t          $ r t	          ¦   «          g cY S w xY w)Nr   é   )r	   r   ÚupdatecacheÚMemoryErrorr   )r   r   Úentrys      r   r   r   $   s~   € ðNð •5ÐÐÝ�h”ˆÝˆu‰:Œ:˜Š?ˆ?Ý˜”? 1Ô%Ð%ðÝ˜8 ^Ñ4Ô4Ð4øÝð ð ð Ý‰ŒˆØˆ	ˆ	ˆ	ðøøøs   ¿A ÁA,Á+A,c                 ó¼  — 	 | €'t          t                               ¦   «         ¦  «        }n| t          v r| g}nd S |D ]Ÿ} t          |          }t          |¦  «        dk    rŒ#|\  }}}}|€Œ-	 t	          j        |¦  «        }n+# t          $ r t                               | d ¦  «         Y Œjw xY w||j        k    s||j	        k    rt                               | d ¦  «         Œ d S )Nr   )
Úlistr	   Úkeysr   ÚosÚstatÚOSErrorÚpopÚst_sizeÚst_mtime)r   Ú	filenamesr   ÚsizeÚmtimer   Úfullnamer    s           r   r   r   4   s  € ð-ð ÐÝ�Ÿš™œÑ&Ô&ˆ	ˆ	Ø	•UÐ	Ð	Ø�Jˆ	ˆ	àˆà