Merge pull request #383 from mailcow/dev

Dev
master
André Peters 2017-06-21 23:27:26 +02:00 committed by GitHub
commit 98e77fe791
2 changed files with 50 additions and 36 deletions

View File

@ -315,10 +315,42 @@ function mailbox($_action, $_type, $_data = null) {
); );
return false; return false;
} }
foreach ($gotos as &$goto) {
if (empty($goto)) {
continue;
}
$goto_domain = idn_to_ascii(substr(strstr($goto, '@'), 1));
$goto_local_part = strstr($goto, '@', true);
$goto = $goto_local_part.'@'.$goto_domain;
$stmt = $pdo->prepare("SELECT `username` FROM `mailbox`
WHERE `kind` REGEXP 'location|thing|group'
AND `username`= :goto");
$stmt->execute(array(':goto' => $goto));
$num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));
if ($num_results != 0) {
$_SESSION['return'] = array(
'type' => 'danger',
'msg' => sprintf($lang['danger']['goto_invalid'])
);
return false;
}
if (!filter_var($goto, FILTER_VALIDATE_EMAIL) === true) {
$_SESSION['return'] = array(
'type' => 'danger',
'msg' => sprintf($lang['danger']['goto_invalid'])
);
return false;
}
}
$gotos = array_filter($gotos);
$goto = implode(",", $gotos);
foreach ($addresses as $address) { foreach ($addresses as $address) {
if (empty($address)) { if (empty($address)) {
continue; continue;
} }
if (in_array($address, $gotos)) {
continue;
}
$stmt = $pdo->prepare("SELECT `address` FROM `alias` $stmt = $pdo->prepare("SELECT `address` FROM `alias`
WHERE `address`= :address"); WHERE `address`= :address");
$stmt->execute(array(':address' => $address)); $stmt->execute(array(':address' => $address));
@ -397,42 +429,6 @@ function mailbox($_action, $_type, $_data = null) {
); );
return false; return false;
} }
foreach ($gotos as &$goto) {
if (empty($goto)) {
continue;
}
$goto_domain = idn_to_ascii(substr(strstr($goto, '@'), 1));
$goto_local_part = strstr($goto, '@', true);
$goto = $goto_local_part.'@'.$goto_domain;
$stmt = $pdo->prepare("SELECT `username` FROM `mailbox`
WHERE `kind` REGEXP 'location|thing|group'
AND `username`= :goto");
$stmt->execute(array(':goto' => $goto));
$num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));
if ($num_results != 0) {
$_SESSION['return'] = array(
'type' => 'danger',
'msg' => sprintf($lang['danger']['goto_invalid'])
);
return false;
}
if (!filter_var($goto, FILTER_VALIDATE_EMAIL) === true) {
$_SESSION['return'] = array(
'type' => 'danger',
'msg' => sprintf($lang['danger']['goto_invalid'])
);
return false;
}
if ($goto == $address) {
$_SESSION['return'] = array(
'type' => 'danger',
'msg' => sprintf($lang['danger']['alias_goto_identical'])
);
return false;
}
}
$gotos = array_filter($gotos);
$goto = implode(",", $gotos);
try { try {
$stmt = $pdo->prepare("INSERT INTO `alias` (`address`, `goto`, `domain`, `active`) $stmt = $pdo->prepare("INSERT INTO `alias` (`address`, `goto`, `domain`, `active`)
VALUES (:address, :goto, :domain, :active)"); VALUES (:address, :goto, :domain, :active)");

View File

@ -93,6 +93,9 @@ services:
- dkim-vol-1:/data/dkim - dkim-vol-1:/data/dkim
- rspamd-vol-1:/var/lib/rspamd - rspamd-vol-1:/var/lib/rspamd
restart: always restart: always
logging:
options:
max-size: "5m"
dns: dns:
- 172.22.1.254 - 172.22.1.254
dns_search: mailcow-network dns_search: mailcow-network
@ -119,6 +122,9 @@ services:
- DBPASS=${DBPASS} - DBPASS=${DBPASS}
- MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME} - MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
restart: always restart: always
logging:
options:
max-size: "5m"
dns: dns:
- 172.22.1.254 - 172.22.1.254
dns_search: mailcow-network dns_search: mailcow-network
@ -143,6 +149,9 @@ services:
- ./data/conf/sogo/:/etc/sogo/ - ./data/conf/sogo/:/etc/sogo/
- ./data/web/thunderbird-plugins:/thunderbird - ./data/web/thunderbird-plugins:/thunderbird
restart: always restart: always
logging:
options:
max-size: "5m"
dns: dns:
- 172.22.1.254 - 172.22.1.254
dns_search: mailcow-network dns_search: mailcow-network
@ -168,6 +177,9 @@ services:
- DBNAME=${DBNAME} - DBNAME=${DBNAME}
- DBUSER=${DBUSER} - DBUSER=${DBUSER}
- DBPASS=${DBPASS} - DBPASS=${DBPASS}
logging:
options:
max-size: "5m"
ports: ports:
- "${IMAP_PORT:-143}:143" - "${IMAP_PORT:-143}:143"
- "${IMAPS_PORT:-993}:993" - "${IMAPS_PORT:-993}:993"
@ -204,6 +216,9 @@ services:
- "${SMTPS_PORT:-465}:465" - "${SMTPS_PORT:-465}:465"
- "${SUBMISSION_PORT:-587}:587" - "${SUBMISSION_PORT:-587}:587"
restart: always restart: always
logging:
options:
max-size: "5m"
dns: dns:
- 172.22.1.254 - 172.22.1.254
dns_search: mailcow-network dns_search: mailcow-network
@ -250,6 +265,9 @@ services:
- ./data/conf/rspamd/dynmaps:/dynmaps:ro - ./data/conf/rspamd/dynmaps:/dynmaps:ro
- ./data/assets/ssl/:/etc/ssl/mail/:ro - ./data/assets/ssl/:/etc/ssl/mail/:ro
- ./data/conf/nginx/:/etc/nginx/conf.d/:rw - ./data/conf/nginx/:/etc/nginx/conf.d/:rw
logging:
options:
max-size: "5m"
ports: ports:
- "${HTTPS_BIND:-0.0.0.0}:${HTTPS_PORT:-443}:${HTTPS_PORT:-443}" - "${HTTPS_BIND:-0.0.0.0}:${HTTPS_PORT:-443}:${HTTPS_PORT:-443}"
- "${HTTP_BIND:-127.0.0.1}:${HTTP_PORT:-80}:${HTTP_PORT:-80}" - "${HTTP_BIND:-127.0.0.1}:${HTTP_PORT:-80}:${HTTP_PORT:-80}"