summaryrefslogtreecommitdiff
path: root/source4/rpc_server/drsuapi/drsuapi_cracknames.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-08-03 07:24:42 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:31:05 -0500
commit14fd6efaf5bfa5fe069373f1dd46c84c0872bc1a (patch)
tree10216ada59b82843f1af3b29076b94c4eb24323d /source4/rpc_server/drsuapi/drsuapi_cracknames.c
parentd2e099c37d27b345cc21664b9848a464ed5f6d59 (diff)
downloadsamba-14fd6efaf5bfa5fe069373f1dd46c84c0872bc1a.tar.gz
samba-14fd6efaf5bfa5fe069373f1dd46c84c0872bc1a.tar.bz2
samba-14fd6efaf5bfa5fe069373f1dd46c84c0872bc1a.zip
r8998: More work on the RPC server code to avoid abusing the name attribute
as a netbios name. Andrew Bartlett (This used to be commit 242db48b98a04eed46bb35946dcd68b579bffe00)
Diffstat (limited to 'source4/rpc_server/drsuapi/drsuapi_cracknames.c')
-rw-r--r--source4/rpc_server/drsuapi/drsuapi_cracknames.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/source4/rpc_server/drsuapi/drsuapi_cracknames.c b/source4/rpc_server/drsuapi/drsuapi_cracknames.c
index f915c8a1b6..e9b78b184b 100644
--- a/source4/rpc_server/drsuapi/drsuapi_cracknames.c
+++ b/source4/rpc_server/drsuapi/drsuapi_cracknames.c
@@ -58,18 +58,19 @@ static WERROR DsCrackNameOneName(struct drsuapi_bind_state *b_state, TALLOC_CTX
case DRSUAPI_DS_NAME_FORMAT_CANONICAL: {
char *str;
- str = talloc_asprintf(mem_ctx, "%s/", lp_realm());
+ str = talloc_strdup(mem_ctx, name);
WERR_TALLOC_CHECK(str);
-
- ret = strcasecmp(str, name);
- talloc_free(str);
- if (ret != 0) {
- info1->status = DRSUAPI_DS_NAME_STATUS_NOT_FOUND;
+
+ if (strlen(str) == 0 || str[strlen(str)-1] != '/') {
+ info1->status = DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR;
return WERR_OK;
}
+
+ str[strlen(str)-1] = '\0';
- domain_filter = talloc_asprintf(mem_ctx, "(&(objectClass=domainDNS)(name=%s))",
- lp_workgroup());
+ domain_filter = talloc_asprintf(mem_ctx,
+ "(&(&(&(dnsRoot=%s)(objectclass=crossRef)))(nETBIOSName=*)(ncName=*))",
+ str);
WERR_TALLOC_CHECK(domain_filter);
break;