/**
* Configuration options
*/
+UINT32 g_sshConnectTimeout = 2000;
UINT32 g_sshSessionIdleTimeout = 300;
-/**
- * Configuration file template
- */
-static NX_CFG_TEMPLATE m_cfgTemplate[] =
-{
- { _T("SessionIdleTimeout"), CT_LONG, 0, 0, 0, 0, &g_sshSessionIdleTimeout },
- { _T(""), CT_END_OF_LIST, 0, 0, 0, 0, NULL }
-};
-
#if defined(_WIN32) || _USE_GNU_PTH
/**
#endif
+/**
+ * Configuration file template
+ */
+static NX_CFG_TEMPLATE s_cfgTemplate[] =
+{
+ { _T("ConnectTimeout"), CT_LONG, 0, 0, 0, 0, &g_sshConnectTimeout },
+ { _T("SessionIdleTimeout"), CT_LONG, 0, 0, 0, 0, &g_sshSessionIdleTimeout },
+ { _T(""), CT_END_OF_LIST, 0, 0, 0, 0, NULL }
+};
+
/**
* Subagent initialization
*/
static BOOL SubagentInit(Config *config)
{
+ if (!config->parseTemplate(_T("SSH"), s_cfgTemplate))
+ return FALSE;
+
#if !defined(_WIN32) && !_USE_GNU_PTH
ssh_threads_set_callbacks(ssh_threads_get_noop());
#else
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);