summaryrefslogtreecommitdiff
path: root/source4/param
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-11-10 17:11:56 +1100
committerAndrew Bartlett <abartlet@samba.org>2011-11-17 00:34:09 +0100
commitea7cb8ccb7f19fa8f4c5e6c61147dd6a4a877e22 (patch)
treec0e3a6b6a04b98353b2d9fc69e3d69802bec701e /source4/param
parent3ac3de73b4e2cfb8dfe21c502de8432abb29d685 (diff)
downloadsamba-ea7cb8ccb7f19fa8f4c5e6c61147dd6a4a877e22.tar.gz
samba-ea7cb8ccb7f19fa8f4c5e6c61147dd6a4a877e22.tar.bz2
samba-ea7cb8ccb7f19fa8f4c5e6c61147dd6a4a877e22.zip
lib/param: Add tests for security= behaviour now it operates with server role
Pair-Programmed-With: Amitay Isaacs <amitay@samba.org>
Diffstat (limited to 'source4/param')
-rw-r--r--source4/param/tests/loadparm.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/source4/param/tests/loadparm.c b/source4/param/tests/loadparm.c
index 19eaabe833..5f27439912 100644
--- a/source4/param/tests/loadparm.c
+++ b/source4/param/tests/loadparm.c
@@ -149,6 +149,7 @@ static bool test_server_role_default(struct torture_context *tctx)
{
struct loadparm_context *lp_ctx = loadparm_init(tctx);
torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_STANDALONE, "ROLE should be standalone by default");
+ torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_USER, "security should be user");
return true;
}
@@ -157,6 +158,7 @@ static bool test_server_role_dc_specified(struct torture_context *tctx)
struct loadparm_context *lp_ctx = loadparm_init(tctx);
torture_assert(tctx, lpcfg_set_option(lp_ctx, "server role=domain controller"), "lpcfg_set_option failed");
torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_DOMAIN_CONTROLLER, "ROLE should be DC");
+ torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_USER, "security should be USER");
return true;
}
@@ -165,6 +167,36 @@ static bool test_server_role_member_specified(struct torture_context *tctx)
struct loadparm_context *lp_ctx = loadparm_init(tctx);
torture_assert(tctx, lpcfg_set_option(lp_ctx, "server role=member"), "lpcfg_set_option failed");
torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_DOMAIN_MEMBER, "ROLE should be member");
+ torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_ADS, "security should be ADS");
+ return true;
+}
+
+static bool test_server_role_member_specified2(struct torture_context *tctx)
+{
+ struct loadparm_context *lp_ctx = loadparm_init(tctx);
+ torture_assert(tctx, lpcfg_set_option(lp_ctx, "server role=member"), "lpcfg_set_option failed");
+ torture_assert(tctx, lpcfg_set_option(lp_ctx, "security=domain"), "lpcfg_set_option failed");
+ torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_DOMAIN_MEMBER, "ROLE should be member");
+ torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_DOMAIN, "security should be domain");
+ return true;
+}
+
+static bool test_server_role_member_specified3(struct torture_context *tctx)
+{
+ struct loadparm_context *lp_ctx = loadparm_init(tctx);
+ torture_assert(tctx, lpcfg_set_option(lp_ctx, "server role=member"), "lpcfg_set_option failed");
+ torture_assert(tctx, lpcfg_set_option(lp_ctx, "security=ads"), "lpcfg_set_option failed");
+ torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_DOMAIN_MEMBER, "ROLE should be member");
+ torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_ADS, "security should be ads");
+ return true;
+}
+
+static bool test_server_role_standalone_specified(struct torture_context *tctx)
+{
+ struct loadparm_context *lp_ctx = loadparm_init(tctx);
+ torture_assert(tctx, lpcfg_set_option(lp_ctx, "server role=standalone"), "lpcfg_set_option failed");
+ torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_STANDALONE, "ROLE should be standalone");
+ torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_USER, "security should be USER");
return true;
}
@@ -173,6 +205,7 @@ static bool test_server_role_dc_domain_logons(struct torture_context *tctx)
struct loadparm_context *lp_ctx = loadparm_init(tctx);
torture_assert(tctx, lpcfg_set_option(lp_ctx, "domain logons=true"), "lpcfg_set_option failed");
torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_DOMAIN_PDC, "ROLE should be PDC");
+ torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_USER, "security should be user");
return true;
}
@@ -182,6 +215,7 @@ static bool test_server_role_dc_domain_logons_and_not_master(struct torture_cont
torture_assert(tctx, lpcfg_set_option(lp_ctx, "domain logons=true"), "lpcfg_set_option failed");
torture_assert(tctx, lpcfg_set_option(lp_ctx, "domain master=false"), "lpcfg_set_option failed");
torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_DOMAIN_BDC, "ROLE should be BDC");
+ torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_USER, "security should be user");
return true;
}
@@ -190,6 +224,7 @@ static bool test_server_role_security_ads(struct torture_context *tctx)
struct loadparm_context *lp_ctx = loadparm_init(tctx);
torture_assert(tctx, lpcfg_set_option(lp_ctx, "security=ads"), "lpcfg_set_option failed");
torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_DOMAIN_MEMBER, "ROLE should be MEMBER");
+ torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_ADS, "security should be ads");
return true;
}
@@ -198,6 +233,7 @@ static bool test_server_role_security_domain(struct torture_context *tctx)
struct loadparm_context *lp_ctx = loadparm_init(tctx);
torture_assert(tctx, lpcfg_set_option(lp_ctx, "security=domain"), "lpcfg_set_option failed");
torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_DOMAIN_MEMBER, "ROLE should be MEMBER");
+ torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_DOMAIN, "security should be domain");
return true;
}
@@ -206,6 +242,7 @@ static bool test_server_role_security_share(struct torture_context *tctx)
struct loadparm_context *lp_ctx = loadparm_init(tctx);
torture_assert(tctx, lpcfg_set_option(lp_ctx, "security=share"), "lpcfg_set_option failed");
torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_STANDALONE, "ROLE should be STANDALONE");
+ torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_SHARE, "security should be share");
return true;
}
@@ -214,6 +251,7 @@ static bool test_server_role_security_server(struct torture_context *tctx)
struct loadparm_context *lp_ctx = loadparm_init(tctx);
torture_assert(tctx, lpcfg_set_option(lp_ctx, "security=server"), "lpcfg_set_option failed");
torture_assert_int_equal(tctx, lpcfg_server_role(lp_ctx), ROLE_STANDALONE, "ROLE should be STANDALONE");
+ torture_assert_int_equal(tctx, lpcfg_security(lp_ctx), SEC_SERVER, "security should be server");
return true;
}
@@ -237,6 +275,9 @@ struct torture_suite *torture_local_loadparm(TALLOC_CTX *mem_ctx)
torture_suite_add_simple_test(suite, "test_server_role_default", test_server_role_default);
torture_suite_add_simple_test(suite, "test_server_role_dc_specified", test_server_role_dc_specified);
torture_suite_add_simple_test(suite, "test_server_role_member_specified", test_server_role_member_specified);
+ torture_suite_add_simple_test(suite, "test_server_role_member_specified2", test_server_role_member_specified2);
+ torture_suite_add_simple_test(suite, "test_server_role_member_specified3", test_server_role_member_specified3);
+ torture_suite_add_simple_test(suite, "test_server_role_standalone_specified", test_server_role_standalone_specified);
torture_suite_add_simple_test(suite, "test_server_role_dc_domain_logons", test_server_role_dc_domain_logons);
torture_suite_add_simple_test(suite, "test_server_role_dc_domain_logons_and_not_master", test_server_role_dc_domain_logons_and_not_master);
torture_suite_add_simple_test(suite, "test_server_role_security_ads", test_server_role_security_ads);