From 701f3c9728e6d2e4713f3df381b3478de084c748 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Sat, 18 Feb 2017 09:37:22 -0700 Subject: [PATCH] Fix client IP when connected via SSH --- core/client.js | 4 ---- core/client_connections.js | 9 +++++---- core/predefined_mci.js | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/core/client.js b/core/client.js index 544e66c4..6815768d 100644 --- a/core/client.js +++ b/core/client.js @@ -457,10 +457,6 @@ Client.prototype.waitForKeyPress = function(cb) { }); }; -Client.prototype.address = function() { - return this.input.address(); -}; - Client.prototype.isLocal = function() { // :TODO: return rather client is a local connection or not return false; diff --git a/core/client_connections.js b/core/client_connections.js index 2b3c1714..5cbeb3b9 100644 --- a/core/client_connections.js +++ b/core/client_connections.js @@ -56,16 +56,17 @@ function getActiveNodeList(authUsersOnly) { } function addNewClient(client, clientSock) { - const id = client.session.id = clientConnections.push(client) - 1; + const id = client.session.id = clientConnections.push(client) - 1; + const remoteAddress = client.remoteAddress = clientSock.remoteAddress; // Create a client specific logger // Note that this will be updated @ login with additional information client.log = logger.log.child( { clientId : id } ); const connInfo = { - ip : clientSock.remoteAddress, - serverName : client.session.serverName, - isSecure : client.session.isSecure, + remoteAddress : remoteAddress, + serverName : client.session.serverName, + isSecure : client.session.isSecure, }; if(client.log.debug()) { diff --git a/core/predefined_mci.js b/core/predefined_mci.js index 58f56cf4..25697a13 100644 --- a/core/predefined_mci.js +++ b/core/predefined_mci.js @@ -91,7 +91,7 @@ function getPredefinedMCIValue(client, code) { UT : function themeId() { return userStatAsString(client, 'theme_id', ''); }, UC : function loginCount() { return userStatAsString(client, 'login_count', 0); }, ND : function connectedNode() { return client.node.toString(); }, - IP : function clientIpAddress() { return client.address().address; }, + IP : function clientIpAddress() { return client.remoteAddress; }, ST : function serverName() { return client.session.serverName; }, FN : function activeFileBaseFilterName() { const activeFilter = FileBaseFilters.getActiveFilter(client);