Commit bd2755c8166ca3d138002ae1cbdc7bae4c65cda1
1 parent
0b2a74c3
Exists in
master
and in
5 other branches
Ajustes para compilar sem a openSSL
Showing
5 changed files
with
15 additions
and
295 deletions
Show diff stats
src/lib3270/connect.c
| ... | ... | @@ -245,7 +245,10 @@ static void net_connected(H3270 *hSession) |
| 245 | 245 | sockstart(hSession); |
| 246 | 246 | #endif |
| 247 | 247 | |
| 248 | +#if defined(HAVE_LIBSSL) | |
| 248 | 249 | set_ssl_state(hSession,LIB3270_SSL_UNSECURE); |
| 250 | +#endif // HAVE_LIBSSL | |
| 251 | + | |
| 249 | 252 | snprintf(hSession->full_model_name,LIB3270_FULL_MODEL_NAME_LENGTH,"IBM-327%c-%d",hSession->m3279 ? '9' : '8', hSession->model_num); |
| 250 | 253 | |
| 251 | 254 | |
| ... | ... | @@ -331,7 +334,7 @@ static void net_connected(H3270 *hSession) |
| 331 | 334 | _( "SSL error" ), |
| 332 | 335 | _( "Unable to connect to secure hosts" ), |
| 333 | 336 | _( "This version of %s was built without support for secure sockets layer (SSL)." ), |
| 334 | - PACKAGE_NAME)); | |
| 337 | + PACKAGE_NAME); | |
| 335 | 338 | |
| 336 | 339 | return EINVAL; |
| 337 | 340 | #endif // HAVE_LIBSSL | ... | ... |
src/lib3270/host.c
| ... | ... | @@ -61,300 +61,6 @@ |
| 61 | 61 | static void try_reconnect(H3270 *session); |
| 62 | 62 | |
| 63 | 63 | /* |
| 64 | - * Strip qualifiers from a hostname. | |
| 65 | - * Returns the hostname part in a newly-malloc'd string. | |
| 66 | - * 'needed' is returned True if anything was actually stripped. | |
| 67 | - * Returns NULL if there is a syntax error. | |
| 68 | - */ /* | |
| 69 | -static char * | |
| 70 | -split_host(H3270 *hSession, char *s, char *ansi, char *std_ds, char *passthru, | |
| 71 | - char *non_e, char *secure, char *no_login, char *xluname, | |
| 72 | - char **port, char *needed) | |
| 73 | -{ | |
| 74 | - char *lbracket = CN; | |
| 75 | - char *at = CN; | |
| 76 | - char *r = NULL; | |
| 77 | - char colon = False; | |
| 78 | - | |
| 79 | - *ansi = False; | |
| 80 | - *std_ds = False; | |
| 81 | - *passthru = False; | |
| 82 | - *non_e = False; | |
| 83 | - *secure = False; | |
| 84 | - *xluname = '\0'; | |
| 85 | - *port = CN; | |
| 86 | - | |
| 87 | - *needed = False; | |
| 88 | - | |
| 89 | - // | |
| 90 | - // Hostname syntax is: | |
| 91 | - // Zero or more optional prefixes (A:, S:, P:, N:, L:, C:). | |
| 92 | - // An optional LU name separated by '@'. | |
| 93 | - // A hostname optionally in square brackets (which quote any colons | |
| 94 | - // in the name). | |
| 95 | - // An optional port name or number separated from the hostname by a | |
| 96 | - // space or colon. | |
| 97 | - // No additional white space or colons are allowed. | |
| 98 | - // | |
| 99 | - | |
| 100 | - // Strip leading whitespace. | |
| 101 | - while (*s && isspace(*s)) | |
| 102 | - s++; | |
| 103 | - | |
| 104 | - if (!*s) | |
| 105 | - { | |
| 106 | - popup_an_error(hSession,_( "Empty hostname" )); | |
| 107 | - goto split_fail; | |
| 108 | - } | |
| 109 | - | |
| 110 | - // Strip trailing whitespace. | |
| 111 | - while (isspace(*(s + strlen(s) - 1))) | |
| 112 | - *(s + strlen(s) - 1) = '\0'; | |
| 113 | - | |
| 114 | - // Start with the prefixes. | |
| 115 | - while (*s && *(s + 1) && isalpha(*s) && *(s + 1) == ':') { | |
| 116 | - switch (*s) { | |
| 117 | - case 'a': | |
| 118 | - case 'A': | |
| 119 | - *ansi = True; | |
| 120 | - break; | |
| 121 | - case 's': | |
| 122 | - case 'S': | |
| 123 | - *std_ds = True; | |
| 124 | - break; | |
| 125 | - case 'p': | |
| 126 | - case 'P': | |
| 127 | - *passthru = True; | |
| 128 | - break; | |
| 129 | - case 'n': | |
| 130 | - case 'N': | |
| 131 | - *non_e = True; | |
| 132 | - break; | |
| 133 | -#if defined(HAVE_LIBSSL) | |
| 134 | - case 'l': | |
| 135 | - case 'L': | |
| 136 | - *secure = True; | |
| 137 | - break; | |
| 138 | -#else | |
| 139 | - case 'l': | |
| 140 | - case 'L': | |
| 141 | - popup_system_error(hSession, _( "SSL error" ), | |
| 142 | - _( "Unable to connect to secure hosts" ), | |
| 143 | - _( "This version of %s was built without support for secure sockets layer (SSL)." ), | |
| 144 | - PACKAGE_NAME | |
| 145 | - ); | |
| 146 | - | |
| 147 | - goto split_fail; | |
| 148 | -#endif // HAVE_LIBSSL | |
| 149 | - case 'c': | |
| 150 | - case 'C': | |
| 151 | - *no_login = True; | |
| 152 | - break; | |
| 153 | - default: | |
| 154 | - popup_system_error(hSession, _( "Hostname syntax error" ), | |
| 155 | - _( "Can't connect to host" ), | |
| 156 | - _( "Option '%c:' is not supported" ), | |
| 157 | - *s ); | |
| 158 | - | |
| 159 | - goto split_fail; | |
| 160 | - } | |
| 161 | - *needed = True; | |
| 162 | - s += 2; | |
| 163 | - | |
| 164 | - // Allow whitespace around the prefixes. | |
| 165 | - while (*s && isspace(*s)) | |
| 166 | - s++; | |
| 167 | - } | |
| 168 | - | |
| 169 | - // Process the LU name. | |
| 170 | - lbracket = strchr(s, '['); | |
| 171 | - at = strchr(s, '@'); | |
| 172 | - if (at != CN && lbracket != CN && at > lbracket) | |
| 173 | - at = CN; | |
| 174 | - if (at != CN) { | |
| 175 | - char *t; | |
| 176 | - char *lu_last = at - 1; | |
| 177 | - | |
| 178 | - if (at == s) { | |
| 179 | - popup_system_error(hSession,NULL,_("Hostname syntax error"),"%s",_("Empty LU name")); | |
| 180 | - goto split_fail; | |
| 181 | - } | |
| 182 | - while (lu_last < s && isspace(*lu_last)) | |
| 183 | - lu_last--; | |
| 184 | - for (t = s; t <= lu_last; t++) { | |
| 185 | - if (isspace(*t)) { | |
| 186 | - char *u = t + 1; | |
| 187 | - | |
| 188 | - while (isspace(*u)) | |
| 189 | - u++; | |
| 190 | - if (*u != '@') { | |
| 191 | - popup_system_error(hSession,NULL,_("Hostname syntax error"),"%s",_("Space in LU name")); | |
| 192 | - goto split_fail; | |
| 193 | - } | |
| 194 | - break; | |
| 195 | - } | |
| 196 | - if (t - s < LIB3270_LUNAME_LENGTH) { | |
| 197 | - xluname[t - s] = *t; | |
| 198 | - } | |
| 199 | - } | |
| 200 | - xluname[t - s] = '\0'; | |
| 201 | - s = at + 1; | |
| 202 | - while (*s && isspace(*s)) | |
| 203 | - s++; | |
| 204 | - *needed = True; | |
| 205 | - } | |
| 206 | - | |
| 207 | - // | |
| 208 | - // Isolate the hostname. | |
| 209 | - // At this point, we've found its start, so we can malloc the buffer | |
| 210 | - // that will hold the copy. | |
| 211 | - /// | |
| 212 | - if (lbracket != CN) { | |
| 213 | - char *rbracket; | |
| 214 | - | |
| 215 | - // Check for junk before the '['. | |
| 216 | - if (lbracket != s) { | |
| 217 | - popup_system_error(hSession,NULL,_("Hostname syntax error"),"%s",_("Text before '['")); | |
| 218 | - goto split_fail; | |
| 219 | - } | |
| 220 | - | |
| 221 | - s = r = NewString(lbracket + 1); | |
| 222 | - | |
| 223 | - // | |
| 224 | - // Take whatever is inside square brackets, including | |
| 225 | - // whitespace, unmodified -- except for empty strings. | |
| 226 | - // | |
| 227 | - rbracket = strchr(s, ']'); | |
| 228 | - if (rbracket == CN) { | |
| 229 | - popup_system_error(hSession,NULL,_("Hostname syntax error"),"%s",_("Missing ']'")); | |
| 230 | - goto split_fail; | |
| 231 | - } | |
| 232 | - if (rbracket == s) { | |
| 233 | - popup_system_error(hSession,NULL,_("Hostname syntax error"),"%s",_("Empty hostname")); | |
| 234 | - goto split_fail; | |
| 235 | - } | |
| 236 | - *rbracket = '\0'; | |
| 237 | - | |
| 238 | - // Skip over any whitespace after the bracketed name. | |
| 239 | - s = rbracket + 1; | |
| 240 | - while (*s && isspace(*s)) | |
| 241 | - s++; | |
| 242 | - if (!*s) | |
| 243 | - goto split_success; | |
| 244 | - colon = (*s == ':'); | |
| 245 | - } else { | |
| 246 | - char *name_end; | |
| 247 | - | |
| 248 | - // Check for an empty string. | |
| 249 | - if (!*s || *s == ':') { | |
| 250 | - popup_an_error(hSession,"Empty hostname"); | |
| 251 | - goto split_fail; | |
| 252 | - } | |
| 253 | - | |
| 254 | - s = r = NewString(s); | |
| 255 | - | |
| 256 | - // Find the end of the hostname. | |
| 257 | - while (*s && !isspace(*s) && *s != ':') | |
| 258 | - s++; | |
| 259 | - name_end = s; | |
| 260 | - | |
| 261 | - // If the terminator is whitespace, skip the rest of it. | |
| 262 | - while (*s && isspace(*s)) | |
| 263 | - s++; | |
| 264 | - | |
| 265 | - // | |
| 266 | - // If there's nothing but whitespace (or nothing) after the | |
| 267 | - // name, we're done. | |
| 268 | - // | |
| 269 | - if (*s == '\0') { | |
| 270 | - *name_end = '\0'; | |
| 271 | - goto split_success; | |
| 272 | - } | |
| 273 | - colon = (*s == ':'); | |
| 274 | - *name_end = '\0'; | |
| 275 | - } | |
| 276 | - | |
| 277 | - // | |
| 278 | - // If 'colon' is set, 's' points at it (or where it was). Skip | |
| 279 | - // it and any whitespace that follows. | |
| 280 | - // | |
| 281 | - if (colon) { | |
| 282 | - s++; | |
| 283 | - while (*s && isspace(*s)) | |
| 284 | - s++; | |
| 285 | - if (!*s) { | |
| 286 | - popup_system_error(hSession,NULL,_("Hostname syntax error"),"%s",_("Empty port name")); | |
| 287 | - goto split_fail; | |
| 288 | - } | |
| 289 | - } | |
| 290 | - | |
| 291 | - // | |
| 292 | - // Set the portname and find its end. | |
| 293 | - // Note that trailing spaces were already stripped, so the end of the | |
| 294 | - // portname must be a NULL. | |
| 295 | - // | |
| 296 | - *port = s; | |
| 297 | - *needed = True; | |
| 298 | - while (*s && !isspace(*s) && *s != ':') | |
| 299 | - s++; | |
| 300 | - if (*s != '\0') { | |
| 301 | - popup_system_error(hSession,NULL,_("Hostname syntax error"),"%s",_("Multiple port names")); | |
| 302 | - goto split_fail; | |
| 303 | - } | |
| 304 | - goto split_success; | |
| 305 | - | |
| 306 | -split_fail: | |
| 307 | - lib3270_free(r); | |
| 308 | - r = CN; | |
| 309 | - | |
| 310 | -split_success: | |
| 311 | - return r; | |
| 312 | -} | |
| 313 | -*/ | |
| 314 | - | |
| 315 | -/* | |
| 316 | -int lib3270_connect(H3270 *hSession, int wait) | |
| 317 | -{ | |
| 318 | - int rc; | |
| 319 | - | |
| 320 | - CHECK_SESSION_HANDLE(hSession); | |
| 321 | - | |
| 322 | - lib3270_main_iterate(hSession,0); | |
| 323 | - | |
| 324 | - if (CONNECTED || HALF_CONNECTED) | |
| 325 | - return EBUSY; | |
| 326 | - | |
| 327 | - if(!hSession->host.full) | |
| 328 | - return EINVAL; | |
| 329 | - | |
| 330 | - if (hSession->auto_reconnect_inprogress) | |
| 331 | - return EBUSY; | |
| 332 | - | |
| 333 | - if(PCONNECTED) | |
| 334 | - return EBUSY; | |
| 335 | - | |
| 336 | - rc = do_connect(hSession); | |
| 337 | - if(rc) | |
| 338 | - return rc; | |
| 339 | - | |
| 340 | - if(wait) | |
| 341 | - { | |
| 342 | - while(!IN_ANSI && !IN_3270) | |
| 343 | - { | |
| 344 | - lib3270_main_iterate(hSession,1); | |
| 345 | - | |
| 346 | - if(!PCONNECTED) | |
| 347 | - { | |
| 348 | - return ENOTCONN; | |
| 349 | - } | |
| 350 | - } | |
| 351 | - } | |
| 352 | - | |
| 353 | - return rc; | |
| 354 | -} | |
| 355 | -*/ | |
| 356 | - | |
| 357 | -/* | |
| 358 | 64 | * Called from timer to attempt an automatic reconnection. |
| 359 | 65 | */ |
| 360 | 66 | static void try_reconnect(H3270 *session) | ... | ... |
src/lib3270/ssl.c
| ... | ... | @@ -48,7 +48,9 @@ |
| 48 | 48 | #include <lib3270/trace.h> |
| 49 | 49 | #include "trace_dsc.h" |
| 50 | 50 | |
| 51 | +#if defined(HAVE_LIBSSL) | |
| 51 | 52 | static int ssl_3270_ex_index = -1; /**< Index of h3270 handle in SSL session */ |
| 53 | +#endif // HAVE_LIBSSL | |
| 52 | 54 | |
| 53 | 55 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 54 | 56 | ... | ... |
src/lib3270/telnet.c
| ... | ... | @@ -141,7 +141,10 @@ static void check_in3270(H3270 *session); |
| 141 | 141 | static void store3270in(H3270 *hSession, unsigned char c); |
| 142 | 142 | static void check_linemode(H3270 *hSession, Boolean init); |
| 143 | 143 | static int net_connected(H3270 *session); |
| 144 | + | |
| 145 | +#if defined(HAVE_LIBSSL) | |
| 144 | 146 | static void continue_tls(H3270 *hSession, unsigned char *sbbuf, int len); |
| 147 | +#endif // HAVE_LIBSSL | |
| 145 | 148 | |
| 146 | 149 | #if defined(X3270_TN3270E) /*[*/ |
| 147 | 150 | static int tn3270e_negotiate(H3270 *hSession); |
| ... | ... | @@ -924,7 +927,9 @@ LIB3270_INTERNAL void lib3270_sock_disconnect(H3270 *hSession) |
| 924 | 927 | */ |
| 925 | 928 | void net_disconnect(H3270 *session) |
| 926 | 929 | { |
| 930 | +#if defined(HAVE_LIBSSL) | |
| 927 | 931 | set_ssl_state(session,LIB3270_SSL_UNSECURE); |
| 932 | +#endif // HAVE_LIBSSL | |
| 928 | 933 | |
| 929 | 934 | session->disconnect(session); |
| 930 | 935 | |
| ... | ... | @@ -1498,6 +1503,7 @@ static int telnet_fsm(H3270 *hSession, unsigned char c) |
| 1498 | 1503 | return 0; |
| 1499 | 1504 | } |
| 1500 | 1505 | |
| 1506 | +#if defined(HAVE_LIBSSL) | |
| 1501 | 1507 | /** |
| 1502 | 1508 | * Process a STARTTLS subnegotiation. |
| 1503 | 1509 | */ |
| ... | ... | @@ -1520,6 +1526,7 @@ static void continue_tls(H3270 *hSession, unsigned char *sbbuf, int len) |
| 1520 | 1526 | trace_dsn(hSession,"%s FOLLOWS %s\n", opt(TELOPT_STARTTLS), cmd(SE)); |
| 1521 | 1527 | ssl_negotiate(hSession); |
| 1522 | 1528 | } |
| 1529 | +#endif // HAVE_LIBSSL | |
| 1523 | 1530 | |
| 1524 | 1531 | #if defined(X3270_TN3270E) /*[*/ |
| 1525 | 1532 | /* Send a TN3270E terminal type request. */ | ... | ... |
src/pw3270/v3270/security.c
| ... | ... | @@ -38,6 +38,7 @@ |
| 38 | 38 | |
| 39 | 39 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
| 40 | 40 | |
| 41 | +#if defined(HAVE_LIBSSL) | |
| 41 | 42 | static const struct v3270_ssl_status_msg ssl_status_msg[] = |
| 42 | 43 | { |
| 43 | 44 | // http://www.openssl.org/docs/apps/verify.html |
| ... | ... | @@ -266,6 +267,7 @@ |
| 266 | 267 | } |
| 267 | 268 | |
| 268 | 269 | }; |
| 270 | +#endif // HAVE_LIBSSL | |
| 269 | 271 | |
| 270 | 272 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 271 | 273 | ... | ... |