�&ǐk�@'bJ�h�ۊL'}T� :��'2�Z#$��n�a��� �>a��`��_3d�Qpt�/�P -��#5�,�M��� �pA:©�q�����NW��ډ�A���� �9nʺج���� �TSM��{J6?7��r�@�\����D��� �׶���s�f�TJj?"��D��`?��̒� b�#�%�C*v�$�{�$����5Ծ�F�s��y�e/8��h-�f�̰&(����Gj�L:U� 2�� ����v�_k����Y��gp,�k�WF�R������_C�R��N@���R�@�ߔ?A�w9���F("iNa-S���Q�o�3tDMLh*�#4k�T/iQ��Y*�G��m����)��8�hBm/�I�,g�ﯖ���Z��}�Cz�q@´��d.����L�ŕ�,��1�Z�܌�: ̪���F+J-'��c�tvJ8��]Q-��b��y �6;*J`r_�d ��'�G ~p��)'�C,�%F��E(��2�k�����lР�z�!�=t ��_�0��f7��� ;�p�|�U �%script(@ARGV) unless caller(); sub script { my ( $class, @args ) = @_; my $force = 0; my $leave_broken = 0; my $now = time(); Cpanel::Usage::wrap_options( \@args, \&usage, { 'force' => \$force, 'leave-broken' => \$leave_broken } ); my $cpconf_ref = Cpanel::Config::LoadCpConf::loadcpconf(); if ( $> != 0 ) { die "Insufficient permissions to rebuild dovecot.conf"; } my $dovecot_conf = Cpanel::AdvConfig::dovecot::utils::find_dovecot_conf(); my $test_dovecot_conf = Cpanel::Rand::get_tmp_file_by_name($dovecot_conf); die 'Failed to get a temporary working file!' if ( $test_dovecot_conf eq '/dev/null' ); chmod( $CONF_PERMS, $test_dovecot_conf ) or die "Could not set permissions on $test_dovecot_conf: $!"; # make sure the local template is valid _check_local_template() if !$leave_broken; my $values_to_change = _generate_config_and_check_syntax( $force, $test_dovecot_conf, $dovecot_conf, $leave_broken ); # If dovecot complained certain values are too low, we need to adjust them if ( scalar keys %$values_to_change ) { _generate_config_and_check_syntax( $force, $test_dovecot_conf, $dovecot_conf, $leave_broken, $values_to_change ); } # This will be cached, so there's no big hit my $conf_hr = Cpanel::AdvConfig::dovecot::get_config(); if ( $conf_hr->{'protocols'} =~ /imap(\s|$)/ ) { unlink '/var/cpanel/imap_tcp_check_disabled' if ( -e '/var/cpanel/imap_tcp_check_disabled' ); } else { Cpanel::FileUtils::TouchFile::touchfile('/var/cpanel/imap_tcp_check_disabled') unless ( -e '/var/cpanel/imap_tcp_check_disabled' ); } _setup_dovecot_dirs(); _setup_sqlite_dbs(); Cpanel::AdvConfig::dovecot::process_config_changes($conf_hr); rename $test_dovecot_conf, $dovecot_conf or do { warn "Failed to install $dovecot_conf: $!"; }; unlink $dovecot_conf . '.datastore'; # Just in case _build_includes(); return 1; } sub _build_includes { for my $include ( 'dovecotSSL', 'dovecotSNI' ) { try { my $module = "Cpanel::AdvConfig::$include"; Cpanel::LoadModule::load_perl_module($module); $module->new()->rebuild_conf(); } catch { warn "The system failed to rebuild Dovecot’s $include configuration file:\n$_"; }; } return 1; } sub _generate_config_and_check_syntax { my ( $force, $test_dovecot_conf, $dovecot_conf, $leave_broken, $values_to_change ) = @_; my $config_opts_hr = { 'service' => 'dovecot', 'force' => $force, '_target_conf_file' => $test_dovecot_conf }; if ( $values_to_change and ref $values_to_change eq 'HASH' ) { $config_opts_hr->{'values_to_change'} = $values_to_change; } my ( $returnval, $message ) = Cpanel::AdvConfig::generate_config_file($config_opts_hr); if ( !$returnval ) { print "Failed to build $dovecot_conf\n$message\n"; unlink $test_dovecot_conf; exit 1; } ( $returnval, $message, my $new_values_to_change ) = Cpanel::AdvConfig::dovecot::check_syntax($test_dovecot_conf); if ( !$returnval ) { print <<"EOM"; Configuration generation failed with the following message: $message EOM unless ($force) { unlink $test_dovecot_conf unless ($leave_broken); exit 1; } } return $new_values_to_change; } sub usage { print <