Windows installer adds PING and SSH subagents to agent configuration on server
[public/netxms.git] / src / agent / subagents / ssh / session.cpp
index d3b0a50..449dfdf 100644 (file)
@@ -88,8 +88,8 @@ bool SSHSession::connect(const TCHAR *user, const TCHAR *password)
    char hostname[64];
    ssh_options_set(m_session, SSH_OPTIONS_HOST, m_addr.toStringA(hostname));
    ssh_options_set(m_session, SSH_OPTIONS_PORT, &m_port);
-   long timeout = 2;
-   ssh_options_set(m_session, SSH_OPTIONS_TIMEOUT, &timeout);
+   long timeout = (long)g_sshConnectTimeout * (long)1000;   // convert milliseconds to microseconds
+   ssh_options_set(m_session, SSH_OPTIONS_TIMEOUT_USEC, &timeout);
 #ifdef UNICODE
    char mbuser[256];
    WideCharToMultiByte(CP_UTF8, 0, user, -1, mbuser, 256, NULL, NULL);
@@ -191,7 +191,7 @@ StringList *SSHSession::execute(const TCHAR *command)
                curr = eol + 1;
                eol = strchr(curr, '\n');
             }
-            offset = strlen(curr);
+            offset = (int)strlen(curr);
             if (offset > 0)
                memmove(buffer, curr, offset);
             nbytes = ssh_channel_read(channel, &buffer[offset], sizeof(buffer) - offset - 1, 0);