summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-10-20 01:48:11 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:44:59 -0500
commitddb1c4aa136733b01e7a9505b1131e04804234b6 (patch)
tree18baa930d2d83a6a20fedd0bb61f7426bc841965
parent1e6049988018c71abb0f46d1a07c535b69d1df8f (diff)
downloadsamba-ddb1c4aa136733b01e7a9505b1131e04804234b6.tar.gz
samba-ddb1c4aa136733b01e7a9505b1131e04804234b6.tar.bz2
samba-ddb1c4aa136733b01e7a9505b1131e04804234b6.zip
r11194: Use the special ldb attribute "canonicalName" (therefore testing that
codepath) in DRSUAPI CrackNames. Fix the NT4 account return value. Andrew Bartlett (This used to be commit 2513c02c64b489ebf167e33fdb4ac51ce8783c04)
-rw-r--r--source4/rpc_server/drsuapi/drsuapi_cracknames.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/source4/rpc_server/drsuapi/drsuapi_cracknames.c b/source4/rpc_server/drsuapi/drsuapi_cracknames.c
index c1a6c19978..81a10f01e6 100644
--- a/source4/rpc_server/drsuapi/drsuapi_cracknames.c
+++ b/source4/rpc_server/drsuapi/drsuapi_cracknames.c
@@ -501,7 +501,6 @@ static WERROR DsCrackNameOneFilter(struct drsuapi_bind_state *b_state, TALLOC_CT
/* here we need to set the attrs lists for domain and result lookups */
switch (format_desired) {
case DRSUAPI_DS_NAME_FORMAT_FQDN_1779:
- case DRSUAPI_DS_NAME_FORMAT_CANONICAL:
case DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX: {
const char * const _domain_attrs[] = { "ncName", "dnsRoot", NULL};
const char * const _result_attrs[] = { NULL};
@@ -510,6 +509,14 @@ static WERROR DsCrackNameOneFilter(struct drsuapi_bind_state *b_state, TALLOC_CT
result_attrs = _result_attrs;
break;
}
+ case DRSUAPI_DS_NAME_FORMAT_CANONICAL: {
+ const char * const _domain_attrs[] = { "ncName", "dnsRoot", NULL};
+ const char * const _result_attrs[] = { "canonicalName", NULL };
+
+ domain_attrs = _domain_attrs;
+ result_attrs = _result_attrs;
+ break;
+ }
case DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT: {
const char * const _domain_attrs[] = { "ncName", "dnsRoot", "nETBIOSName", NULL};
const char * const _result_attrs[] = { "sAMAccountName", "objectSid", NULL};
@@ -614,16 +621,18 @@ static WERROR DsCrackNameOneFilter(struct drsuapi_bind_state *b_state, TALLOC_CT
info1->status = DRSUAPI_DS_NAME_STATUS_OK;
return WERR_OK;
}
- case DRSUAPI_DS_NAME_FORMAT_CANONICAL:
- return DsCrackNameOneSyntactical(mem_ctx,
- DRSUAPI_DS_NAME_FORMAT_FQDN_1779,
- DRSUAPI_DS_NAME_FORMAT_CANONICAL,
- result_res[0]->dn, name, info1);
- case DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX:
+ case DRSUAPI_DS_NAME_FORMAT_CANONICAL: {
+ info1->result_name = samdb_result_string(result_res[0], "canonicalName", NULL);
+ info1->status = DRSUAPI_DS_NAME_STATUS_OK;
+ return WERR_OK;
+ }
+ case DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX: {
+ /* Not in the virtual ldb attribute */
return DsCrackNameOneSyntactical(mem_ctx,
DRSUAPI_DS_NAME_FORMAT_FQDN_1779,
DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX,
result_res[0]->dn, name, info1);
+ }
case DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT: {
const struct dom_sid *sid = samdb_result_dom_sid(mem_ctx, result_res[0], "objectSid");
const char *_acc = "", *_dom = "";
@@ -651,14 +660,14 @@ static WERROR DsCrackNameOneFilter(struct drsuapi_bind_state *b_state, TALLOC_CT
return WERR_OK;
}
dom_sid->num_auths--;
- ldb_ret = gendb_search(b_state->sam_ctx, mem_ctx, NULL, &domain_res2, attrs,
+ ldb_ret = gendb_search(b_state->sam_ctx, mem_ctx, NULL, &domain_res, attrs,
"(objectSid=%s)", ldap_encode_ndr_dom_sid(mem_ctx, dom_sid));
if (ldb_ret != 1) {
info1->status = DRSUAPI_DS_NAME_STATUS_NOT_FOUND;
return WERR_OK;
}
- ldb_ret = gendb_search(b_state->sam_ctx, mem_ctx, NULL, &domain_res, domain_attrs,
- "(ncName=%s)", ldb_dn_linearize(mem_ctx, domain_res2[0]->dn));
+ ldb_ret = gendb_search(b_state->sam_ctx, mem_ctx, NULL, &domain_res2, domain_attrs,
+ "(ncName=%s)", ldb_dn_linearize(mem_ctx, domain_res[0]->dn));
if (ldb_ret != 1) {
info1->status = DRSUAPI_DS_NAME_STATUS_NOT_FOUND;
return WERR_OK;
@@ -711,7 +720,7 @@ static WERROR DsCrackNameOneFilter(struct drsuapi_bind_state *b_state, TALLOC_CT
drsuapi_DsCrackNames
*/
WERROR dcesrv_drsuapi_DsCrackNames(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct drsuapi_DsCrackNames *r)
+ struct drsuapi_DsCrackNames *r)
{
WERROR status;
struct drsuapi_bind_state *b_state;