Commit 4c492af79d123d8c5d82779ed58f84888fe19e58
1 parent
f42e13da
Exists in
master
and in
3 other branches
Fixing thread issue on custom certificate loading.
Showing
1 changed file
with
13 additions
and
43 deletions
Show diff stats
src/ssl/windows/init.c
... | ... | @@ -107,37 +107,23 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message) |
107 | 107 | |
108 | 108 | if(hFind == INVALID_HANDLE_VALUE) |
109 | 109 | { |
110 | - lib3270_autoptr(char) message = lib3270_strdup_printf( _( "Can't read SSL certificates from \"%s\"" ), certpath); | |
111 | - | |
112 | - lib3270_popup_dialog( | |
113 | - hSession, | |
114 | - LIB3270_NOTIFY_ERROR, | |
115 | - N_( "Security error" ), | |
116 | - message, | |
117 | - _("The windows error code was %d"), (int) GetLastError() | |
118 | - ); | |
110 | + message->title = N_( "Security error" ); | |
111 | + message->text = N_( "Cant open custom certificate directory." ); | |
119 | 112 | |
113 | + trace_ssl(hSession, _( "Can't open \"%s\" (The Windows error code was %ld)" ), certpath, (long) GetLastError()); | |
120 | 114 | } |
121 | 115 | else |
122 | 116 | { |
123 | 117 | do |
124 | 118 | { |
125 | - char * filename = lib3270_build_data_filename("certs",ffd.cFileName,NULL); | |
119 | + char * filename = lib3270_build_data_filename("certs", ffd.cFileName, NULL); | |
126 | 120 | |
127 | 121 | debug("Loading \"%s\"",filename); |
128 | 122 | |
129 | 123 | FILE *fp = fopen(filename,"r"); |
130 | 124 | if(!fp) { |
131 | 125 | |
132 | - lib3270_autoptr(char) message = lib3270_strdup_printf( _( "Can't open \"%s\"" ), filename); | |
133 | - | |
134 | - lib3270_popup_dialog( | |
135 | - hSession, | |
136 | - LIB3270_NOTIFY_ERROR, | |
137 | - N_( "Security error" ), | |
138 | - message, | |
139 | - "%s", strerror(errno) | |
140 | - ); | |
126 | + trace_ssl(hSession, _( "Can't open \"%s\": %s" ), filename, strerror(errno)); | |
141 | 127 | |
142 | 128 | } |
143 | 129 | else |
... | ... | @@ -146,36 +132,22 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message) |
146 | 132 | |
147 | 133 | if(!cert) |
148 | 134 | { |
149 | - int ssl_error = ERR_get_error(); | |
150 | - | |
151 | - lib3270_autoptr(char) message = lib3270_strdup_printf( _( "Can't read \"%s\"" ), filename); | |
152 | - | |
153 | - lib3270_popup_dialog( | |
154 | - hSession, | |
155 | - LIB3270_NOTIFY_ERROR, | |
156 | - N_( "Security error" ), | |
157 | - message, | |
158 | - "%s", ERR_lib_error_string(ssl_error) | |
159 | - ); | |
135 | + message->error = hSession->ssl.error = ERR_get_error(); | |
136 | + message->title = N_( "Security error" ); | |
137 | + message->text = N_( "Cant read custom certificate file." ); | |
160 | 138 | |
139 | + trace_ssl(hSession, _( "Can't read \"%s\": %s" ), filename, ERR_lib_error_string(hSession->ssl.error)); | |
161 | 140 | } |
162 | 141 | else |
163 | 142 | { |
164 | - trace_ssl(hSession,"Loading %s\n",filename); | |
165 | 143 | |
166 | 144 | if(X509_STORE_add_cert(store, cert) != 1) |
167 | 145 | { |
168 | - int ssl_error = ERR_get_error(); | |
169 | - | |
170 | - lib3270_autoptr(char) message = lib3270_strdup_printf( _( "Can't load \"%s\"" ), filename); | |
146 | + message->error = hSession->ssl.error = ERR_get_error(); | |
147 | + message->title = N_( "Security error" ); | |
148 | + message->text = N_( "Cant load custom certificate file." ); | |
171 | 149 | |
172 | - lib3270_popup_dialog( | |
173 | - hSession, | |
174 | - LIB3270_NOTIFY_ERROR, | |
175 | - N_( "Security error" ), | |
176 | - message, | |
177 | - "%s", ERR_lib_error_string(ssl_error) | |
178 | - ); | |
150 | + trace_ssl(hSession, _( "Can't load \"%s\": %s" ), filename, ERR_lib_error_string(hSession->ssl.error)); | |
179 | 151 | } |
180 | 152 | |
181 | 153 | X509_free(cert); |
... | ... | @@ -191,8 +163,6 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message) |
191 | 163 | |
192 | 164 | } |
193 | 165 | |
194 | - // lib3270_build_lib3270_strdup_printf("%s\\certs",appdir); | |
195 | - | |
196 | 166 | ssl_3270_ex_index = SSL_get_ex_new_index(0,NULL,NULL,NULL,NULL); |
197 | 167 | |
198 | 168 | #ifdef SSL_ENABLE_CRL_CHECK | ... | ... |