Commit 0021b0f26ac10d1575a3673a977d13a65bfc3d76

Authored by Perry Werneck
1 parent 450519ce

Updating windows connect method.

Showing 1 changed file with 9 additions and 13 deletions   Show diff stats
src/lib3270/windows/connect.c
@@ -307,9 +307,14 @@ int lib3270_reconnect(H3270 *hSession, int seconds) @@ -307,9 +307,14 @@ int lib3270_reconnect(H3270 *hSession, int seconds)
307 { 307 {
308 char * ptr = msg; 308 char * ptr = msg;
309 size_t out = 4096; 309 size_t out = 4096;
  310 + size_t in = strlen(host.message);
310 311
311 iconv_t hConv = iconv_open(lib3270_win32_local_charset(),"UTF-8"); 312 iconv_t hConv = iconv_open(lib3270_win32_local_charset(),"UTF-8");
312 - if(iconv(hConv,&host.message,&msg,&ptr,&out) == ((size_t) -1)) 313 + if(iconv(
  314 + hConv,
  315 + &host.message,&in,
  316 + &ptr,&out
  317 + ) == ((size_t) -1))
313 { 318 {
314 strncpy(msg,host.message,4095); 319 strncpy(msg,host.message,4095);
315 } 320 }
@@ -332,22 +337,13 @@ int lib3270_reconnect(H3270 *hSession, int seconds) @@ -332,22 +337,13 @@ int lib3270_reconnect(H3270 *hSession, int seconds)
332 hSession->ever_3270 = False; 337 hSession->ever_3270 = False;
333 hSession->ssl.host = 0; 338 hSession->ssl.host = 0;
334 339
335 - if(hSession->options&LIB3270_HOST_TYPE_SSL)  
336 - {  
337 #if defined(HAVE_LIBSSL) 340 #if defined(HAVE_LIBSSL)
  341 + if(hSession->ssl.enabled)
  342 + {
338 hSession->ssl.host = 1; 343 hSession->ssl.host = 1;
339 ssl_init(hSession); 344 ssl_init(hSession);
340 -#else  
341 - lib3270_popup_dialog( hSession,  
342 - LIB3270_NOTIFY_ERROR,  
343 - _( "SSL error" ),  
344 - _( "Unable to connect to secure hosts" ),  
345 - _( "This version of %s was built without support for secure sockets layer (SSL)." ),  
346 - PACKAGE_NAME);  
347 -  
348 - return errno = EINVAL;  
349 -#endif // HAVE_LIBSSL  
350 } 345 }
  346 +#endif // HAVE_LIBSSL
351 347
352 /* connect */ 348 /* connect */
353 349