Skip to content

Commit

Permalink
Probably fix quotas and SASL
Browse files Browse the repository at this point in the history
  • Loading branch information
swelljoe committed Aug 23, 2017
1 parent 59c0795 commit 6f18282
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
10 changes: 6 additions & 4 deletions lib/Virtualmin/Config/Plugin/Quotas.pm
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,16 @@ sub actions {
"You may need to reboot your system, and/or enable quotas in the Disk\n";
print "Quotas module.";
print " " x 65;
$res = 0;
$res = 2;
}
else {
# Activate quotas
foreign_require("quota", "quota-lib.pl");
quota::quotaon($dir, 3);
$self->logsystem("modprobe quota_v2");
$self->logsystem("quotacheck -vgum $dir");
$self->logsystem("quotaon -av");
$res = 1;
}
$self->done($res); # OK!
$self->done($res); # Maybe OK!
};
if ($@) {
$ENV{'QUOTA_FAILED'} = '1';
Expand Down
21 changes: 19 additions & 2 deletions lib/Virtualmin/Config/Plugin/SASL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ sub actions {
if ( $gconfig{'os_type'} eq "debian-linux"
or $gconfig{'os_type'} eq "ubuntu-linux")
{
# Update saslauthd default to run inside postfix chroot
my $fn = "/etc/default/saslauthd";
my $sasldefault = read_file_lines($fn) or die "Failed to open $fn!";
my $idx = indexof("# START=yes", @$sasldefault);
Expand All @@ -51,8 +52,24 @@ sub actions {
if ($idx >= 0) {
$sasldefault->[$idx] = "START=yes";
}
push(@$sasldefault,
"PARAMS=\"-m /var/spool/postfix/var/run/saslauthd -r\"");
# Substitute options and params if already in file
foreach my $l (@$sasldefault) {
if ($l =~ /OPTIONS/) {
$l = 'OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd"';
}
if ($l =~ /PARAMS/) {
$l = 'PARAMS="-m /var/spool/postfix/var/run/saslauthd -r"';
}
}
# Add them, if not
if ( ! grep {/OPTIONS/} @$sasldefault ) {
push(@$sasldefault,
'OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd"');
}
if ( ! grep {/PARAMS/} @$sasldefault ) {
push(@$sasldefault,
'PARAMS="-m /var/spool/postfix/var/run/saslauthd -r"');
}
flush_file_lines($fn);
$cf = "/etc/postfix/sasl/smtpd.conf";
$self->logsystem("mkdir -p -m 755 /var/spool/postfix/var/run/saslauthd");
Expand Down

0 comments on commit 6f18282

Please sign in to comment.