blob: 5925829af54e6d23edd706674164510ccb843576 (
plain) (
tree)
|
|
<p>
{{lang_connectionWait}}
</p>
<div id="zeug">
<div data-tm-id="{{taskid}}" data-tm-log="messages" data-tm-callback="portScan">Port Check</div>
</div>
<div id="self-signed" style="display:none" class="alert alert-info">{{lang_selfSignedNote}}</div>
<div id="no-valid-cert" style="display:none" class="alert alert-danger">{{lang_noValidCert}}</div>
<div id="no-open-port" style="display:none" class="alert alert-danger">{{lang_noOpenPort}}</div>
<br>
<div class="pull-left">
<form role="form" method="post" action="?do=SysConfig&action=addmodule&step={{prev}}">
<input type="hidden" name="token" value="{{token}}">
<input type="hidden" name="edit" value="{{edit}}">
<input name="title" value="{{title}}" type="hidden">
<input name="server" value="{{server}}" type="hidden">
<input name="searchbase" value="{{searchbase}}" type="hidden">
<input name="binddn" value="{{binddn}}" type="hidden">
<input name="bindpw" value="{{bindpw}}" type="hidden">
<input name="home" value="{{home}}" type="hidden">
<input name="homeattr" value="{{homeattr}}" type="hidden">
{{#ssl}}
<input name="ssl" value="on" type="hidden">
<input type="hidden" name="certificate" value="{{certificate}}">
{{/ssl}}
<button type="submit" class="btn btn-primary">« {{lang_back}}</button>
</form>
</div>
<div class="pull-right">
<form id="nextform" role="form" method="post" action="?do=SysConfig&action=addmodule&step={{next}}">
<input type="hidden" name="token" value="{{token}}">
<input type="hidden" name="edit" value="{{edit}}">
<input name="title" value="{{title}}" type="hidden">
<input name="server" value="{{server}}" type="hidden">
<input id="port" name="port" value="" type="hidden">
<input name="searchbase" value="{{searchbase}}" type="hidden">
<input name="binddn" value="{{binddn}}" type="hidden">
<input name="bindpw" value="{{bindpw}}" type="hidden">
<input name="home" value="{{home}}" type="hidden">
<input name="homeattr" value="{{homeattr}}" type="hidden">
{{#ssl}}
<input id="ssl" name="ssl" value="on" type="hidden">
<input id="fingerprint" name="fingerprint" value="" type="hidden">
<input id="certificate" type="hidden" name="certificate" value="{{certificate}}">
{{/ssl}}
<input name="originalbinddn" value="{{binddn}}" type="hidden">
<button id="nextbutton" type="submit" class="btn btn-primary" style="display:none">{{lang_next}} »</button>
</form>
</div>
<div id="bla"></div>
<script type="text/javascript">
function isSelfSigned(code)
{
return code == 18 || code == 19 || code == 20 || code == 21;
}
function portScan(task)
{
if (!task || !task.statusCode)
return;
if (task.statusCode === 'TASK_FINISHED' && task.data && task.data.ports) {
var ssl = $('#ssl').length > 0;
var ports = task.data.ports;
var verRes = -1;
var cert = ssl && $('#certificate').val().length > 10;
for (var i = 0; i < ports.length; ++i) {
if (!ports[i].open || !ports[i].port) continue;
if ($.isNumeric($('#port').val()) && $('#port').val() < ports[i].port) continue; // Prefer the global LDAP ports over the specific AD ports
if (ssl) {
if (verRes === -1) verRes = ports[i].verifyResult;
if (ports[i].certFingerprint.length < 10 || ports[i].certificateChain.length < 10) continue;
if (ports[i].verifyResult != 0 && (cert || !isSelfSigned(ports[i].verifyResult))) continue;
verRes = ports[i].verifyResult;
$('#fingerprint').val(ports[i].certFingerprint);
if (!cert && verRes != 0) $('#certificate').val(ports[i].certificateChain);
else if (!cert && verRes == 0) $('#certificate').val('default');
}
$('#port').val(ports[i].port);
}
if (ssl && verRes != 0 && (cert || !isSelfSigned(verRes))) {
$('#no-valid-cert').css('display', '');
} else if ($('#port').val() > 0) {
$('#nextbutton').show();
if (ssl && isSelfSigned(verRes)) $('#self-signed').css('display', '');
else $('#nextform').submit();
} else {
$('#no-open-port').css('display', '');
}
}
}
</script>
|