Skip to content

Commit e67ff2f

Browse files
author
Marius Burkard
committed
Merge branch 'stable-3.1'
2 parents 5473ac2 + e8d2fd2 commit e67ff2f

File tree

246 files changed

+3929
-3872
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

246 files changed

+3929
-3872
lines changed

install/apps/metronome_libs/mod_auth_external/db_auth.php

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717

1818
// check for existing user
1919
$dbmail = $db->real_escape_string($arg_email);
20-
$result = $db->query("SELECT jid, password FROM xmpp_user WHERE jid LIKE ? AND active='y' AND server_id=?", $dbmail, $isp_server_id);
21-
result_false($result->num_rows != 1);
22-
23-
$user = $result->fetch_object();
24-
25-
// check for domain autologin api key
26-
$domain_key = 'f47kmm5Yh5hJzSws2KTS';
27-
28-
checkAuth($argv[1], $argv[2], $arg_password, $user->password, $domain_key);
20+
$query = $db->prepare("SELECT jid, password FROM xmpp_user WHERE jid LIKE ? AND active='y' AND server_id=?");
21+
$query->bind_param('si', $arg_email, $isp_server_id);
22+
$query->execute();
23+
$query->bind_result($jid, $password);
24+
$query->fetch();
25+
$query->close();
26+
27+
result_false(is_null($jid));
28+
checkAuth($arg_password, $password);
2929
}catch(Exception $ex){
3030
echo 0;
3131
exit();
@@ -40,19 +40,9 @@ function result_true(){
4040
echo 1;
4141
exit();
4242
}
43-
function checkAuth($user, $domain, $pw_arg, $pw_db, $domain_key){
43+
function checkAuth($pw_arg, $pw_db){
4444
if(crypt($pw_arg, $pw_db) == $pw_db)
4545
result_true();
46-
47-
if($domain_key){
48-
$datetime = new DateTime();
49-
$datetime->setTimezone(new DateTimeZone("UTC"));
50-
for($t = $datetime->getTimestamp(); $t >= $datetime->getTimestamp()-30; $t--){
51-
$pw_api = md5($domain.'@'.$domain_key.'@'.$user.'@'.$t);
52-
if($pw_api == $pw_arg)
53-
result_true();
54-
}
55-
}
5646
result_false();
5747
}
5848
?>

install/apps/metronome_libs/mod_auth_external/db_isuser.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@
1515

1616
// check for existing user
1717
$dbmail = $db->real_escape_string($arg_email);
18-
$result = $db->query("SELECT jid, password FROM xmpp_user WHERE jid LIKE ? AND active='y' AND server_id=?", $dbmail, $isp_server_id);
19-
result_false($result->num_rows != 1);
18+
$query = $db->prepare("SELECT count(*) AS usercount FROM xmpp_user WHERE jid LIKE ? AND active='y' AND server_id=?");
19+
$query->bind_param('si', $arg_email, $isp_server_id);
20+
$query->execute();
21+
$query->bind_result($usercount);
22+
$query->fetch();
23+
$query->close();
24+
25+
result_false($usercount != 1);
2026
result_true();
2127

2228
}catch(Exception $ex){
@@ -34,4 +40,4 @@ function result_true(){
3440
exit();
3541
}
3642

37-
?>
43+
?>

install/lib/installer_base.lib.php

Lines changed: 17 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,6 +1683,7 @@ public function configure_xmpp($options = '') {
16831683
// Copy isp libs
16841684
if(!@is_dir('/usr/lib/metronome/isp-modules')) mkdir('/usr/lib/metronome/isp-modules', 0755, true);
16851685
caselog('cp -rf apps/metronome_libs/* /usr/lib/metronome/isp-modules/', __FILE__, __LINE__);
1686+
caselog('chmod 755 /usr/lib/metronome/isp-modules/mod_auth_external/authenticate_isp.sh', __FILE__, __LINE__);
16861687
// Process db config
16871688
$full_file_name = '/usr/lib/metronome/isp-modules/mod_auth_external/db_conf.inc.php';
16881689
$content = rf($full_file_name);
@@ -1695,13 +1696,14 @@ public function configure_xmpp($options = '') {
16951696

16961697
if(!stristr($options, 'dont-create-certs')){
16971698
// Create SSL Certificate for localhost
1698-
echo "writing new private key to 'localhost.key'\n-----\n";
1699-
$ssl_country = $this->free_query('Country Name (2 letter code)', 'AU');
1700-
$ssl_locality = $this->free_query('Locality Name (eg, city)', '');
1699+
// Ensure no line is left blank
1700+
echo "writing new private key to 'localhost.key'\n-----\n";
1701+
$ssl_country = $this->free_query('Country Name (2 letter code)', 'AU');
1702+
$ssl_locality = $this->free_query('Locality Name (eg, city)', 'City Name');
17011703
$ssl_organisation = $this->free_query('Organization Name (eg, company)', 'Internet Widgits Pty Ltd');
1702-
$ssl_organisation_unit = $this->free_query('Organizational Unit Name (eg, section)', '');
1704+
$ssl_organisation_unit = $this->free_query('Organizational Unit Name (eg, section)', 'Infrastructure');
17031705
$ssl_domain = $this->free_query('Common Name (e.g. server FQDN or YOUR name)', $conf['hostname']);
1704-
$ssl_email = $this->free_query('Email Address', '');
1706+
$ssl_email = $this->free_query('Email Address', 'hostmaster@'.$conf['hostname']);
17051707

17061708
$tpl = new tpl('metronome_conf_ssl.master');
17071709
$tpl->setVar('ssl_country',$ssl_country);
@@ -1718,6 +1720,14 @@ public function configure_xmpp($options = '') {
17181720
exec("(cd /etc/metronome/certs && make localhost.cert)");
17191721
exec('chmod 0400 /etc/metronome/certs/localhost.key');
17201722
exec('chown metronome /etc/metronome/certs/localhost.key');
1723+
1724+
echo "IMPORTANT:\n";
1725+
echo "Localhost Key, Csr and a self-signed Cert have been saved to /etc/metronome/certs\n";
1726+
echo "In order to work with all clients, the server must have a trusted certificate, so use the Csr\n";
1727+
echo "to get a trusted certificate from your CA or replace Key and Cert with already signed files for\n";
1728+
echo "your domain. Clients like Pidgin dont allow to use untrusted self-signed certificates.\n";
1729+
echo "\n";
1730+
17211731
}else{
17221732
echo "-----\n";
17231733
echo "Metronome XMPP SSL server certificate is not renewed. Run the following command manual as root to recreate it:\n";
@@ -1731,45 +1741,6 @@ public function configure_xmpp($options = '') {
17311741
caselog('update-rc.d metronome defaults', __FILE__, __LINE__);
17321742

17331743
exec($this->getinitcommand($conf['xmpp']['init_script'], 'restart'));
1734-
1735-
/*
1736-
writing new private key to 'smtpd.key'
1737-
-----
1738-
You are about to be asked to enter information that will be incorporated
1739-
into your certificate request.
1740-
What you are about to enter is what is called a Distinguished Name or a DN.
1741-
There are quite a few fields but you can leave some blank
1742-
For some fields there will be a default value,
1743-
If you enter '.', the field will be left blank.
1744-
-----
1745-
Country Name (2 letter code) [AU]:
1746-
State or Province Name (full name) [Some-State]:
1747-
Locality Name (eg, city) []:
1748-
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
1749-
Organizational Unit Name (eg, section) []:
1750-
Common Name (e.g. server FQDN or YOUR name) []:
1751-
Email Address []:
1752-
* */
1753-
1754-
/*// Dont just copy over the virtualhost template but add some custom settings
1755-
$tpl = new tpl('apache_apps.vhost.master');
1756-
1757-
$tpl->setVar('apps_vhost_port',$conf['web']['apps_vhost_port']);
1758-
$tpl->setVar('apps_vhost_dir',$conf['web']['website_basedir'].'/apps');
1759-
$tpl->setVar('apps_vhost_basedir',$conf['web']['website_basedir']);
1760-
$tpl->setVar('apps_vhost_servername',$apps_vhost_servername);
1761-
$tpl->setVar('apache_version',getapacheversion());
1762-
1763-
1764-
// comment out the listen directive if port is 80 or 443
1765-
if($conf['web']['apps_vhost_ip'] == 80 or $conf['web']['apps_vhost_ip'] == 443) {
1766-
$tpl->setVar('vhost_port_listen','#');
1767-
} else {
1768-
$tpl->setVar('vhost_port_listen','');
1769-
}
1770-
1771-
wf($vhost_conf_dir.'/apps.vhost', $tpl->grab());
1772-
unset($tpl);*/
17731744
}
17741745

17751746

@@ -2649,8 +2620,8 @@ public function install_ispconfig() {
26492620
if(is_file('/usr/local/bin/ispconfig_update_from_dev.sh')) unlink('/usr/local/bin/ispconfig_update_from_dev.sh');
26502621
chown($install_dir.'/server/scripts/update_from_dev.sh', 'root');
26512622
chmod($install_dir.'/server/scripts/update_from_dev.sh', 0700);
2652-
chown($install_dir.'/server/scripts/update_from_tgz.sh', 'root');
2653-
chmod($install_dir.'/server/scripts/update_from_tgz.sh', 0700);
2623+
// chown($install_dir.'/server/scripts/update_from_tgz.sh', 'root');
2624+
// chmod($install_dir.'/server/scripts/update_from_tgz.sh', 0700);
26542625
chown($install_dir.'/server/scripts/ispconfig_update.sh', 'root');
26552626
chmod($install_dir.'/server/scripts/ispconfig_update.sh', 0700);
26562627
if(!is_link('/usr/local/bin/ispconfig_update_from_dev.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh', '/usr/local/bin/ispconfig_update_from_dev.sh');

interface/lib/classes/remote.d/sites.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ public function sites_database_user_delete($session_id, $primary_id)
261261
return false;
262262
}
263263

264-
$app->db->datalogDelete('web_database_user', 'database_user_id', $primary_id);
264+
//$app->db->datalogDelete('web_database_user', 'database_user_id', $primary_id);
265265
$affected_rows = $this->deleteQuery('../sites/form/database_user.tform.php', $primary_id);
266266

267267
$records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_user_id = ?", $primary_id);

interface/lib/classes/remoting.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ protected function getSession($session_id)
488488
public function server_get($session_id, $server_id = null, $section ='') {
489489
global $app;
490490
if(!$this->checkPerm($session_id, 'server_get')) {
491-
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
491+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
492492
return false;
493493
}
494494
if (!empty($session_id)) {
@@ -522,7 +522,7 @@ public function server_get_all($session_id)
522522
{
523523
global $app;
524524
if(!$this->checkPerm($session_id, 'server_get')) {
525-
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
525+
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
526526
return false;
527527
}
528528
if (!empty($session_id)) {

interface/lib/classes/tform_base.inc.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,17 @@ function validateField($field_name, $field_value, $validators) {
10621062
$this->errorMessage .= $errmsg."<br />\r\n";
10631063
}
10641064
}
1065-
} else $this->errorMessage .= "function filter_var missing <br />\r\n";
1065+
} else {
1066+
$tmpval = $app->functions->intval($field_value);
1067+
if($tmpval === 0 and !empty($field_value)) {
1068+
$errmsg = $validator['errmsg'];
1069+
if(isset($this->wordbook[$errmsg])) {
1070+
$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
1071+
} else {
1072+
$this->errorMessage .= $errmsg."<br />\r\n";
1073+
}
1074+
}
1075+
}
10661076
break;
10671077
case 'ISPOSITIVE':
10681078
if(function_exists('filter_var')) {

0 commit comments

Comments
 (0)