Skip to content

Commit 2a05425

Browse files
author
Till Brehm
committed
Merge branch 'stable-3.1' into 'stable-3.1'
fixed interface/lib/classes/remoting.inc.php with no IPs set for remote-access See merge request ispconfig/ispconfig3!720
2 parents e7d2e96 + cd3b3a7 commit 2a05425

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

install/tpl/debian6_dovecot-sql.conf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ user_query = SELECT email as user, maildir as home, CONCAT( maildir_format, ':',
1919

2020
# The iterate_query is required for the doveadm command only and works only on dovecot 2 servers.
2121
# Do not enable it on Dovecot 1.x servers
22-
# iterate_query = SELECT email as user FROM mail_user WHERE `disable%Ls` = 'n' AND server_id = '{server_id}'
22+
# iterate_query = SELECT email as user FROM mail_user WHERE server_id = '{server_id}'

interface/lib/classes/remoting.inc.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,19 @@ public function login($username, $password, $client_login = false)
144144
$sql = "SELECT * FROM remote_user WHERE remote_username = ? and remote_password = md5(?)";
145145
$remote_user = $app->db->queryOneRecord($sql, $username, $password);
146146
if($remote_user['remote_userid'] > 0) {
147-
$allowed_ips = explode(',',$remote_user['remote_ips']);
148-
foreach($allowed_ips as $i => $allowed) {
149-
if(!filter_var($allowed, FILTER_VALIDATE_IP)) {
150-
// get the ip for a hostname
151-
unset($allowed_ips[$i]);
152-
$temp=dns_get_record($allowed, DNS_A+DNS_AAAA);
153-
foreach($temp as $t) {
154-
if(isset($t['ip'])) $allowed_ips[] = $t['ip'];
155-
if(isset($t['ipv6'])) $allowed_ips[] = $t['ipv6'];
147+
if (trim($remote_user['remote_ips']) != '') {
148+
$allowed_ips = explode(',',$remote_user['remote_ips']);
149+
foreach($allowed_ips as $i => $allowed) {
150+
if(!filter_var($allowed, FILTER_VALIDATE_IP)) {
151+
// get the ip for a hostname
152+
unset($allowed_ips[$i]);
153+
$temp=dns_get_record($allowed, DNS_A+DNS_AAAA);
154+
foreach($temp as $t) {
155+
if(isset($t['ip'])) $allowed_ips[] = $t['ip'];
156+
if(isset($t['ipv6'])) $allowed_ips[] = $t['ipv6'];
157+
}
158+
unset($temp);
156159
}
157-
unset($temp);
158160
}
159161
}
160162
$allowed_ips[] = '127.0.0.1';

0 commit comments

Comments
 (0)