Commit 82efb83295af6712b5fdbf0ecb6ddee0c8a12b21

Authored by Perry Werneck
1 parent 70dea602

Working on LDAP support for windows.

lib3270.cbp
... ... @@ -139,15 +139,15 @@
139 139 <Unit filename="src/lib3270/ft_dft.c">
140 140 <Option compilerVar="CC" />
141 141 </Unit>
142   - <Unit filename="src/lib3270/glue.c">
143   - <Option compilerVar="CC" />
144   - </Unit>
145 142 <Unit filename="src/lib3270/host.c">
146 143 <Option compilerVar="CC" />
147 144 </Unit>
148 145 <Unit filename="src/lib3270/html.c">
149 146 <Option compilerVar="CC" />
150 147 </Unit>
  148 + <Unit filename="src/lib3270/init.c">
  149 + <Option compilerVar="CC" />
  150 + </Unit>
151 151 <Unit filename="src/lib3270/iocalls.c">
152 152 <Option compilerVar="CC" />
153 153 </Unit>
... ...
src/lib3270/linux/connect.c
... ... @@ -246,7 +246,10 @@ static void net_connected(H3270 *hSession, int fd unused, LIB3270_IO_FLAG flag u
246 246 if(hSession->ssl.enabled)
247 247 {
248 248 hSession->ssl.host = 1;
249   - ssl_init(hSession);
  249 +
  250 + if(ssl_init(hSession))
  251 + return errno = ENOTCONN;
  252 +
250 253 }
251 254 debug("** SSL init %s","ends");
252 255 #endif // HAVE_LIBSSL
... ...
src/lib3270/ssl/negotiate.c
... ... @@ -18,14 +18,12 @@
18 18 * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
19 19 * St, Fifth Floor, Boston, MA 02110-1301 USA
20 20 *
21   - * Este programa está nomeado como ssl.c e possui - linhas de código.
  21 + * Este programa está nomeado como - e possui - linhas de código.
22 22 *
23 23 * Contatos:
24 24 *
25 25 * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26 26 * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
27   - * licinio@bb.com.br (Licínio Luis Branco)
28   - * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
29 27 *
30 28 *
31 29 * References:
... ...
src/lib3270/ssl/windows/getcrl.c
... ... @@ -79,6 +79,7 @@ typedef struct _curldata
79 79 {
80 80 size_t length;
81 81 SSL_ERROR_MESSAGE * message;
  82 + char errbuf[CURL_ERROR_SIZE];
82 83 unsigned char contents[CRL_DATA_LENGTH];
83 84 } CURLDATA;
84 85  
... ... @@ -188,6 +189,8 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
188 189 curl_easy_setopt(hCurl, CURLOPT_URL, consturl);
189 190 curl_easy_setopt(hCurl, CURLOPT_FOLLOWLOCATION, 1L);
190 191  
  192 + curl_easy_setopt(hCurl, CURLOPT_ERRORBUFFER, crl_data);
  193 +
191 194 curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, internal_curl_write_callback);
192 195 curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, (void *) crl_data);
193 196  
... ... @@ -197,8 +200,18 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
197 200 {
198 201 message->error = hSession->ssl.error = 0;
199 202 message->title = N_( "Security error" );
200   - message->text = N_( "Error loading CRL" );
201   - message->description = curl_easy_strerror(res);
  203 +
  204 + if(crl_data->errbuf[0])
  205 + {
  206 + message->text = curl_easy_strerror(res);
  207 + message->description = crl_data->errbuf;
  208 + }
  209 + else
  210 + {
  211 + message->text = N_( "Error loading CRL" );
  212 + message->description = curl_easy_strerror(res);
  213 + }
  214 +
202 215 lib3270_write_log(hSession,"ssl","%s: %s",consturl, message->description);
203 216 return NULL;
204 217 }
... ...
src/lib3270/windows/connect.c
... ... @@ -249,14 +249,11 @@ int lib3270_reconnect(H3270 *hSession, int seconds)
249 249  
250 250 lib3270_st_changed(hSession, LIB3270_STATE_RESOLVING, True);
251 251  
252   - // s = getaddrinfo(hSession->host.current, hSession->host.srvc, &hints, &result);
253 252 if(lib3270_run_task(hSession, background_connect, &host) || hSession->sock < 0)
254 253 {
255   - char buffer[4096];
256   - char msg[4096];
257   -
258   - snprintf(buffer,4095,_( "Can't connect to %s"), lib3270_get_url(hSession));
  254 + lib3270_autoptr(char) message = lib3270_strdup_printf(_( "Can't connect to %s"), lib3270_get_url(hSession));
259 255  
  256 + char msg[4096];
260 257 strncpy(msg,host.message,4095);
261 258  
262 259 #ifdef HAVE_ICONV
... ... @@ -283,7 +280,7 @@ int lib3270_reconnect(H3270 *hSession, int seconds)
283 280 lib3270_popup_dialog( hSession,
284 281 LIB3270_NOTIFY_ERROR,
285 282 _( "Connection error" ),
286   - buffer,
  283 + message,
287 284 "%s",
288 285 msg);
289 286  
... ... @@ -298,7 +295,9 @@ int lib3270_reconnect(H3270 *hSession, int seconds)
298 295 if(hSession->ssl.enabled)
299 296 {
300 297 hSession->ssl.host = 1;
301   - ssl_init(hSession);
  298 + if(ssl_init(hSession))
  299 + return errno = ENOTCONN;
  300 +
302 301 }
303 302 #endif // HAVE_LIBSSL
304 303  
... ...