summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2013-02-18 17:17:19 +0100
committerAlexander Bokovoy <ab@samba.org>2013-02-22 16:36:12 +0100
commit742296d3c375630f76ced9970cff95d7bc1b2547 (patch)
treef4419260ffad8bf67c794fb04cb2ba19a61d7468
parent48a453996ac161d7c7a7cb15a047e57cbdbb1e87 (diff)
downloadsamba-742296d3c375630f76ced9970cff95d7bc1b2547.tar.gz
samba-742296d3c375630f76ced9970cff95d7bc1b2547.tar.bz2
samba-742296d3c375630f76ced9970cff95d7bc1b2547.zip
torture: Fix samsync domain_name checks.
Reviewed-by: Alexander Bokovoy <ab@samba.org>
-rw-r--r--source4/torture/rpc/samsync.c49
1 files changed, 45 insertions, 4 deletions
diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c
index 7249705bf7..81027d0658 100644
--- a/source4/torture/rpc/samsync.c
+++ b/source4/torture/rpc/samsync.c
@@ -423,6 +423,15 @@ static bool samsync_handle_policy(struct torture_context *tctx,
{
struct netr_DELTA_POLICY *policy = delta->delta_union.policy;
+ switch (database_id) {
+ case SAM_DATABASE_DOMAIN:
+ case SAM_DATABASE_BUILTIN:
+ break;
+ case SAM_DATABASE_PRIVS:
+ torture_comment(tctx, "DOMAIN entry on privs DB!\n");
+ return false;
+ }
+
samsync_state->seq_num[database_id] =
policy->sequence_num;
@@ -459,11 +468,22 @@ static bool samsync_handle_user(struct torture_context *tctx, TALLOC_CTX *mem_ct
struct samr_Password nt_hash;
struct samr_Password *lm_hash_p = NULL;
struct samr_Password *nt_hash_p = NULL;
- const char *domain = samsync_state->domain_name[database_id];
+ const char *domain;
const char *username = user->account_name.string;
NTSTATUS nt_status;
bool ret = true;
+ switch (database_id) {
+ case SAM_DATABASE_DOMAIN:
+ case SAM_DATABASE_BUILTIN:
+ break;
+ case SAM_DATABASE_PRIVS:
+ torture_comment(tctx, "DOMAIN entry on privs DB!\n");
+ return false;
+ }
+
+ domain = samsync_state->domain_name[database_id];
+
struct samr_OpenUser r;
struct samr_QueryUserInfo q;
union samr_UserInfo *info;
@@ -472,7 +492,8 @@ static bool samsync_handle_user(struct torture_context *tctx, TALLOC_CTX *mem_ct
struct samr_GetGroupsForUser getgroups;
struct samr_RidWithAttributeArray *rids;
- if (!samsync_state->domain_name || !samsync_state->domain_handle[database_id]) {
+ if (domain == NULL ||
+ samsync_state->domain_handle[database_id] == NULL) {
torture_comment(tctx, "SamSync needs domain information before the users\n");
return false;
}
@@ -747,7 +768,17 @@ static bool samsync_handle_alias(struct torture_context *tctx,
union samr_AliasInfo *info;
struct policy_handle alias_handle;
- if (!samsync_state->domain_name || !samsync_state->domain_handle[database_id]) {
+ switch (database_id) {
+ case SAM_DATABASE_DOMAIN:
+ case SAM_DATABASE_BUILTIN:
+ break;
+ case SAM_DATABASE_PRIVS:
+ torture_comment(tctx, "DOMAIN entry on privs DB!\n");
+ return false;
+ }
+
+ if (samsync_state->domain_name[database_id] == NULL ||
+ samsync_state->domain_handle[database_id] == NULL) {
torture_comment(tctx, "SamSync needs domain information before the users\n");
return false;
}
@@ -800,7 +831,17 @@ static bool samsync_handle_group(struct torture_context *tctx,
union samr_GroupInfo *info;
struct policy_handle group_handle;
- if (!samsync_state->domain_name || !samsync_state->domain_handle[database_id]) {
+ switch (database_id) {
+ case SAM_DATABASE_DOMAIN:
+ case SAM_DATABASE_BUILTIN:
+ break;
+ case SAM_DATABASE_PRIVS:
+ torture_comment(tctx, "DOMAIN entry on privs DB!\n");
+ return false;
+ }
+
+ if (samsync_state->domain_name[database_id] == NULL ||
+ samsync_state->domain_handle[database_id] == NULL) {
torture_comment(tctx, "SamSync needs domain information before the users\n");
return false;
}