/* basic testing of session/tree context calls */ static BOOL torture_raw_context_int(void) { struct smbcli_state *cli; BOOL ret = True; TALLOC_CTX *mem_ctx; if (!torture_open_connection(&cli, 0)) { return False; } mem_ctx = talloc_init("torture_raw_context"); ret &= test_session(cli, mem_ctx); ret &= test_tree(cli, mem_ctx); ret &= test_tree_ulogoff(cli, mem_ctx); ret &= test_pid_exit_only_sees_open(cli, mem_ctx); ret &= test_pid_2sess(cli, mem_ctx); ret &= test_pid_2tcon(cli, mem_ctx); smb_raw_exit(cli->session); smbcli_deltree(cli->tree, BASEDIR); torture_close_connection(cli); talloc_free(mem_ctx); return ret; }
int main() #endif { #if RUN_TEST_LOOP for(;;) #endif { tnet_startup(); /* Print copyright information */ printf("Doubango Project\nCopyright (C) 2009 - 2010 Mamadou Diop \n\n"); #if RUN_TEST_ALL || RUN_TEST_URI test_uri(); #endif #if RUN_TEST_ALL || RUN_TEST_PARSER test_parser(); #endif #if RUN_TEST_ALL || RUN_TEST_SESSION test_session(); #endif tnet_cleanup(); } }
/* basic testing of session/tree context calls */ static bool torture_raw_context_int(struct torture_context *tctx, struct smbcli_state *cli) { bool ret = true; ret &= test_session(cli, tctx); ret &= test_tree(cli, tctx); ret &= test_tree_ulogoff(cli, tctx); ret &= test_pid_exit_only_sees_open(cli, tctx); ret &= test_pid_2sess(cli, tctx); ret &= test_pid_2tcon(cli, tctx); smb_raw_exit(cli->session); smbcli_deltree(cli->tree, BASEDIR); return ret; }
int main(void) { get_functions(&funcs); test_lib_info(); #ifdef HW_TESTS test_initalize(); test_token_info(); test_mechanism_list_and_info(); test_session(); test_login(); test_import_and_sign_all_10(); test_import_and_sign_all_10_RSA(); #else fprintf(stderr, "HARDWARE TESTS DISABLED!, skipping...\n"); #endif return EXIT_SUCCESS; }
int main (int argc, char **argv) { CK_RV rv = CKR_OK; CK_FUNCTION_LIST_PTR pkcs11; CK_RV (*C_GetFunctionList) (CK_FUNCTION_LIST_PTR_PTR) = 0; char *lib_path, *string_to_search; unsigned int string_to_search_len; CK_INFO info; CK_SLOT_INFO slot_info; CK_ULONG slot_list_size = 8; CK_SLOT_ID slot_list[slot_list_size]; CK_TOKEN_INFO token_info; CK_ULONG i; CK_SESSION_HANDLE session_handle; CK_OBJECT_HANDLE object_list[16]; CK_ULONG object_list_size = 16, objects_found; if (argc >= 2) lib_path = argv[1]; if (argc >= 3) string_to_search = argv[2]; string_to_search_len = strlen(string_to_search); void *pkcs11_so; pkcs11_so = dlopen (lib_path, RTLD_NOW); if (pkcs11_so == NULL) { fprintf (stderr, "Could not load library: %s\n", dlerror()); return CKR_GENERAL_ERROR; } C_GetFunctionList = (CK_RV (*)(CK_FUNCTION_LIST_PTR_PTR)) dlsym(pkcs11_so, "C_GetFunctionList"); rv = C_GetFunctionList (&pkcs11); g_assert (rv == CKR_OK); /**/ rv = pkcs11->C_Initialize (NULL); g_assert (rv == CKR_OK); rv = pkcs11->C_GetInfo (&info); g_assert (rv == CKR_OK); printf ("CK_INFO\n"); printf ("PKCS#11 version: %u.%u\n", info.cryptokiVersion.major, info.cryptokiVersion.minor); printf ("Manufacturer ID: %s\n", info.manufacturerID); printf ("Flags: %lx\n", (CK_ULONG) info.flags); printf ("Library Description: "); print_info (info.libraryDescription, 32); printf ("library version: %u.%u\n", info.libraryVersion.major, info.libraryVersion.minor); rv = pkcs11->C_GetSlotList (CK_TRUE, slot_list, &slot_list_size); g_assert (rv == CKR_OK); printf ("Number of slots: %lu\n", slot_list_size); printf ("Slot number: "); for (i = 0; i < slot_list_size; i++) { printf ("%lu ", (CK_ULONG) slot_list[i]); } printf ("\n"); /**/ rv = pkcs11->C_GetSlotInfo (slot_list[0], &slot_info); g_assert (rv == CKR_OK); printf ("CK_SLOT_INFO\n"); printf ("Slot description: "); print_info (slot_info.slotDescription, 64); printf ("Manufacturer ID: "); print_info (slot_info.manufacturerID, 32); printf ("Flags: %lx\n", slot_info.flags); printf ("Hardware version: %u.%u\n", slot_info.hardwareVersion.major, slot_info.hardwareVersion.minor); printf ("Firmware version: %u.%u\n", slot_info.firmwareVersion.major, slot_info.firmwareVersion.minor); rv = pkcs11->C_GetTokenInfo (slot_list[0], &token_info); g_assert (rv == CKR_OK); test_session (pkcs11, slot_list[0]); rv = pkcs11->C_OpenSession (slot_list[0], CKF_SERIAL_SESSION, NULL, NULL, &session_handle); g_assert (rv == CKR_OK); test_search (pkcs11, slot_list[0], session_handle, string_to_search, string_to_search_len, object_list, object_list_size, &objects_found); test_attribute_value (pkcs11, slot_list[0], session_handle, object_list[0]); rv = pkcs11->C_CloseSession(session_handle); g_assert (rv == CKR_OK); rv = pkcs11->C_Finalize (NULL); g_assert (rv == CKR_OK); rv = dlclose(pkcs11_so); if (rv != 0) { fprintf (stderr, "Could not dlclose\n"); } return 0; }