00000002
  :   ˆl–Ãa¾”êeJq@?q±\jbÑ¿È„Í…Ïa–Ãa¾”*j"Tâ€fà�pS�ÿË ?÷     #!/usr/local/cpanel/3rdparty/bin/perl

#                                      Copyright 2025 WebPros International, LLC
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited.

package scripts::suspendacct;

use strict;
## no critic qw(TestingAndDebugging::RequireUseWarnings) -- suspendacct is not yet warnings safe

use Try::Tiny;

use Whostmgr::ACLS                             ();
use Cpanel::Auth::Digest::DB::Manage           ();
use Cpanel::Auth::Shadow                       ();
use Cpanel::AcctUtils::AccountingLog           ();
use Cpanel::AcctUtils::DomainOwner::Tiny       ();
use Cpanel::AcctUtils::Owner                   ();
use Cpanel::AcctUtils::Domain                  ();
use Cpanel::Config::LoadCpUserFile             ();
use Cpanel::PwCache::Clear                     ();
use Cpanel::Validate::Domain::Tiny             ();
use Cpanel::Encoder::Tiny                      ();
use Cpanel::Exception                          ();
use Cpanel::Dovecot::Action                    ();
use Cpanel::AccessIds::ReducedPrivileges       ();
use Cpanel::AcctUtils::Suspended               ();
use Cpanel::SafetyBits                         ();
use Cpanel::Config::CpUserGuard                ();
use Cpanel::ConfigFiles                        ();
use Cpanel::FileUtils::Copy                    ();
use Cpanel::FileUtils::Match                   ();
use Cpanel::FileUtils::Write                   ();
use Cpanel::Hooks                              ();
use Cpanel::Hostname                           ();
use Cpanel::IP::Remote                         ();
use Cpanel::MysqlUtils::Suspension             ();
use Cpanel::SafeFile                           ();
use Cpanel::Sys::Kill                          ();
use Cpanel::OS                                 ();
use Cpanel::Passwd::Shell                      ();
use Cpanel::ServerTasks                        ();
use Cpanel::Services::Enabled                  ();
use Cpanel::Session::SinglePurge               ();
use Cpanel::PwCache                            ();
use Cpanel::Validate::Username                 ();
use Cpanel::Validate::Domain::Normalize        ();
use Cpanel::Quota::Temp                        ();
use Whostmgr::Accounts::Suspend                ();
use Whostmgr::Accounts::Email                  ();
use Whostmgr::Accounts::SuspensionData::Writer ();
use AcctLock                                   ();
use Cpanel::Notify                             ();
use Getopt::Long                               ();
use Cpanel::Team::Constants                    ();
use Cpanel::Team::Config                       ();

exit( run(@ARGV) ) unless caller;

sub run {    ## no critic qw(Subroutines::ProhibitExcessComplexity)
    my (@args) = @_;

    my $leave_ftp_enabled = 0;
    my $usage             = 0;
    my $force             = 0;
    my $child_ok          = 0;
    return usage(1) if !@args;

    Getopt::Long::GetOptionsFromArray(
        \@args,
        'leave-ftp-accts-enabled' => \$leave_ftp_enabled,
        'help|usage'              => \$usage,
        'force'                   => \$force,
        'child-ok'                => \$child_ok,
    );

    my $user = $args[0];
    $user =~ s/\///g;
    my $reason = Cpanel::Encoder::Tiny::safe_html_decode_str( $args[1] // '' );
    $reason =~ s/[=\n\0]//g;
    my $prevent_reseller_unsuspend = $args[2] // 0;

    return usage(0) if $usage;
    return usage(1) if ( !$user || is_forbidden_user($user) );

    local $ENV{'USER'}        = $ENV{'USER'};
    local $ENV{'REMOTE_USER'} = $ENV{'REMOTE_USER'};

    if ( ( !$ENV{'USER'} || !$ENV{'REMOTE_USER'} ) && $> == 0 ) {
        $ENV{'REMOTE_USER'} = 'root';
        $ENV{'USER'}        = 'root';
    }

    # Needed for changing quotas.
    Whostmgr::ACLS::init_acls();

    return usage( 1, "Invalid user $user\n" ) if !is_valid_user($user);

    if 