예제 #1
0
    if (isset($cmdParameters['ns']) && is_array($cmdParameters['ns'])) {
        $ns = $cmdParameters['ns'];
    } elseif (isset($cmdParameters['ns'])) {
        $ns = array($cmdParameters['ns']);
    } else {
        $ns = array();
    }
    // Set parameters - mail exchange server(s)
    if (isset($cmdParameters['mx']) && is_array($cmdParameters['mx'])) {
        $mx = $cmdParameters['mx'];
    } elseif (isset($cmdParameters['mx'])) {
        $mx = array($cmdParameters['mx']);
    } else {
        $mx = array();
    }
    $rc = $vhost->addParkedDomain($cmdParameters['add-pdomain'], $ns, $mx);
    if ($rc === false) {
        Log::error('Error while adding new parked domain');
        exit(9);
    }
} elseif (isset($cmdParameters['remove-pdomain'])) {
    $rc = $vhost->removeParkedDomain($cmdParameters['remove-pdomain']);
    if ($rc === false) {
        Log::error('Error while removing parked domain');
        exit(9);
    }
} else {
    Log::error('Parameter error');
    exit(9);
}
exit;
예제 #2
0
    exit(9);
}
// Convert passwd to use the new uid/gid
$rc = convertPasswd($vhost->home . '/' . $vhost->unixName . '/etc/' . $vhost->domainName . '/passwd', $uid, $gid);
if ($rc === false) {
    Log::error('Error while converting passwd format');
    exit(9);
}
// Set ownership for passwd and shadow
touch($vhost->home . '/' . $vhost->unixName . '/etc/' . $vhost->domainName . '/passwd');
chgrp($vhost->home . '/' . $vhost->unixName . '/etc/' . $vhost->domainName . '/passwd', 'dovecot');
touch($vhost->home . '/' . $vhost->unixName . '/etc/' . $vhost->domainName . '/shadow');
chgrp($vhost->home . '/' . $vhost->unixName . '/etc/' . $vhost->domainName . '/shadow', 'dovecot');
// Create parked domains and insert to database
foreach ($parkedDomains as $p) {
    $rc = $vhost->addParkedDomain($p);
    if ($rc === false) {
        Log::error('Error while adding new parked domain');
        exit(9);
    }
}
// Install forwarders
foreach ($forwarders as $d => $f) {
    installForwarder($vhost, $d, $f);
}
// Run restorecon to make sure all SELinux contexts are correct
exec('/usr/sbin/restorecon -r ' . escapeshellarg($vhost->home));
// Access rights - needs to be reset because it is overwritten during the untar procedure
chmod($vhost->home . '/' . $vhost->unixName . '/etc', 0751);
// Install cron
if ($cron != '') {