Commit 8c67f1c87a6ea87d63b20ecec17ce61fca268579

Authored by perry.werneck@gmail.com
1 parent 6729bbcc

Incluindo diretório para certificados CA no windows

Showing 1 changed file with 26 additions and 0 deletions   Show diff stats
telnet.c
... ... @@ -3101,8 +3101,34 @@ static void ssl_init(H3270 *session)
3101 3101 SSL_CTX_set_info_callback(ssl_ctx, ssl_info_callback);
3102 3102 SSL_CTX_set_default_verify_paths(ssl_ctx);
3103 3103  
  3104 +#if defined(_WIN32)
  3105 + {
  3106 + HKEY hKey = 0;
  3107 +
  3108 + if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,"Software\\" PACKAGE_NAME,0,KEY_QUERY_VALUE,&hKey) == ERROR_SUCCESS)
  3109 + {
  3110 + char data[4096];
  3111 + unsigned long datalen = sizeof(data); // data field length(in), data returned length(out)
  3112 + unsigned long datatype; // #defined in winnt.h (predefined types 0-11)
  3113 +
  3114 + if(RegQueryValueExA(hKey,"datadir",NULL,&datatype,(LPBYTE) data,&datalen) == ERROR_SUCCESS)
  3115 + {
  3116 + strncat(data,"\\certs",4095);
  3117 +
  3118 + trace("Loading certs from \"%s\"",data);
  3119 + SSL_CTX_load_verify_locations(ssl_ctx,NULL,data);
  3120 + }
  3121 + RegCloseKey(hKey);
  3122 + }
  3123 +
  3124 +
  3125 + }
  3126 +
  3127 +#endif // _WIN32
  3128 +
3104 3129 ssl_3270_ex_index = SSL_get_ex_new_index(0,NULL,NULL,NULL,NULL);
3105 3130  
  3131 +
3106 3132 }
3107 3133  
3108 3134 if(session->ssl_con)
... ...