summaryrefslogtreecommitdiff
path: root/source4/torture/krb5
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2015-01-23 14:38:51 +1300
committerAndrew Bartlett <abartlet@samba.org>2015-01-23 05:42:08 +0100
commit9d7719b62ba0453b7c4e4b8a4c2062dc55ac4abd (patch)
treeb526dcd1e4b712c8842ce5b491badfeccda9aab1 /source4/torture/krb5
parent62905cd6d21d457a54faa2a14e9713dcf280dbe5 (diff)
downloadsamba-9d7719b62ba0453b7c4e4b8a4c2062dc55ac4abd.tar.gz
torture-krb5: Move test of krb5_get_init_creds_opt_set_win2k to krb5.kdc.canon
This allows the impact of this to be verified with the other options we are setting This also removes duplication in the kdc.c testsuite. Pair-programmed-with: Garming Sam <garming@catalyst.net.nz> Signed-off-by: Garming Sam <garming@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/torture/krb5')
-rw-r--r--source4/torture/krb5/kdc-canon.c14
-rw-r--r--source4/torture/krb5/kdc.c22
2 files changed, 11 insertions, 25 deletions
diff --git a/source4/torture/krb5/kdc-canon.c b/source4/torture/krb5/kdc-canon.c
index 3103d945363..018e61d6e97 100644
--- a/source4/torture/krb5/kdc-canon.c
+++ b/source4/torture/krb5/kdc-canon.c
@@ -35,7 +35,8 @@
#define TEST_UPPER_REALM 0x0000004
#define TEST_UPPER_USERNAME 0x0000008
#define TEST_NETBIOS_REALM 0x0000010
-#define TEST_ALL 0x000001F
+#define TEST_WIN2K 0x0000020
+#define TEST_ALL 0x000003F
struct test_data {
struct smb_krb5_context *smb_krb5_context;
@@ -46,6 +47,7 @@ struct test_data {
bool enterprise;
bool upper_realm;
bool upper_username;
+ bool win2k;
};
struct torture_krb5_context {
@@ -344,6 +346,10 @@ static bool torture_krb5_as_req_canon(struct torture_context *tctx, const void *
krb5_get_init_creds_opt_set_canonicalize(smb_krb5_context->krb5_context, krb_options, test_data->canonicalize),
0, "krb5_get_init_creds_opt_set_canonicalize failed");
+ torture_assert_int_equal(tctx,
+ krb5_get_init_creds_opt_set_win2k(smb_krb5_context->krb5_context, krb_options, test_data->win2k),
+ 0, "krb5_get_init_creds_opt_set_win2k failed");
+
k5ret = krb5_get_init_creds_password(smb_krb5_context->krb5_context, &my_creds, principal,
password, NULL, NULL, 0,
NULL, krb_options);
@@ -410,12 +416,13 @@ struct torture_suite *torture_krb5_canon(TALLOC_CTX *mem_ctx)
suite->description = talloc_strdup(suite, "Kerberos Canonicalisation tests");
for (i = 0; i < TEST_ALL; i++) {
- char *name = talloc_asprintf(suite, "%s.%s.%s.%s.%s",
+ char *name = talloc_asprintf(suite, "%s.%s.%s.%s.%s.%s",
(i & TEST_CANONICALIZE) ? "canon" : "no-canon",
(i & TEST_ENTERPRISE) ? "enterprise" : "no-enterprise",
(i & TEST_UPPER_REALM) ? "uc-realm" : "lc-realm",
(i & TEST_UPPER_USERNAME) ? "uc-user" : "lc-user",
- (i & TEST_NETBIOS_REALM) ? "netbios-realm" : "krb5-realm");
+ (i & TEST_NETBIOS_REALM) ? "netbios-realm" : "krb5-realm",
+ (i & TEST_WIN2K) ? "win2k" : "no-win2k");
struct test_data *test_data = talloc(suite, struct test_data);
if (i & TEST_NETBIOS_REALM) {
@@ -429,6 +436,7 @@ struct torture_suite *torture_krb5_canon(TALLOC_CTX *mem_ctx)
test_data->enterprise = (i & TEST_ENTERPRISE) != 0;
test_data->upper_realm = (i & TEST_UPPER_REALM) != 0;
test_data->upper_username = (i & TEST_UPPER_USERNAME) != 0;
+ test_data->win2k = (i & TEST_WIN2K) != 0;
torture_suite_add_simple_tcase_const(suite, name, torture_krb5_as_req_canon,
test_data);
diff --git a/source4/torture/krb5/kdc.c b/source4/torture/krb5/kdc.c
index cf8c39b99b9..3eec5280977 100644
--- a/source4/torture/krb5/kdc.c
+++ b/source4/torture/krb5/kdc.c
@@ -33,7 +33,6 @@
enum torture_krb5_test {
TORTURE_KRB5_TEST_PLAIN,
- TORTURE_KRB5_TEST_WIN2K,
TORTURE_KRB5_TEST_PAC_REQUEST,
TORTURE_KRB5_TEST_BREAK_PW,
TORTURE_KRB5_TEST_CLOCK_SKEW,
@@ -62,7 +61,6 @@ static bool torture_krb5_pre_send_test(struct torture_krb5_context *test_context
switch (test_context->test)
{
case TORTURE_KRB5_TEST_PLAIN:
- case TORTURE_KRB5_TEST_WIN2K:
case TORTURE_KRB5_TEST_PAC_REQUEST:
case TORTURE_KRB5_TEST_BREAK_PW:
case TORTURE_KRB5_TEST_CLOCK_SKEW:
@@ -91,7 +89,6 @@ static bool torture_krb5_post_recv_test(struct torture_krb5_context *test_contex
switch (test_context->test)
{
case TORTURE_KRB5_TEST_PLAIN:
- case TORTURE_KRB5_TEST_WIN2K:
if (test_context->packet_count == 0) {
torture_assert_int_equal(test_context->tctx,
decode_KRB_ERROR(recv_buf->data, recv_buf->length, &error, &used), 0,
@@ -345,16 +342,6 @@ static bool torture_krb5_as_req_creds(struct torture_context *tctx,
case TORTURE_KRB5_TEST_PLAIN:
break;
- case TORTURE_KRB5_TEST_WIN2K:
- torture_assert_int_equal(tctx,
- krb5_get_init_creds_opt_alloc(smb_krb5_context->krb5_context, &krb_options),
- 0, "krb5_get_init_creds_opt_alloc failed");
-
- torture_assert_int_equal(tctx,
- krb5_get_init_creds_opt_set_win2k(smb_krb5_context->krb5_context, krb_options, true),
- 0, "krb5_get_init_creds_opt_set_win2k failed");
- break;
-
case TORTURE_KRB5_TEST_PAC_REQUEST:
torture_assert_int_equal(tctx,
krb5_get_init_creds_opt_alloc(smb_krb5_context->krb5_context, &krb_options),
@@ -385,7 +372,6 @@ static bool torture_krb5_as_req_creds(struct torture_context *tctx,
switch (test)
{
case TORTURE_KRB5_TEST_PLAIN:
- case TORTURE_KRB5_TEST_WIN2K:
case TORTURE_KRB5_TEST_PAC_REQUEST:
torture_assert_int_equal(tctx, k5ret, 0, "krb5_get_init_creds_password failed");
break;
@@ -430,11 +416,6 @@ static bool torture_krb5_as_req_cmdline(struct torture_context *tctx)
return torture_krb5_as_req_creds(tctx, cmdline_credentials, TORTURE_KRB5_TEST_PLAIN);
}
-static bool torture_krb5_as_req_win2k(struct torture_context *tctx)
-{
- return torture_krb5_as_req_creds(tctx, cmdline_credentials, TORTURE_KRB5_TEST_WIN2K);
-}
-
static bool torture_krb5_as_req_pac_request(struct torture_context *tctx)
{
if (torture_setting_bool(tctx, "expect_rodc", false)) {
@@ -463,9 +444,6 @@ NTSTATUS torture_krb5_init(void)
torture_suite_add_simple_test(kdc_suite, "as-req-cmdline",
torture_krb5_as_req_cmdline);
- torture_suite_add_simple_test(kdc_suite, "as-req-win2k",
- torture_krb5_as_req_win2k);
-
torture_suite_add_simple_test(kdc_suite, "as-req-pac-request",
torture_krb5_as_req_pac_request);