Merge pull request #5730 from Icinga/fix/trim-form-fields-to-avoid-hidden-crlf-characters-from-linux-5705

Add missing trims to GetMasterHostPort and remove Convert.ToString from variables that are strings already
This commit is contained in:
Gunnar Beutner 2017-11-09 09:29:11 +01:00 committed by GitHub
commit bcf6739d9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 12 deletions

View File

@ -54,8 +54,8 @@ namespace Icinga
{
foreach (ListViewItem lvi in lvwEndpoints.Items) {
if (lvi.SubItems.Count > 1) {
host = lvi.SubItems[1].Text;
port = lvi.SubItems[2].Text;
host = lvi.SubItems[1].Text.Trim();
port = lvi.SubItems[2].Text.Trim();
return true;
}
}
@ -194,21 +194,21 @@ namespace Icinga
string master_host, master_port;
GetMasterHostPort(out master_host, out master_port);
args += " --master_host " + Convert.ToString(master_host).Trim()
+ "," + Convert.ToString(master_port).Trim();
args += " --master_host " + master_host
+ "," + master_port;
foreach (ListViewItem lvi in lvwEndpoints.Items) {
args += " --endpoint " + Convert.ToString(lvi.SubItems[0].Text).Trim();
args += " --endpoint " + lvi.SubItems[0].Text.Trim();
if (lvi.SubItems.Count > 1) {
args += "," + Convert.ToString(lvi.SubItems[1].Text).Trim()
+ "," + Convert.ToString(lvi.SubItems[2].Text).Trim();
args += "," + lvi.SubItems[1].Text.Trim()
+ "," + lvi.SubItems[2].Text.Trim();
}
}
});
if (rdoListener.Checked)
args += " --listen ::," + Convert.ToString(txtListenerPort.Text).Trim();
args += " --listen ::," + txtListenerPort.Text.Trim();
if (chkAcceptConfig.Checked)
args += " --accept-config";
@ -216,14 +216,14 @@ namespace Icinga
if (chkAcceptCommands.Checked)
args += " --accept-commands";
string ticket = Convert.ToString(txtTicket.Text).Trim();
string ticket = txtTicket.Text.Trim();
if (ticket.Length > 0)
args += " --ticket \"" + ticket + "\"";
args += " --trustedcert \"" + _TrustedFile + "\"";
args += " --cn \"" + Convert.ToString(txtInstanceName.Text).Trim() + "\"";
args += " --zone \"" + Convert.ToString(txtInstanceName.Text) + "\"";
args += " --cn \"" + txtInstanceName.Text.Trim() + "\"";
args += " --zone \"" + txtInstanceName.Text.Trim() + "\"";
if (!RunProcess(Program.Icinga2InstallDir + "\\sbin\\icinga2.exe",
"node setup" + args,
@ -234,7 +234,7 @@ namespace Icinga
SetConfigureStatus(50, "Setting ACLs for the Icinga 2 directory...");
string serviceUser = Convert.ToString(txtUser.Text).Trim();
string serviceUser = txtUser.Text.Trim();
DirectoryInfo di = new DirectoryInfo(Program.Icinga2InstallDir);
DirectorySecurity ds = di.GetAccessControl();