Lines Matching defs:ts
39 struct test_state *ts = NULL;
43 ts = talloc(global_talloc_context, struct test_state);
44 assert_non_null(ts);
46 ts->authtoken = sss_authtok_new(ts);
47 assert_non_null(ts->authtoken);
49 check_leaks_push(ts);
50 *state = (void *)ts;
56 struct test_state *ts = talloc_get_type_abort(*state, struct test_state);
58 assert_non_null(ts);
60 assert_true(check_leaks_pop(ts));
61 talloc_free(ts);
68 struct test_state *ts = talloc_get_type_abort(*state, struct test_state);
71 authtoken = sss_authtok_new(ts);
98 struct test_state *ts;
101 ts = talloc_get_type_abort(*state, struct test_state);
102 data = talloc_strdup(ts, "password");
107 ret = sss_authtok_set(ts->authtoken, type, (const uint8_t *)data, len);
110 assert_int_equal(type, sss_authtok_get_type(ts->authtoken));
111 assert_int_equal(len, sss_authtok_get_size(ts->authtoken));
112 assert_string_equal(data, sss_authtok_get_data(ts->authtoken));
114 ret = sss_authtok_get_password(ts->authtoken, &pwd, &ret_len);
120 ret = sss_authtok_set_password(ts->authtoken, data, len);
123 ret = sss_authtok_get_password(ts->authtoken, &pwd, &ret_len);
129 sss_authtok_set_empty(ts->authtoken);
140 struct test_state *ts;
143 ts = talloc_get_type_abort(*state, struct test_state);
144 data = talloc_strdup(ts, "path/to/cc_file");
149 ret = sss_authtok_set(ts->authtoken, type, (const uint8_t *)data, len);
152 assert_int_equal(type, sss_authtok_get_type(ts->authtoken));
153 assert_int_equal(len, sss_authtok_get_size(ts->authtoken));
154 assert_string_equal(data, sss_authtok_get_data(ts->authtoken));
156 ret = sss_authtok_get_ccfile(ts->authtoken, &pwd, &ret_len);
162 ret = sss_authtok_set_ccfile(ts->authtoken, data, len);
166 ret = sss_authtok_get_ccfile(ts->authtoken, &pwd, &ret_len);
173 ret = sss_authtok_set(ts->authtoken, type, (const uint8_t *) data, 0);
176 assert_int_equal(type, sss_authtok_get_type(ts->authtoken));
177 assert_int_equal(len, sss_authtok_get_size(ts->authtoken));
178 assert_string_equal(data, sss_authtok_get_data(ts->authtoken));
180 ret = sss_authtok_get_ccfile(ts->authtoken, &pwd, &ret_len);
187 sss_authtok_set_empty(ts->authtoken);
196 struct test_state *ts;
200 ts = talloc_get_type_abort(*state, struct test_state);
201 ret = sss_authtok_set(ts->authtoken, type, NULL, 0);
204 assert_int_equal(type, sss_authtok_get_type(ts->authtoken));
205 assert_int_equal(0, sss_authtok_get_size(ts->authtoken));
206 assert_null(sss_authtok_get_data(ts->authtoken));
208 ret = sss_authtok_get_password(ts->authtoken, &pwd, &ret_len);
212 ret = sss_authtok_get_ccfile(ts->authtoken, &pwd, &ret_len);
216 sss_authtok_set_empty(ts->authtoken);
218 assert_int_equal(type, sss_authtok_get_type(ts->authtoken));
219 assert_int_equal(0, sss_authtok_get_size(ts->authtoken));
220 assert_null(sss_authtok_get_data(ts->authtoken));
222 ret = sss_authtok_set(ts->authtoken, type, (const uint8_t*)"", 0);
225 assert_int_equal(type, sss_authtok_get_type(ts->authtoken));
226 assert_int_equal(EOK, sss_authtok_get_size(ts->authtoken));
227 assert_null(sss_authtok_get_data(ts->authtoken));
229 ret = sss_authtok_get_password(ts->authtoken, &pwd, &ret_len);
233 ret = sss_authtok_get_ccfile(ts->authtoken, &pwd, &ret_len);
245 struct test_state *ts;
248 ts = talloc_get_type_abort(*state, struct test_state);
249 data = talloc_strdup(ts, "password");
254 ret = sss_authtok_set(ts->authtoken, type, (const uint8_t *)data, len);
258 sss_authtok_wipe_password(ts->authtoken);
260 ret = sss_authtok_get_password(ts->authtoken, &pwd, &ret_len);
266 sss_authtok_set_empty(ts->authtoken);
275 struct test_state *ts;
279 ts= talloc_get_type_abort(*state, struct test_state);
281 dest_authtoken = sss_authtok_new(ts);
284 data = talloc_strdup(ts, "password");
289 ret = sss_authtok_set(ts->authtoken, type, (const uint8_t *)data, len);
292 assert_int_equal(EOK, sss_authtok_copy(ts->authtoken, dest_authtoken));
297 ret = sss_authtok_set(ts->authtoken, type, (const uint8_t *)data, len);
301 ret = sss_authtok_copy(ts->authtoken, dest_authtoken);
310 sss_authtok_set_empty(ts->authtoken);
321 struct test_state *ts;
323 ts = talloc_get_type_abort(*state, struct test_state);
329 ret = sss_authtok_set_2fa(ts->authtoken, NULL, 1, "b", 1);
332 ret = sss_authtok_set_2fa(ts->authtoken, "a", 1, NULL, 1);
335 ret = sss_authtok_set_2fa(ts->authtoken, "ab", 1, "b", 1);
338 ret = sss_authtok_set_2fa(ts->authtoken, "a", 1, "bc", 1);
341 ret = sss_authtok_set_2fa(ts->authtoken, "a", 1, "bc", 2);
343 assert_int_equal(sss_authtok_get_size(ts->authtoken),
345 assert_int_equal(sss_authtok_get_type(ts->authtoken), SSS_AUTHTOK_TYPE_2FA);
347 assert_memory_equal(sss_authtok_get_data(ts->authtoken),
351 assert_memory_equal(sss_authtok_get_data(ts->authtoken),
356 ret = sss_authtok_get_2fa(ts->authtoken, &fa1, &fa1_size, &fa2, &fa2_size);
363 sss_authtok_set_empty(ts->authtoken);
366 ret = sss_authtok_get_2fa(ts->authtoken, &fa1, &fa1_size, &fa2, &fa2_size);
370 ret = sss_authtok_set_password(ts->authtoken, "abc", 0);
373 ret = sss_authtok_get_2fa(ts->authtoken, &fa1, &fa1_size, &fa2, &fa2_size);
376 sss_authtok_set_empty(ts->authtoken);
379 ret = sss_authtok_set(ts->authtoken, SSS_AUTHTOK_TYPE_2FA,
383 sss_authtok_set_empty(ts->authtoken);
389 struct test_state *ts;
397 ts = talloc_get_type_abort(*state, struct test_state);
414 buf = talloc_size(ts, needed_size);
427 ret = sss_auth_unpack_2fa_blob(ts, buf, needed_size, &fa1, &fa1_len, &fa2,
443 struct test_state *ts;
455 ts = talloc_get_type_abort(*state, struct test_state);
461 buf = talloc_size(ts, needed_size);
476 ret = sss_authtok_set(ts->authtoken, SSS_AUTHTOK_TYPE_SC_PIN, buf,
480 ret = sss_authtok_get_sc(ts->authtoken, &pin, &pin_len,
494 ret = sss_authtok_get_sc(ts->authtoken, NULL, NULL,
506 ret = sss_authtok_get_sc(ts->authtoken, NULL, NULL,
515 sss_authtok_set_empty(ts->authtoken);
533 struct test_state *ts;
551 ts = talloc_get_type_abort(*state, struct test_state);
553 ret = sss_auth_unpack_2fa_blob(ts, b0, sizeof(b0), &fa1, &fa1_len, &fa2,
557 ret = sss_auth_unpack_2fa_blob(ts, b1, sizeof(b1), &fa1, &fa1_len, &fa2,
561 ret = sss_auth_unpack_2fa_blob(ts, b2, sizeof(b2), &fa1, &fa1_len, &fa2,
565 ret = sss_auth_unpack_2fa_blob(ts, b3, sizeof(b3), &fa1, &fa1_len, &fa2,
572 struct test_state *ts;
574 ts = talloc_get_type_abort(*state, struct test_state);
578 sss_authtok_set_sc_keypad(ts->authtoken);
579 assert_int_equal(sss_authtok_get_type(ts->authtoken),
581 assert_int_equal(sss_authtok_get_size(ts->authtoken), 0);
582 assert_null(sss_authtok_get_data(ts->authtoken));
587 struct test_state *ts;
593 ts = talloc_get_type_abort(*state, struct test_state);
598 ret = sss_authtok_set_sc_pin(ts->authtoken, NULL, 0);
601 ret = sss_authtok_set_sc_pin(ts->authtoken, "12345678", 0);
603 assert_int_equal(sss_authtok_get_type(ts->authtoken),
605 size = sss_authtok_get_size(ts->authtoken);
608 assert_memory_equal(sss_authtok_get_data(ts->authtoken),
612 assert_memory_equal(sss_authtok_get_data(ts->authtoken),
617 ret = sss_authtok_set_sc_pin(ts->authtoken, "12345678", 5);
619 assert_int_equal(sss_authtok_get_type(ts->authtoken),
621 size = sss_authtok_get_size(ts->authtoken);
624 assert_memory_equal(sss_authtok_get_data(ts->authtoken),
628 assert_memory_equal(sss_authtok_get_data(ts->authtoken),
633 ret = sss_authtok_get_sc_pin(ts->authtoken, &pin, &len);
638 sss_authtok_set_empty(ts->authtoken);
640 ret = sss_authtok_get_sc_pin(ts->authtoken, &pin, &len);
643 ret = sss_authtok_set_password(ts->authtoken, "12345", 0);
646 ret = sss_authtok_get_sc_pin(ts->authtoken, &pin, &len);
649 sss_authtok_set_empty(ts->authtoken);