1
0
mirror of https://github.com/Ylianst/MeshCentralRouter synced 2025-12-06 00:13:33 +00:00

fix: devices in "no agent devices relayed thru agent"-groups not accessible

This commit is contained in:
Simon Schön
2023-03-17 22:59:00 +01:00
parent 05949d9be1
commit bbdc101d8b
4 changed files with 26 additions and 4 deletions

View File

@@ -526,7 +526,10 @@ namespace MeshCentralRouter
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
// ignore close-to-tray on debug-builds
#if !DEBUG
if ((notifyIcon.Visible == true) && (currentPanel == 4) && (forceExit == false)) { e.Cancel = true; Visible = false; }
#endif
Settings.SetRegValue("Location", Location.X + "," + Location.Y);
}
@@ -1709,13 +1712,22 @@ namespace MeshCentralRouter
public void QuickMap(int protocol, int port, int appId, NodeClass node)
{
NodeClass tmpNode = node;
if (node.mesh.relayid != null)
{
if (!meshcentral.nodes.ContainsKey(node.mesh.relayid))
return;
tmpNode = meshcentral.nodes[node.mesh.relayid];
}
// See if we already have the right port mapping
foreach (Control c in mapPanel.Controls)
{
if (c.GetType() == typeof(MapUserControl))
{
MapUserControl cc = (MapUserControl)c;
if ((cc.protocol == protocol) && (cc.remotePort == port) && (cc.appId == appId) && (cc.node == node))
if ((cc.remoteIP == node.host) && (cc.protocol == protocol) && (cc.remotePort == port) && (cc.appId == appId) && (cc.node == tmpNode))
{
// Found a match
cc.appButton_Click(this, null);
@@ -1729,11 +1741,17 @@ namespace MeshCentralRouter
map.xdebug = debug;
map.inaddrany = false; // Loopback only
map.protocol = protocol; // 1 = TCP, 2 = UDP
if (node.mesh.relayid != null)
{
map.name = node.name;
map.remoteIP = node.host;
}
map.localPort = 0; // Any
map.remotePort = port; // HTTP
map.appId = appId; // 0 = Custom, 1 = HTTP, 2 = HTTPS, 3 = RDP, 4 = PuTTY, 5 = WinSCP
map.appIdStr = null;
map.node = node;
map.node = tmpNode;
if (authLoginUrl != null) { map.host = authLoginUrl.Host + ":" + ((authLoginUrl.Port > 0) ? authLoginUrl.Port : 443) + authLoginUrl.AbsolutePath.Replace("/control.ashx", ""); } else { map.host = serverNameComboBox.Text; }
map.certhash = meshcentral.wshash;
map.parent = this;

View File

@@ -494,6 +494,7 @@ namespace MeshCentralRouter
m.meshid = (string)mesh["_id"];
m.name = (string)mesh["name"];
if (mesh.ContainsKey("desc")) { m.desc = (string)mesh["desc"]; }
if (mesh.ContainsKey("relayid")) { m.relayid = (string)mesh["relayid"]; }
m.rights = 0;
m.links = new Dictionary<string, ulong>();
@@ -602,6 +603,7 @@ namespace MeshCentralRouter
}
n.name = (string)node["name"];
n.meshid = meshid;
if (node.ContainsKey("host")) { n.host = (string)node["host"]; }
if (node.ContainsKey("mtype"))
{

View File

@@ -167,7 +167,7 @@ namespace MeshCentralRouter
TcpClient client = null;
try
{
client = listener.EndAcceptTcpClient(ar);
client = listener?.EndAcceptTcpClient(ar);
}
catch (Exception) { exit = true; }
@@ -179,7 +179,7 @@ namespace MeshCentralRouter
try
{
listener.BeginAcceptTcpClient(new AsyncCallback(AcceptTcpClientSink), null);
listener?.BeginAcceptTcpClient(new AsyncCallback(AcceptTcpClientSink), null);
}
catch (Exception) { exit = true; }
}

View File

@@ -25,6 +25,7 @@ namespace MeshCentralRouter
public int icon;
public string nodeid;
public string meshid;
public string host;
public int agentid;
public int agentcaps;
public int conn;
@@ -60,6 +61,7 @@ namespace MeshCentralRouter
public string name;
public string meshid;
public string desc;
public string relayid;
public int type;
public ulong rights;
public Dictionary<string, ulong> links;