Commit 0e2978ef authored by Dominik's avatar Dominik

Mailbox quota can now be included into website quota (FS#3297)

--------------------------------------------------------------
Feature can be activated over admin mailserver settings. when activated websites uid is used instead of standard vmail-uid. this only takes effect if web and mailserver are on the same server, otherwise it will be old behaviour. switching this setting when mailboxes exist doesn't matter. Mailboxfolder will be created with website uid for this. access of postfix and dovecot now works over mysql-table mail_user. virtual_uid_maps is changed from static to mysql-table. for dovecot<->postfix communication protocoll is changed vrom lda to lmtp. disablelmtp-column is added to mail_user-table. uid and gid can be overwritten by remoting.
ONE OPEN ISSUE: since remoting has completly changed and mail_user_add function is missing at the moment, this function now was inclulded again. it is important to add the both new lines to the future function and then remove this new one.
parent d73810d8
ALTER TABLE `mail_user` ADD `disablelmtp` ENUM( 'n', 'y' ) NOT NULL DEFAULT 'n' AFTER `disablelda` ;
\ No newline at end of file
......@@ -884,6 +884,7 @@ CREATE TABLE `mail_user` (
`disablesmtp` enum('n','y') NOT NULL default 'n',
`disablesieve` enum('n','y') NOT NULL default 'n',
`disablelda` enum('n','y') NOT NULL default 'n',
`disablelmtp` enum('n','y') NOT NULL default 'n',
`disabledoveadm` enum('n','y') NOT NULL default 'n',
`last_quota_notification` date NULL default NULL,
`backup_interval` VARCHAR( 255 ) NOT NULL,
......
listen = *,[::]
protocols = imap pop3
protocols = imap pop3 lmtp
auth_mechanisms = plain login
disable_plaintext_auth = no
log_timestamp = "%Y-%m-%d %H:%M:%S "
......@@ -31,6 +31,13 @@ service auth {
}
user = root
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
service imap-login {
client_limit = 1000
process_limit = 500
......@@ -44,4 +51,8 @@ protocol pop3 {
}
protocol lda {
mail_plugins = sieve quota
}
protocol lmtp {
postmaster_address = webmaster@localhost
mail_plugins = quota sieve
}
\ No newline at end of file
listen = *,[::]
protocols = imap pop3
protocols = imap pop3 lmtp
auth_mechanisms = plain login
disable_plaintext_auth = no
log_timestamp = "%Y-%m-%d %H:%M:%S "
......@@ -31,6 +31,13 @@ service auth {
}
user = root
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
service imap-login {
client_limit = 1000
process_limit = 500
......@@ -44,4 +51,8 @@ protocol pop3 {
}
protocol lda {
mail_plugins = sieve quota
}
protocol lmtp {
postmaster_address = webmaster@localhost
mail_plugins = quota sieve
}
\ No newline at end of file
......@@ -5,8 +5,8 @@ virtual_alias_maps = proxy:mysql:{config_dir}/mysql-virtual_forwardings.cf, prox
virtual_mailbox_domains = proxy:mysql:{config_dir}/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:{config_dir}/mysql-virtual_mailboxes.cf
virtual_mailbox_base = {vmail_mailbox_base}
virtual_uid_maps = static:{vmail_userid}
virtual_gid_maps = static:{vmail_groupid}
virtual_uid_maps = mysql:/etc/postfix/mysql-virtual_uids.cf
virtual_gid_maps = mysql:/etc/postfix/mysql-virtual_gids.cf
inet_protocols=all
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
......@@ -25,7 +25,7 @@ smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual
smtpd_client_message_rate_limit = 100
maildrop_destination_concurrency_limit = 1
maildrop_destination_recipient_limit = 1
virtual_transport = maildrop
virtual_transport = lmtp:unix:private/dovecot-lmtp
header_checks = regexp:{config_dir}/header_checks
mime_header_checks = regexp:{config_dir}/mime_header_checks
nested_header_checks = regexp:{config_dir}/nested_header_checks
......
listen = *,[::]
protocols = imap pop3
protocols = imap pop3 lmtp
auth_mechanisms = plain login
disable_plaintext_auth = no
log_timestamp = "%Y-%m-%d %H:%M:%S "
......@@ -31,6 +31,13 @@ service auth {
}
user = root
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
service imap-login {
client_limit = 1000
process_limit = 500
......@@ -44,4 +51,8 @@ protocol pop3 {
}
protocol lda {
mail_plugins = sieve quota
}
protocol lmtp {
postmaster_address = webmaster@localhost
mail_plugins = quota sieve
}
\ No newline at end of file
......@@ -3,8 +3,8 @@ virtual_alias_maps = proxy:mysql:{config_dir}/mysql-virtual_forwardings.cf, prox
virtual_mailbox_domains = proxy:mysql:{config_dir}/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:{config_dir}/mysql-virtual_mailboxes.cf
virtual_mailbox_base = {vmail_mailbox_base}
virtual_uid_maps = static:{vmail_userid}
virtual_gid_maps = static:{vmail_groupid}
virtual_uid_maps = mysql:/etc/postfix/mysql-virtual_uids.cf
virtual_gid_maps = mysql:/etc/postfix/mysql-virtual_gids.cf
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
......@@ -22,7 +22,7 @@ smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual
smtpd_client_message_rate_limit = 100
maildrop_destination_concurrency_limit = 1
maildrop_destination_recipient_limit = 1
virtual_transport = maildrop
virtual_transport = lmtp:unix:private/dovecot-lmtp
header_checks = regexp:{config_dir}/header_checks
mime_header_checks = regexp:{config_dir}/mime_header_checks
nested_header_checks = regexp:{config_dir}/nested_header_checks
......
......@@ -3,8 +3,8 @@ virtual_alias_maps = proxy:mysql:{config_dir}/mysql-virtual_forwardings.cf, prox
virtual_mailbox_domains = proxy:mysql:{config_dir}/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:{config_dir}/mysql-virtual_mailboxes.cf
virtual_mailbox_base = {vmail_mailbox_base}
virtual_uid_maps = static:{vmail_userid}
virtual_gid_maps = static:{vmail_groupid}
virtual_uid_maps = mysql:/etc/postfix/mysql-virtual_uids.cf
virtual_gid_maps = mysql:/etc/postfix/mysql-virtual_gids.cf
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
......@@ -22,7 +22,7 @@ smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual
smtpd_client_message_rate_limit = 100
maildrop_destination_concurrency_limit = 1
maildrop_destination_recipient_limit = 1
virtual_transport = maildrop
virtual_transport = lmtp:unix:private/dovecot-lmtp
header_checks = regexp:{config_dir}/header_checks
mime_header_checks = regexp:{config_dir}/mime_header_checks
nested_header_checks = regexp:{config_dir}/nested_header_checks
......
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_user
select_field = gid
where_field = email
additional_conditions = and postfix = 'y' and server_id = {server_id}
hosts = {mysql_server_ip}
\ No newline at end of file
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_user
select_field = uid
where_field = email
additional_conditions = and postfix = 'y' and server_id = {server_id}
hosts = {mysql_server_ip}
listen = *,[::]
protocols = imap pop3
protocols = imap pop3 lmtp
auth_mechanisms = plain login
disable_plaintext_auth = no
log_timestamp = "%Y-%m-%d %H:%M:%S "
......@@ -31,6 +31,13 @@ service auth {
}
user = root
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
service imap-login {
client_limit = 1000
process_limit = 500
......@@ -44,4 +51,8 @@ protocol pop3 {
}
protocol lda {
mail_plugins = sieve quota
}
protocol lmtp {
postmaster_address = webmaster@localhost
mail_plugins = quota sieve
}
\ No newline at end of file
......@@ -3,8 +3,8 @@ virtual_alias_maps = proxy:mysql:{config_dir}/mysql-virtual_forwardings.cf, prox
virtual_mailbox_domains = proxy:mysql:{config_dir}/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:{config_dir}/mysql-virtual_mailboxes.cf
virtual_mailbox_base = {vmail_mailbox_base}
virtual_uid_maps = static:{vmail_userid}
virtual_gid_maps = static:{vmail_groupid}
virtual_uid_maps = mysql:/etc/postfix/mysql-virtual_uids.cf
virtual_gid_maps = mysql:/etc/postfix/mysql-virtual_gids.cf
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
......@@ -22,7 +22,7 @@ smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual
smtpd_client_message_rate_limit = 100
maildrop_destination_concurrency_limit = 1
maildrop_destination_recipient_limit = 1
virtual_transport = maildrop
virtual_transport = lmtp:unix:private/dovecot-lmtp
header_checks = regexp:{config_dir}/header_checks
mime_header_checks = regexp:{config_dir}/mime_header_checks
nested_header_checks = regexp:{config_dir}/nested_header_checks
......
......@@ -38,6 +38,7 @@ mailuser_uid=5000
mailuser_gid=5000
mailuser_name=vmail
mailuser_group=vmail
mailbox_virtual_uidgid_maps=n
relayhost=
relayhost_user=
relayhost_password=
......
......@@ -184,7 +184,31 @@ class remoting {
return $app->db->affectedRows() == 1;
}
//* Add mail domain
public function mail_user_add($session_id, $client_id, $params){
global $app;
if (!$this->checkPerm($session_id, 'mail_user_add')){
$this->server->fault('permission_denied','You do not have the permissions to access this function.');
return false;
}
//* Check if mail domain exists
$email_parts = explode('@',$params['email']);
$tmp = $app->db->queryOneRecord("SELECT domain FROM mail_domain WHERE domain = '".$app->db->quote($email_parts[1])."'");
if($tmp['domain'] != $email_parts[1]) {
$this->server->fault('mail_domain_does_not_exist','Mail domain - '.$email_parts[1].' - does not exist.');
return false;
}
//* Set a few params to non empty values that will be overwritten by mail_plugin
if (!isset($params['uid'])) $params['uid'] = 999989999;
if (!isset($params['gid'])) $params['gid'] = 999989999;
$affected_rows = $this->insertQuery('../mail/form/mail_user.tform.php', $client_id, $params);
return $affected_rows;
}
//** protected functions -----------------------------------------------------------------------------------
......
......@@ -24,6 +24,7 @@ $wb['mailuser_uid_txt'] = 'Mailuser UID';
$wb['mailuser_gid_txt'] = 'Mailuser GID';
$wb['mailuser_name_txt'] = 'Mailuser Name';
$wb['mailuser_group_txt'] = 'Mailuser Group';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Relayhost User';
$wb['relayhost_password_txt'] = 'Relayhost Password';
......
......@@ -22,6 +22,7 @@ $wb['mailuser_uid_txt'] = 'Mailuser UID';
$wb['mailuser_gid_txt'] = 'Mailuser GID';
$wb['mailuser_name_txt'] = 'Mailuser Name';
$wb['mailuser_group_txt'] = 'Mailuser Group';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Relayhost User';
$wb['relayhost_password_txt'] = 'Relayhost Password';
......
......@@ -23,6 +23,7 @@ $wb['mailuser_uid_txt'] = 'UID usuário de email';
$wb['mailuser_gid_txt'] = 'GID usuário de email';
$wb['mailuser_name_txt'] = 'Nome usuário de email';
$wb['mailuser_group_txt'] = 'Grupo usuário de email';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Host Relay';
$wb['relayhost_user_txt'] = 'Usuário do Host Relay';
$wb['relayhost_password_txt'] = 'Senha do Host Relay';
......
......@@ -24,6 +24,7 @@ $wb['mailuser_uid_txt'] = 'Mail uživatel UID';
$wb['mailuser_gid_txt'] = 'Mail uživatel GID';
$wb['mailuser_name_txt'] = 'Mail uživatel jméno';
$wb['mailuser_group_txt'] = 'Mail uživatel skupina';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Relayhost uživatel';
$wb['relayhost_password_txt'] = 'Relayhost heslo';
......
......@@ -25,6 +25,7 @@ $wb['mailuser_uid_txt'] = 'Mailbenutzer UID';
$wb['mailuser_gid_txt'] = 'Mailbenutzer GID';
$wb['mailuser_name_txt'] = 'Mailbenutzer Name';
$wb['mailuser_group_txt'] = 'Mailbenutzer Gruppe';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Website Linux Uid für Mailboxen (nur wenn beides auf gleichem Server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Relayhost Benutzer';
$wb['relayhost_password_txt'] = 'Relayhost Passwort';
......
......@@ -24,6 +24,7 @@ $wb['mailuser_uid_txt'] = 'Mailuser UID';
$wb['mailuser_gid_txt'] = 'Mailuser GID';
$wb['mailuser_name_txt'] = 'Όνομα Mailuser';
$wb['mailuser_group_txt'] = 'Ομάδα Mailuser';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Χρήστης Relayhost';
$wb['relayhost_password_txt'] = 'Συνθηματικό Relayhost';
......
......@@ -36,6 +36,7 @@ $wb["mailuser_uid_txt"] = 'Mailuser UID';
$wb["mailuser_gid_txt"] = 'Mailuser GID';
$wb["mailuser_name_txt"] = 'Mailuser Name';
$wb["mailuser_group_txt"] = 'Mailuser Group';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb["relayhost_txt"] = 'Relayhost';
$wb["relayhost_user_txt"] = 'Relayhost User';
$wb["relayhost_password_txt"] = 'Relayhost Password';
......
......@@ -22,6 +22,7 @@ $wb['mailuser_uid_txt'] = 'UID usuario de correo';
$wb['mailuser_gid_txt'] = 'GID usuario de correo';
$wb['mailuser_name_txt'] = 'Nombre del usuario de correo';
$wb['mailuser_group_txt'] = 'Grupo del usuario de correo';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Servidor de retransmisión';
$wb['relayhost_user_txt'] = 'Usuario de retransmisión';
$wb['relayhost_password_txt'] = 'Contraseña de retramisión';
......
......@@ -22,6 +22,7 @@ $wb['mailuser_uid_txt'] = 'Käyttäjätunnus';
$wb['mailuser_gid_txt'] = 'Käyttäjäryhmä';
$wb['mailuser_name_txt'] = 'Postikäyttäjän nimi';
$wb['mailuser_group_txt'] = 'Postikäyttäjän ryhmä';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Edelleenlähetyspalvelin';
$wb['relayhost_user_txt'] = 'Edelleenlähetyspalvelimen käyttäjätunnus';
$wb['relayhost_password_txt'] = 'Edelleenlähetyspalvelimen salasana';
......
......@@ -24,6 +24,7 @@ $wb['mailuser_uid_txt'] = 'UID de l\'utilisateur mail';
$wb['mailuser_gid_txt'] = 'GID de l\'utilisateur mail';
$wb['mailuser_name_txt'] = 'Nom d\'utilisateur mail';
$wb['mailuser_group_txt'] = 'Groupe de l\'utilisateur mail';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Hôte de relais';
$wb['relayhost_user_txt'] = 'Utilisateur du relais';
$wb['relayhost_password_txt'] = 'Mot de passe du relais';
......
......@@ -23,6 +23,7 @@ $wb['mailuser_uid_txt'] = 'Mailuser UID';
$wb['mailuser_gid_txt'] = 'Mailuser GID';
$wb['mailuser_name_txt'] = 'Mailuser ime';
$wb['mailuser_group_txt'] = 'Mailuser grupa';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Relayhost korisnik';
$wb['relayhost_password_txt'] = 'Relayhost šifra';
......
......@@ -22,6 +22,7 @@ $wb['mailuser_uid_txt'] = 'Mailuser UID';
$wb['mailuser_gid_txt'] = 'Mailuser GID';
$wb['mailuser_name_txt'] = 'Mailuser Name';
$wb['mailuser_group_txt'] = 'Mailuser Group';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Relayhost User';
$wb['relayhost_password_txt'] = 'Relayhost Password';
......
......@@ -24,6 +24,7 @@ $wb['mailuser_uid_txt'] = 'UID Pengguna Mail';
$wb['mailuser_gid_txt'] = 'GID Pengguna Mail';
$wb['mailuser_name_txt'] = 'Nama Pengguna Mail';
$wb['mailuser_group_txt'] = 'Grup Pengguna Mail';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Pengguna Relayhost';
$wb['relayhost_password_txt'] = 'Kata Sandi Relayhost';
......
......@@ -21,6 +21,7 @@ $wb['mailuser_uid_txt'] = 'Mailuser UID';
$wb['mailuser_gid_txt'] = 'Mailuser GID';
$wb['mailuser_name_txt'] = 'Mailuser Name';
$wb['mailuser_group_txt'] = 'Mailuser Group';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Relayhost User';
$wb['relayhost_password_txt'] = 'Relayhost Password';
......
......@@ -24,6 +24,7 @@ $wb['mailuser_uid_txt'] = 'メールユーザーのUID';
$wb['mailuser_gid_txt'] = 'メールユーザーのGID';
$wb['mailuser_name_txt'] = 'メールユーザー名';
$wb['mailuser_group_txt'] = 'メールユーザーグループ';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'リレーホスト';
$wb['relayhost_user_txt'] = 'リレーホストユーザー';
$wb['relayhost_password_txt'] = 'リレーホストパスワード';
......
......@@ -24,6 +24,7 @@ $wb['mailuser_uid_txt'] = 'Mailuser UID';
$wb['mailuser_gid_txt'] = 'Mailuser GID';
$wb['mailuser_name_txt'] = 'Mailuser name';
$wb['mailuser_group_txt'] = 'Mailuser groep';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Relayhost gebruiker';
$wb['relayhost_password_txt'] = 'Relayhost wachtwoord';
......
......@@ -24,6 +24,7 @@ $wb['mailuser_uid_txt'] = 'UID użytkownika e-mail';
$wb['mailuser_gid_txt'] = 'GID użytkownika e-mail';
$wb['mailuser_name_txt'] = 'Nazwa użytkownika e-mail';
$wb['mailuser_group_txt'] = 'Grupa użytkownika e-mail';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Adres Relayhost';
$wb['relayhost_user_txt'] = 'Użytkownik Relayhost';
$wb['relayhost_password_txt'] = 'Hasło Relayhost';
......
......@@ -23,6 +23,7 @@ $wb['mailuser_uid_txt'] = 'UID utilizador de email';
$wb['mailuser_gid_txt'] = 'GID utilizador de email';
$wb['mailuser_name_txt'] = 'Nome utilizador de email';
$wb['mailuser_group_txt'] = 'Grupo utilizador de email';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Host Relay';
$wb['relayhost_user_txt'] = 'Utilizador do Host Relay';
$wb['relayhost_password_txt'] = 'Senha do Host Relay';
......
......@@ -23,6 +23,7 @@ $wb['mailuser_uid_txt'] = 'Mailuser UID';
$wb['mailuser_gid_txt'] = 'Mailuser GID';
$wb['mailuser_name_txt'] = 'Mailuser Name';
$wb['mailuser_group_txt'] = 'Mailuser Group';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Relayhost User';
$wb['relayhost_password_txt'] = 'Relayhost Password';
......
......@@ -21,6 +21,7 @@ $wb['mailuser_uid_txt'] = 'Mailuser UID';
$wb['mailuser_gid_txt'] = 'Mailuser GID';
$wb['mailuser_name_txt'] = 'Имя Mailuser';
$wb['mailuser_group_txt'] = 'Группа Mailuser';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Relay-хост';
$wb['relayhost_user_txt'] = 'Логин Relay-хоста';
$wb['relayhost_password_txt'] = 'Пароль Relay-хоста';
......
......@@ -22,6 +22,7 @@ $wb['mailuser_uid_txt'] = 'Mailuser UID';
$wb['mailuser_gid_txt'] = 'Mailuser GID';
$wb['mailuser_name_txt'] = 'Mailuser Name';
$wb['mailuser_group_txt'] = 'Mailuser Group';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Relayhost User';
$wb['relayhost_password_txt'] = 'Relayhost Password';
......
......@@ -24,6 +24,7 @@ $wb['mailuser_uid_txt'] = 'Mailuser UID';
$wb['mailuser_gid_txt'] = 'Mailuser GID';
$wb['mailuser_name_txt'] = 'Mailuser Meno';
$wb['mailuser_group_txt'] = 'Mailuser Skupina';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Relayhost uživateľ';
$wb['relayhost_password_txt'] = 'Relayhost heslo';
......
......@@ -24,6 +24,7 @@ $wb['mailuser_uid_txt'] = 'Mail kullanıcısı UID';
$wb['mailuser_gid_txt'] = 'Mail kullanıcısı GID';
$wb['mailuser_name_txt'] = 'Mail kullanıcısı Adı';
$wb['mailuser_group_txt'] = 'Mail kullanıcısı Grubu';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Relayhost Kullanıcı';
$wb['relayhost_password_txt'] = 'Relayhost Şifre';
......
......@@ -55,6 +55,12 @@
<label for="mailuser_group">{tmpl_var name='mailuser_group_txt'}</label>
<input name="mailuser_group" id="mailuser_group" value="{tmpl_var name='mailuser_group'}" size="10" maxlength="255" type="text" class="textInput formLengthHalf" />
</div>
<div class="ctrlHolder">
<p class="label">{tmpl_var name='mailbox_virtual_uidgid_maps_txt'}</p>
<div class="multiField">
{tmpl_var name='mailbox_virtual_uidgid_maps'}
</div>
</div>
<div class="ctrlHolder">
<label for="relayhost">{tmpl_var name='relayhost_txt'}</label>
<input name="relayhost" id="relayhost" value="{tmpl_var name='relayhost'}" size="40" maxlength="255" type="text" class="textInput formLengthHalf" />
......
......@@ -203,9 +203,11 @@ class page_action extends tform_actions {
$maildir = str_replace("[localpart]", strtolower($_POST["email_local_part"]), $maildir);
$this->dataRecord["maildir"] = $maildir;
$this->dataRecord["homedir"] = $mail_config["homedir_path"];
$this->dataRecord["uid"] = $mail_config["mailuser_uid"];
$this->dataRecord["gid"] = $mail_config["mailuser_gid"];
// Will be overwritten by mail_plugin
$this->dataRecord['uid'] = 999989999;
$this->dataRecord['gid'] = 999989999;
//* Check if there is no alias or forward with this address
$tmp = $app->db->queryOneRecord("SELECT count(forwarding_id) as number FROM mail_forwarding WHERE active = 'y' AND source = '".$app->db->quote($this->dataRecord["email"])."'");
if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("duplicate_alias_or_forward_txt")."<br>";
......
......@@ -51,6 +51,12 @@
<label for="mailuser_group">{tmpl_var name='mailuser_group_txt'}</label>
<input name="mailuser_group" id="mailuser_group" value="{tmpl_var name='mailuser_group'}" size="10" maxlength="255" type="text" class="textInput formLengthHalf" />
</div>
<div class="ctrlHolder">
<p class="label">{tmpl_var name='mailbox_virtual_uidgid_maps_txt'}</p>
<div class="multiField">
{tmpl_var name='mailbox_virtual_uidgid_maps'}
</div>
</div>
<div class="ctrlHolder">
<label for="relayhost">{tmpl_var name='relayhost_txt'}</label>
<input name="relayhost" id="relayhost" value="{tmpl_var name='relayhost'}" size="40" maxlength="255" type="text" class="textInput formLengthHalf" />
......
......@@ -33,6 +33,12 @@
<label for="mailuser_group" class="wf_preField">{tmpl_var name='mailuser_group_txt'}</label>
<input type="text" id="mailuser_group" name="mailuser_group" value="{tmpl_var name='mailuser_group'}" size="10" maxlength="255">
</span>
<div class="ctrlHolder">
<p class="label">{tmpl_var name='mailbox_virtual_uidgid_maps_txt'}</p>
<div class="multiField">
{tmpl_var name='mailbox_virtual_uidgid_maps'}
</div>
</div>
<span class="wf_oneField">
<label for="relayhost" class="wf_preField">{tmpl_var name='relayhost_txt'}</label>
<input type="text" id="relayhost" name="relayhost" value="{tmpl_var name='relayhost'}" size="40" maxlength="255">
......
......@@ -605,6 +605,30 @@ class system{
/**
* Get the user from an user id
*
*/
function getuser($uid){
global $app;
$user_datei = $this->server_conf['passwd_datei'];
$users = $app->file->no_comments($user_datei);
$lines = explode("\n", $users);
if(is_array($lines)){
foreach($lines as $line){
if(trim($line) != ''){
list($f1, $f2, $f3,) = explode(':', $line);
if($f3 == $uid) return $f1;
}
}
}
return false;
}
/**
* Get the user id from an user
*
......@@ -632,6 +656,30 @@ class system{
/**
* Get the group from a group id
*
*/
function getgroup($gid){
global $app;
$group_datei = $this->server_conf['group_datei'];
$groups = $app->file->no_comments($group_datei);
$lines = explode("\n", $groups);
if(is_array($lines)){
foreach($lines as $line){
if(trim($line) != ""){
list($f1, $f2, $f3, $f4) = explode(':', $line);
if($f3 == $gid) return $f1;
}
}
}
return false;
}
/**
* Get the group id from an group
*
......@@ -1476,7 +1524,7 @@ class system{
}
}
function maildirmake($maildir_path, $user = '', $subfolder = '') {
function maildirmake($maildir_path, $user = '', $group = '', $subfolder = '') {
global $app;
......@@ -1490,22 +1538,24 @@ class system{
if($user != '' && $user != 'root' && $this->is_user($user)) {
$user = escapeshellcmd($user);
// I assume that the name of the (vmail group) is the same as the name of the mail user in ISPConfig 3
$group = $user;
if(is_dir($dir)) $this->chown($dir, $user);
if(is_dir($dir)) $this->chgrp($dir, $group);
$chown_mdsub = true;
}
if($group != '' && $group != 'root' && $this->is_group($group)) {
$group = escapeshellcmd($group);
if(is_dir($dir)) $this->chgrp($dir, $group);
$chgrp_mdsub = true;
}
$maildirsubs = array('cur', 'new', 'tmp');
foreach ($maildirsubs as $mdsub) {
if(!is_dir($dir.'/'.$mdsub)) mkdir($dir.'/'.$mdsub, 0700, true);
if ($chown_mdsub) {