summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-10-13 02:07:29 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:39:45 -0500
commit4c188e0a1e55ead361a4236bd8d02e198e9296a0 (patch)
treed9b447f85697bb10a306fa9a19c6a3b9f3be05de /source4/torture
parent18bb363537cf486002ce83a12c824b32adbb6470 (diff)
downloadsamba-4c188e0a1e55ead361a4236bd8d02e198e9296a0.tar.gz
samba-4c188e0a1e55ead361a4236bd8d02e198e9296a0.tar.bz2
samba-4c188e0a1e55ead361a4236bd8d02e198e9296a0.zip
r10950: More cracknames variations (including expected values) than you can
poke a stick at... Andrew Bartlett (This used to be commit e4b21300304f8c66c81fa0d15198c640d87db68e)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/drsuapi_cracknames.c92
1 files changed, 76 insertions, 16 deletions
diff --git a/source4/torture/rpc/drsuapi_cracknames.c b/source4/torture/rpc/drsuapi_cracknames.c
index cc4d22424b..9ebeab2a8b 100644
--- a/source4/torture/rpc/drsuapi_cracknames.c
+++ b/source4/torture/rpc/drsuapi_cracknames.c
@@ -210,6 +210,8 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
const char *FQDN_1779_name;
const char *user_principal_name;
const char *service_principal_name;
+ const char *canonical_name;
+ const char *canonical_ex_name;
ZERO_STRUCT(r);
r.in.bind_handle = &priv->bind_handle;
@@ -304,11 +306,11 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return ret;
}
- r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_GUID;
- r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT;
- names[0].str = priv->domain_guid_str;
+ r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT;
+ r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
+ names[0].str = nt4_domain;
- printf("testing DsCrackNames with GUID '%s' desired format:%d\n",
+ printf("testing DsCrackNames with name '%s' desired format:%d\n",
names[0].str, r.in.req.req1.format_desired);
status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r);
@@ -331,9 +333,11 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return ret;
}
+ priv->domain_obj_dn = r.out.ctr.ctr1->array[0].result_name;
+
r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT;
r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
- names[0].str = nt4_domain;
+ names[0].str = talloc_asprintf(mem_ctx, "%s%s$", nt4_domain, test_dc);
printf("testing DsCrackNames with name '%s' desired format:%d\n",
names[0].str, r.in.req.req1.format_desired);
@@ -358,10 +362,10 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return ret;
}
- priv->domain_obj_dn = r.out.ctr.ctr1->array[0].result_name;
+ FQDN_1779_name = r.out.ctr.ctr1->array[0].result_name;
r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT;
- r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
+ r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_CANONICAL;
names[0].str = talloc_asprintf(mem_ctx, "%s%s$", nt4_domain, test_dc);
printf("testing DsCrackNames with name '%s' desired format:%d\n",
@@ -387,12 +391,11 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return ret;
}
- FQDN_1779_name = r.out.ctr.ctr1->array[0].result_name;
+ canonical_name = r.out.ctr.ctr1->array[0].result_name;
- r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL;
- r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
- names[0].str = talloc_asprintf(mem_ctx, "%s$@%s", test_dc, dns_domain);
- user_principal_name = names[0].str;
+ r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT;
+ r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX;
+ names[0].str = talloc_asprintf(mem_ctx, "%s%s$", nt4_domain, test_dc);
printf("testing DsCrackNames with name '%s' desired format:%d\n",
names[0].str, r.in.req.req1.format_desired);
@@ -417,11 +420,9 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return ret;
}
- if (strcmp(r.out.ctr.ctr1->array[0].result_name, FQDN_1779_name) != 0) {
- printf("DsCrackNames failed - %s != %s\n", r.out.ctr.ctr1->array[0].result_name, FQDN_1779_name);
- return False;
- }
+ canonical_ex_name = r.out.ctr.ctr1->array[0].result_name;
+ user_principal_name = talloc_asprintf(mem_ctx, "%s$@%s", test_dc, dns_domain);
service_principal_name = talloc_asprintf(mem_ctx, "HOST/%s", test_dc);
{
@@ -432,8 +433,16 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
const char *str;
const char *expected_str;
enum drsuapi_DsNameStatus status;
+ enum drsuapi_DsNameFlags flags;
} crack[] = {
{
+ .format_offered = DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL,
+ .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779,
+ .str = user_principal_name,
+ .expected_str = FQDN_1779_name,
+ .status = DRSUAPI_DS_NAME_STATUS_OK
+ },
+ {
.format_offered = DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL,
.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779,
.str = service_principal_name,
@@ -452,10 +461,36 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
.format_offered = DRSUAPI_DS_NAME_FORMAT_FQDN_1779,
.format_desired = DRSUAPI_DS_NAME_FORMAT_CANONICAL,
.str = FQDN_1779_name,
+ .expected_str = canonical_name,
+ .status = DRSUAPI_DS_NAME_STATUS_OK
+ },
+ {
+ .format_offered = DRSUAPI_DS_NAME_FORMAT_FQDN_1779,
+ .format_desired = DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX,
+ .str = FQDN_1779_name,
+ .expected_str = canonical_ex_name,
.status = DRSUAPI_DS_NAME_STATUS_OK
},
{
.format_offered = DRSUAPI_DS_NAME_FORMAT_FQDN_1779,
+ .format_desired = DRSUAPI_DS_NAME_FORMAT_CANONICAL,
+ .str = FQDN_1779_name,
+ .comment = "DN to cannoical syntactial only",
+ .status = DRSUAPI_DS_NAME_STATUS_OK,
+ .expected_str = canonical_name,
+ .flags = DRSUAPI_DS_NAME_FLAG_SYNTACTICAL_ONLY
+ },
+ {
+ .format_offered = DRSUAPI_DS_NAME_FORMAT_FQDN_1779,
+ .format_desired = DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX,
+ .str = FQDN_1779_name,
+ .comment = "DN to cannoical EX syntactial only",
+ .status = DRSUAPI_DS_NAME_STATUS_OK,
+ .expected_str = canonical_ex_name,
+ .flags = DRSUAPI_DS_NAME_FLAG_SYNTACTICAL_ONLY
+ },
+ {
+ .format_offered = DRSUAPI_DS_NAME_FORMAT_FQDN_1779,
.format_desired = DRSUAPI_DS_NAME_FORMAT_DISPLAY,
.str = FQDN_1779_name,
.status = DRSUAPI_DS_NAME_STATUS_OK
@@ -467,6 +502,30 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
.status = DRSUAPI_DS_NAME_STATUS_OK
},
{
+ .format_offered = DRSUAPI_DS_NAME_FORMAT_GUID,
+ .format_desired = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT,
+ .str = priv->domain_guid_str,
+ .comment = "Domain GUID to NT4 ACCOUNT",
+ .expected_str = nt4_domain,
+ .status = DRSUAPI_DS_NAME_STATUS_OK
+ },
+ {
+ .format_offered = DRSUAPI_DS_NAME_FORMAT_GUID,
+ .format_desired = DRSUAPI_DS_NAME_FORMAT_CANONICAL,
+ .str = priv->domain_guid_str,
+ .comment = "Domain GUID to Canonical",
+ .expected_str = talloc_asprintf(mem_ctx, "%s/", dns_domain),
+ .status = DRSUAPI_DS_NAME_STATUS_OK
+ },
+ {
+ .format_offered = DRSUAPI_DS_NAME_FORMAT_GUID,
+ .format_desired = DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX,
+ .str = priv->domain_guid_str,
+ .comment = "Domain GUID to Canonical EX",
+ .expected_str = talloc_asprintf(mem_ctx, "%s\n", dns_domain),
+ .status = DRSUAPI_DS_NAME_STATUS_OK
+ },
+ {
.format_offered = DRSUAPI_DS_NAME_FORMAT_DISPLAY,
.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779,
.str = "CN=Microsoft Corporation,L=Redmond,S=Washington,C=US",
@@ -631,6 +690,7 @@ BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
int i;
for (i=0; i < ARRAY_SIZE(crack); i++) {
+ r.in.req.req1.format_flags = crack[i].flags;
r.in.req.req1.format_offered = crack[i].format_offered;
r.in.req.req1.format_desired = crack[i].format_desired;
names[0].str = crack[i].str;