summaryrefslogtreecommitdiffstats
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2015-01-05 16:07:42 +1300
committerAndrew Bartlett <abartlet@samba.org>2015-01-23 05:42:07 +0100
commit378bb04835a377699a8ff254c0ec633ac63a41de (patch)
treeef38ac463525006ddc5d0d7fd11fc180f6ba230b /source4
parent9a0aa6f6f7217399eaac34aa8ac82b49d953175a (diff)
downloadsamba-378bb04835a377699a8ff254c0ec633ac63a41de.tar.gz
samba-378bb04835a377699a8ff254c0ec633ac63a41de.tar.xz
samba-378bb04835a377699a8ff254c0ec633ac63a41de.zip
torture: Run new testsuite for krb5 and KDC behaviour with machine account also
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')
-rwxr-xr-xsource4/selftest/tests.py5
-rw-r--r--source4/torture/krb5/kdc.c16
2 files changed, 15 insertions, 6 deletions
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index 5208774d70..64fb243c77 100755
--- a/source4/selftest/tests.py
+++ b/source4/selftest/tests.py
@@ -549,7 +549,10 @@ for env in ["dc", "s4member", "rodc", "promoted_dc", "plugin_s4_dc", "s3member"]
plantestsuite("samba.blackbox.wbinfo(%s:local)" % env, "%s:local" % env, [os.path.join(samba4srcdir, "../nsswitch/tests/test_wbinfo.sh"), '$DOMAIN', '$DC_USERNAME', '$DC_PASSWORD', env])
for env in ["dc", "rodc", "promoted_dc", "plugin_s4_dc"]:
- plansmbtorture4testsuite('krb5.kdc', env, ['ncacn_np:$SERVER', "-k", "yes", '-U$USERNAME@$REALM%$PASSWORD', '--workgroup=$DOMAIN'])
+ plansmbtorture4testsuite('krb5.kdc', env, ['ncacn_np:$SERVER', "-k", "yes", '-U$USERNAME@$REALM%$PASSWORD', '--workgroup=$DOMAIN'],
+ "samba4.krb5.kdc with specified account")
+ plansmbtorture4testsuite('krb5.kdc', "%s:local" % env, ['ncacn_np:$SERVER', "-k", "yes", '-P', '--workgroup=$DOMAIN'],
+ "samba4.krb5.kdc with machine account")
# TODO: Verifying the databases really should be a part of the
diff --git a/source4/torture/krb5/kdc.c b/source4/torture/krb5/kdc.c
index 9dcee40e0d..c9014cf56e 100644
--- a/source4/torture/krb5/kdc.c
+++ b/source4/torture/krb5/kdc.c
@@ -53,7 +53,8 @@ static bool torture_krb5_init_context(struct torture_context *tctx,
return true;
}
-static bool torture_krb5_as_req_1(struct torture_context *tctx)
+static bool torture_krb5_as_req_creds(struct torture_context *tctx,
+ struct cli_credentials *credentials)
{
krb5_error_code k5ret;
bool ok;
@@ -62,12 +63,12 @@ static bool torture_krb5_as_req_1(struct torture_context *tctx)
struct smb_krb5_context *smb_krb5_context;
enum credentials_obtained obtained;
const char *error_string;
- const char *password = cli_credentials_get_password(cmdline_credentials);
+ const char *password = cli_credentials_get_password(credentials);
ok = torture_krb5_init_context(tctx, &smb_krb5_context);
torture_assert(tctx, ok, "torture_krb5_init_context failed");
- k5ret = principal_from_credentials(tctx, cmdline_credentials, smb_krb5_context, &principal, &obtained, &error_string);
+ k5ret = principal_from_credentials(tctx, credentials, smb_krb5_context, &principal, &obtained, &error_string);
torture_assert_int_equal(tctx, k5ret, 0, error_string);
k5ret = krb5_get_init_creds_password(smb_krb5_context->krb5_context, &my_creds, principal,
@@ -100,6 +101,11 @@ static bool torture_krb5_as_req_1(struct torture_context *tctx)
return true;
}
+static bool torture_krb5_as_req_cmdline(struct torture_context *tctx)
+{
+ return torture_krb5_as_req_creds(tctx, cmdline_credentials);
+}
+
NTSTATUS torture_krb5_init(void);
NTSTATUS torture_krb5_init(void)
{
@@ -108,8 +114,8 @@ NTSTATUS torture_krb5_init(void)
suite->description = talloc_strdup(suite, "Kerberos tests");
kdc_suite->description = talloc_strdup(kdc_suite, "Kerberos KDC tests");
- torture_suite_add_simple_test(kdc_suite, "as-req-1",
- torture_krb5_as_req_1);
+ torture_suite_add_simple_test(kdc_suite, "as-req-cmdline",
+ torture_krb5_as_req_cmdline);
torture_suite_add_suite(suite, kdc_suite);