Commit 82efb83295af6712b5fdbf0ecb6ddee0c8a12b21
1 parent
70dea602
Exists in
master
and in
3 other branches
Working on LDAP support for windows.
Showing
5 changed files
with
29 additions
and
16 deletions
Show diff stats
lib3270.cbp
| @@ -139,15 +139,15 @@ | @@ -139,15 +139,15 @@ | ||
| 139 | <Unit filename="src/lib3270/ft_dft.c"> | 139 | <Unit filename="src/lib3270/ft_dft.c"> |
| 140 | <Option compilerVar="CC" /> | 140 | <Option compilerVar="CC" /> |
| 141 | </Unit> | 141 | </Unit> |
| 142 | - <Unit filename="src/lib3270/glue.c"> | ||
| 143 | - <Option compilerVar="CC" /> | ||
| 144 | - </Unit> | ||
| 145 | <Unit filename="src/lib3270/host.c"> | 142 | <Unit filename="src/lib3270/host.c"> |
| 146 | <Option compilerVar="CC" /> | 143 | <Option compilerVar="CC" /> |
| 147 | </Unit> | 144 | </Unit> |
| 148 | <Unit filename="src/lib3270/html.c"> | 145 | <Unit filename="src/lib3270/html.c"> |
| 149 | <Option compilerVar="CC" /> | 146 | <Option compilerVar="CC" /> |
| 150 | </Unit> | 147 | </Unit> |
| 148 | + <Unit filename="src/lib3270/init.c"> | ||
| 149 | + <Option compilerVar="CC" /> | ||
| 150 | + </Unit> | ||
| 151 | <Unit filename="src/lib3270/iocalls.c"> | 151 | <Unit filename="src/lib3270/iocalls.c"> |
| 152 | <Option compilerVar="CC" /> | 152 | <Option compilerVar="CC" /> |
| 153 | </Unit> | 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,7 +246,10 @@ static void net_connected(H3270 *hSession, int fd unused, LIB3270_IO_FLAG flag u | ||
| 246 | if(hSession->ssl.enabled) | 246 | if(hSession->ssl.enabled) |
| 247 | { | 247 | { |
| 248 | hSession->ssl.host = 1; | 248 | hSession->ssl.host = 1; |
| 249 | - ssl_init(hSession); | 249 | + |
| 250 | + if(ssl_init(hSession)) | ||
| 251 | + return errno = ENOTCONN; | ||
| 252 | + | ||
| 250 | } | 253 | } |
| 251 | debug("** SSL init %s","ends"); | 254 | debug("** SSL init %s","ends"); |
| 252 | #endif // HAVE_LIBSSL | 255 | #endif // HAVE_LIBSSL |
src/lib3270/ssl/negotiate.c
| @@ -18,14 +18,12 @@ | @@ -18,14 +18,12 @@ | ||
| 18 | * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | 18 | * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin |
| 19 | * St, Fifth Floor, Boston, MA 02110-1301 USA | 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 | * Contatos: | 23 | * Contatos: |
| 24 | * | 24 | * |
| 25 | * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | 25 | * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) |
| 26 | * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | 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 | * References: | 29 | * References: |
src/lib3270/ssl/windows/getcrl.c
| @@ -79,6 +79,7 @@ typedef struct _curldata | @@ -79,6 +79,7 @@ typedef struct _curldata | ||
| 79 | { | 79 | { |
| 80 | size_t length; | 80 | size_t length; |
| 81 | SSL_ERROR_MESSAGE * message; | 81 | SSL_ERROR_MESSAGE * message; |
| 82 | + char errbuf[CURL_ERROR_SIZE]; | ||
| 82 | unsigned char contents[CRL_DATA_LENGTH]; | 83 | unsigned char contents[CRL_DATA_LENGTH]; |
| 83 | } CURLDATA; | 84 | } CURLDATA; |
| 84 | 85 | ||
| @@ -188,6 +189,8 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) | @@ -188,6 +189,8 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) | ||
| 188 | curl_easy_setopt(hCurl, CURLOPT_URL, consturl); | 189 | curl_easy_setopt(hCurl, CURLOPT_URL, consturl); |
| 189 | curl_easy_setopt(hCurl, CURLOPT_FOLLOWLOCATION, 1L); | 190 | curl_easy_setopt(hCurl, CURLOPT_FOLLOWLOCATION, 1L); |
| 190 | 191 | ||
| 192 | + curl_easy_setopt(hCurl, CURLOPT_ERRORBUFFER, crl_data); | ||
| 193 | + | ||
| 191 | curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, internal_curl_write_callback); | 194 | curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, internal_curl_write_callback); |
| 192 | curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, (void *) crl_data); | 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,8 +200,18 @@ X509_CRL * lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) | ||
| 197 | { | 200 | { |
| 198 | message->error = hSession->ssl.error = 0; | 201 | message->error = hSession->ssl.error = 0; |
| 199 | message->title = N_( "Security error" ); | 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 | lib3270_write_log(hSession,"ssl","%s: %s",consturl, message->description); | 215 | lib3270_write_log(hSession,"ssl","%s: %s",consturl, message->description); |
| 203 | return NULL; | 216 | return NULL; |
| 204 | } | 217 | } |
src/lib3270/windows/connect.c
| @@ -249,14 +249,11 @@ int lib3270_reconnect(H3270 *hSession, int seconds) | @@ -249,14 +249,11 @@ int lib3270_reconnect(H3270 *hSession, int seconds) | ||
| 249 | 249 | ||
| 250 | lib3270_st_changed(hSession, LIB3270_STATE_RESOLVING, True); | 250 | lib3270_st_changed(hSession, LIB3270_STATE_RESOLVING, True); |
| 251 | 251 | ||
| 252 | - // s = getaddrinfo(hSession->host.current, hSession->host.srvc, &hints, &result); | ||
| 253 | if(lib3270_run_task(hSession, background_connect, &host) || hSession->sock < 0) | 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 | strncpy(msg,host.message,4095); | 257 | strncpy(msg,host.message,4095); |
| 261 | 258 | ||
| 262 | #ifdef HAVE_ICONV | 259 | #ifdef HAVE_ICONV |
| @@ -283,7 +280,7 @@ int lib3270_reconnect(H3270 *hSession, int seconds) | @@ -283,7 +280,7 @@ int lib3270_reconnect(H3270 *hSession, int seconds) | ||
| 283 | lib3270_popup_dialog( hSession, | 280 | lib3270_popup_dialog( hSession, |
| 284 | LIB3270_NOTIFY_ERROR, | 281 | LIB3270_NOTIFY_ERROR, |
| 285 | _( "Connection error" ), | 282 | _( "Connection error" ), |
| 286 | - buffer, | 283 | + message, |
| 287 | "%s", | 284 | "%s", |
| 288 | msg); | 285 | msg); |
| 289 | 286 | ||
| @@ -298,7 +295,9 @@ int lib3270_reconnect(H3270 *hSession, int seconds) | @@ -298,7 +295,9 @@ int lib3270_reconnect(H3270 *hSession, int seconds) | ||
| 298 | if(hSession->ssl.enabled) | 295 | if(hSession->ssl.enabled) |
| 299 | { | 296 | { |
| 300 | hSession->ssl.host = 1; | 297 | hSession->ssl.host = 1; |
| 301 | - ssl_init(hSession); | 298 | + if(ssl_init(hSession)) |
| 299 | + return errno = ENOTCONN; | ||
| 300 | + | ||
| 302 | } | 301 | } |
| 303 | #endif // HAVE_LIBSSL | 302 | #endif // HAVE_LIBSSL |
| 304 | 303 |