Changeset 807:09f8f0c4f4a4 in freeDiameter for tests/testcnx.c
- Timestamp:
- Aug 24, 2012, 7:15:48 AM (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/testcnx.c
r795 r807 614 614 CHECK( 1, ret ); 615 615 616 #ifdef GNUTLS_VERSION_300 617 { 618 /* We import these CA in the trust list */ 619 gnutls_x509_crt_t * calist; 620 unsigned int cacount = 0; 621 622 CHECK_GNUTLS_DO( ret = gnutls_x509_crt_list_import2(&calist, &cacount, &ca, GNUTLS_X509_FMT_PEM, 623 GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED), ); 624 CHECK( 1, cacount ); 625 626 CHECK_GNUTLS_DO( ret = gnutls_x509_trust_list_add_cas (fd_g_config->cnf_sec_data.trustlist, calist, cacount, 0), ); 627 CHECK( 1, ret ); 628 } 629 630 /* Use certificate verification during the handshake */ 631 gnutls_certificate_set_verify_function (fd_g_config->cnf_sec_data.credentials, fd_tls_verify_credentials_2); 632 633 #endif /* GNUTLS_VERSION_300 */ 634 635 616 636 /* Set the server credentials (in config) */ 617 637 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_key_mem( fd_g_config->cnf_sec_data.credentials, … … 1201 1221 1202 1222 /* Basic operation tested successfully, now test we detect error conditions */ 1203 1223 1204 1224 /* Untrusted certificate, TCP */ 1205 1225 { … … 1238 1258 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) ); 1239 1259 CHECK( EINVAL, fd_cnx_handshake(server_side, GNUTLS_SERVER, NULL, NULL) ); 1260 fd_cnx_destroy(server_side); 1261 1240 1262 CHECK( 0, pthread_join(thr, NULL) ); 1241 1263 1242 1264 /* Now close the connection */ 1243 1265 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) ); 1244 fd_cnx_destroy(server_side);1245 1266 CHECK( 0, pthread_join(thr, NULL) ); 1246 1267 … … 1267 1288 /* Set the CA */ 1268 1289 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, ¬rust_ca, GNUTLS_X509_FMT_PEM), ); 1269 /* TODO: fix me. 1270 We should not get stuck when the server fails the handshake but the client succeeds. 1271 However, at the moment we do get stuck. 1272 FFS, is this a test problem or a problem in the code? 1273 1274 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), ); 1275 */ 1290 CHECK_GNUTLS_DO( ret = gnutls_certificate_set_x509_trust_mem( hf.creds, &ca, GNUTLS_X509_FMT_PEM), ); 1276 1291 CHECK( 1, ret ); 1277 1292 /* Set the key */ … … 1294 1309 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) ); 1295 1310 CHECK( EINVAL, fd_cnx_handshake(server_side, GNUTLS_SERVER, NULL, NULL) ); 1311 fd_cnx_destroy(server_side); 1296 1312 CHECK( 0, pthread_join(thr, NULL) ); 1297 1313 1298 1314 /* Now close the connection */ 1299 1315 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) ); 1300 fd_cnx_destroy(server_side);1301 1316 CHECK( 0, pthread_join(thr, NULL) ); 1302 1317 … … 1343 1358 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) ); 1344 1359 CHECK( EINVAL, fd_cnx_handshake(server_side, GNUTLS_SERVER, NULL, NULL) ); 1360 fd_cnx_destroy(server_side); 1345 1361 CHECK( 0, pthread_join(thr, NULL) ); 1346 1362 1347 1363 /* Now close the connection */ 1348 1364 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) ); 1349 fd_cnx_destroy(server_side);1350 1365 CHECK( 0, pthread_join(thr, NULL) ); 1351 1366 … … 1421 1436 CHECK( 0, pthread_create(&thr, NULL, handshake_thr, &hf) ); 1422 1437 CHECK( EINVAL, fd_cnx_handshake(server_side, GNUTLS_SERVER, NULL, NULL) ); 1438 fd_cnx_destroy(server_side); 1423 1439 CHECK( 0, pthread_join(thr, NULL) ); 1424 1440 1425 1441 /* Now close the connection */ 1426 1442 CHECK( 0, pthread_create(&thr, NULL, destroy_thr, client_side) ); 1427 fd_cnx_destroy(server_side);1428 1443 CHECK( 0, pthread_join(thr, NULL) ); 1429 1444
Note: See TracChangeset
for help on using the changeset viewer.