(int build_mode, String[] args)
| 325 | * do_client() |
| 326 | */ |
| 327 | private void do_client(int build_mode, String[] args) |
| 328 | throws Exception |
| 329 | { |
| 330 | if (build_mode < axtlsj.SSL_BUILD_ENABLE_CLIENT) |
| 331 | print_client_options(build_mode, args[1]); |
| 332 | |
| 333 | int i = 1, res; |
| 334 | int port = 4433; |
| 335 | boolean quiet = false; |
| 336 | String password = null; |
| 337 | int reconnect = 0; |
| 338 | String private_key_file = null; |
| 339 | String hostname = "127.0.0.1"; |
| 340 | |
| 341 | /* organise the cert/ca_cert lists */ |
| 342 | int cert_index = 0; |
| 343 | int ca_cert_index = 0; |
| 344 | int cert_size = SSLUtil.maxCerts(); |
| 345 | int ca_cert_size = SSLUtil.maxCACerts(); |
| 346 | String[] cert = new String[cert_size]; |
| 347 | String[] ca_cert = new String[ca_cert_size]; |
| 348 | |
| 349 | int options = axtlsj.SSL_SERVER_VERIFY_LATER|axtlsj.SSL_DISPLAY_CERTS; |
| 350 | byte[] session_id = null; |
| 351 | |
| 352 | while (i < args.length) |
| 353 | { |
| 354 | if (args[i].equals("-connect")) |
| 355 | { |
| 356 | String host_port; |
| 357 | |
| 358 | if (i >= args.length-1) |
| 359 | { |
| 360 | print_client_options(build_mode, args[i]); |
| 361 | } |
| 362 | |
| 363 | host_port = args[++i]; |
| 364 | int index_colon; |
| 365 | |
| 366 | if ((index_colon = host_port.indexOf(':')) < 0) |
| 367 | print_client_options(build_mode, args[i]); |
| 368 | |
| 369 | hostname = new String(host_port.toCharArray(), |
| 370 | 0, index_colon); |
| 371 | port = Integer.parseInt(new String(host_port.toCharArray(), |
| 372 | index_colon+1, host_port.length()-index_colon-1)); |
| 373 | } |
| 374 | else if (args[i].equals("-cert")) |
| 375 | { |
| 376 | if (i >= args.length-1 || cert_index >= cert_size) |
| 377 | { |
| 378 | print_client_options(build_mode, args[i]); |
| 379 | } |
| 380 | |
| 381 | cert[cert_index++] = args[++i]; |
| 382 | } |
| 383 | else if (args[i].equals("-CAfile")) |
| 384 | { |
no test coverage detected