Commit 855be2f8bffc66355ee2304f9fd90a30d4a6008a

Authored by Perry Werneck
1 parent 88311f50

Fixing location of cert files in windows version.

Showing 1 changed file with 27 additions and 0 deletions   Show diff stats
src/lib3270/ssl/ctx_init.c
... ... @@ -103,6 +103,33 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message)
103 103  
104 104 SSL_CTX_set_default_verify_paths(ssl_ctx);
105 105  
  106 +#ifdef _WIN32
  107 + {
  108 + lib3270_autoptr(char) certpath = lib3270_build_data_filename("certs");
  109 +
  110 + if(SSL_CTX_load_verify_locations(ssl_ctx,NULL,certpath))
  111 + {
  112 + trace_ssl(hSession,"Searching certs from \"%s\".\n", certpath);
  113 + }
  114 + else
  115 + {
  116 + int ssl_error = ERR_get_error();
  117 +
  118 + lib3270_autoptr(char) message = lib3270_strdup_printf( _( "Can't read SSL certificates from \"%s\"" ), certpath);
  119 +
  120 + lib3270_popup_dialog(
  121 + hSession,
  122 + LIB3270_NOTIFY_ERROR,
  123 + N_( "Security error" ),
  124 + message,
  125 + "%s", ERR_lib_error_string(ssl_error)
  126 + );
  127 +
  128 + }
  129 +
  130 + }
  131 +#endif // _WIN32
  132 +
106 133 ssl_3270_ex_index = SSL_get_ex_new_index(0,NULL,NULL,NULL,NULL);
107 134  
108 135 #ifdef SSL_ENABLE_CRL_CHECK
... ...