Commit c9abb2d5 authored by Till Brehm's avatar Till Brehm
Browse files

Merge branch 'stable-3.1' into 'stable-3.1'

re-creation for dkim keys fails (Fixes #5061)

See merge request ispconfig/ispconfig3!796
parents a25fa66c 64104355
...@@ -40,12 +40,11 @@ $domain_id = $_GET['domain_id']; ...@@ -40,12 +40,11 @@ $domain_id = $_GET['domain_id'];
if($type == 'create_dkim' && $domain_id != ''){ if($type == 'create_dkim' && $domain_id != ''){
$dkim_public = $_GET['dkim_public']; $dkim_public = $_GET['dkim_public'];
$dkim_selector = $_GET['dkim_selector']; $dkim_selector = $_GET['dkim_selector'];
$client_id = $_GET['client_group_id']; $domain=@(is_numeric($domain_id))?$app->db->queryOneRecord("SELECT domain FROM domain WHERE domain_id = ? AND ".$app->tform->getAuthSQL('r'), $domain_id)['domain']:$domain_id;
$server_id = $_GET['server_id']; $rec = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = ?", $domain);
$server_id = $rec['server_id'];
$domain=@(is_numeric($domain_id))?$app->db->queryOneRecord("SELECT domain FROM domain WHERE domain_id = ?", $domain_id)['domain']:$domain_id; $maildomain = $rec['domain'];
$maildomain = $app->db->queryOneRecord("SELECT domain FROM mail_domain WHERE domain = ?", $domain)['domain']; unset($rec);
$mail_config = $app->getconf->get_server_config($server_id, 'mail'); $mail_config = $app->getconf->get_server_config($server_id, 'mail');
$dkim_strength = $app->functions->intval($mail_config['dkim_strength']); $dkim_strength = $app->functions->intval($mail_config['dkim_strength']);
if ($dkim_strength=='') $dkim_strength = 2048; if ($dkim_strength=='') $dkim_strength = 2048;
...@@ -75,7 +74,6 @@ if($type == 'create_dkim' && $domain_id != ''){ ...@@ -75,7 +74,6 @@ if($type == 'create_dkim' && $domain_id != ''){
} else { } else {
$selector = 'invalid domain or selector'; $selector = 'invalid domain or selector';
} }
} else {
unset($dkim_public); unset($dkim_public);
exec('echo '.escapeshellarg($dkim_private).'|openssl rsa -pubout -outform PEM 2> /dev/null',$pubkey,$result); exec('echo '.escapeshellarg($dkim_private).'|openssl rsa -pubout -outform PEM 2> /dev/null',$pubkey,$result);
foreach($pubkey as $values) $dkim_public=$dkim_public.$values."\n"; foreach($pubkey as $values) $dkim_public=$dkim_public.$values."\n";
......
...@@ -101,9 +101,6 @@ ...@@ -101,9 +101,6 @@
<label for="dkim_private" class="col-sm-3 control-label">{tmpl_var name='dkim_private_txt'}</label> <label for="dkim_private" class="col-sm-3 control-label">{tmpl_var name='dkim_private_txt'}</label>
<div class="col-sm-9"><textarea class="form-control" name="dkim_private" id="dkim_private" rows='10' cols='30'>{tmpl_var name='dkim_private'}</textarea></div> <div class="col-sm-9"><textarea class="form-control" name="dkim_private" id="dkim_private" rows='10' cols='30'>{tmpl_var name='dkim_private'}</textarea></div>
</div> </div>
<!--
<a class="btn btn-default formbutton-default" href="javascript:setRequest('create')" value="{tmpl_var name='dkim_generate_txt'}">{tmpl_var name='dkim_generate_txt'}</a>
-->
<a class="btn btn-default formbutton-default" id="dkim-button" value="{tmpl_var name='dkim_generate_txt'}">{tmpl_var name='dkim_generate_txt'}</a> <a class="btn btn-default formbutton-default" id="dkim-button" value="{tmpl_var name='dkim_generate_txt'}">{tmpl_var name='dkim_generate_txt'}</a>
<div class="form-group"> <div class="form-group">
<div class="col-sm-9"><textarea class="form-control" name="dkim_public" style="display:none;" id="dkim_public" rows='5' cols='30' readonly>{tmpl_var name='dkim_public'}</textarea></div> <div class="col-sm-9"><textarea class="form-control" name="dkim_public" style="display:none;" id="dkim_public" rows='5' cols='30' readonly>{tmpl_var name='dkim_public'}</textarea></div>
...@@ -129,14 +126,10 @@ ...@@ -129,14 +126,10 @@
function getDKIM() { function getDKIM() {
var domain_id = jQuery('#domain').val(); var domain_id = jQuery('#domain').val();
var client_group_id = jQuery('#client_group_id').val();
var server_id = jQuery('#server_id').val();
var dkim_selector = jQuery('#dkim_selector').val(); var dkim_selector = jQuery('#dkim_selector').val();
var dkim_public = jQuery('#dkim_public').val(); var dkim_public = jQuery('#dkim_public').val();
jQuery.getJSON('mail/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), { jQuery.getJSON('mail/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {
domain_id : domain_id, domain_id : domain_id,
client_group_id : client_group_id,
server_id : server_id,
dkim_public : dkim_public, dkim_public : dkim_public,
dkim_selector : dkim_selector, dkim_selector : dkim_selector,
type : "create_dkim" type : "create_dkim"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment