summaryrefslogtreecommitdiff
path: root/source4/auth
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-12-19 07:07:11 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:47:30 -0500
commitbceca723044e9cf5d835e8d732be3ab57906505e (patch)
treeb830194679166aa8a30285fd966a5f250c73f414 /source4/auth
parent6bd8be867130686946e687512d7a4a68934217e1 (diff)
downloadsamba-bceca723044e9cf5d835e8d732be3ab57906505e.tar.gz
samba-bceca723044e9cf5d835e8d732be3ab57906505e.tar.bz2
samba-bceca723044e9cf5d835e8d732be3ab57906505e.zip
r12361: Add a new function: ldb_binary_encode_string()
This is for use on user-supplied arguments to printf style format strings which will become ldb filters. I have used it on LSA, SAMR and the auth/ code so far. Also add comments to cracknames code. Andrew Bartlett (This used to be commit 8308cf6e0472790c1c9d521d19322557907f4418)
Diffstat (limited to 'source4/auth')
-rw-r--r--source4/auth/auth_sam.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source4/auth/auth_sam.c b/source4/auth/auth_sam.c
index e65a5c70f6..95a7702822 100644
--- a/source4/auth/auth_sam.c
+++ b/source4/auth/auth_sam.c
@@ -280,10 +280,11 @@ static NTSTATUS authsam_search_account(TALLOC_CTX *mem_ctx, struct ldb_context *
const struct ldb_dn *domain_dn = NULL;
if (domain_name) {
+ char *escaped_domain = ldb_binary_encode_string(mem_ctx, domain_name);
/* find the domain's DN */
ret_domain = gendb_search(sam_ctx, mem_ctx, NULL, &msgs_domain_ref, domain_ref_attrs,
"(&(&(|(&(dnsRoot=%s)(nETBIOSName=*))(nETBIOSName=%s))(objectclass=crossRef))(ncName=*))",
- domain_name, domain_name);
+ escaped_domain, escaped_domain);
if (ret_domain == -1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@@ -306,7 +307,7 @@ static NTSTATUS authsam_search_account(TALLOC_CTX *mem_ctx, struct ldb_context *
/* pull the user attributes */
ret = gendb_search(sam_ctx, mem_ctx, domain_dn, &msgs, user_attrs,
"(&(sAMAccountName=%s)(objectclass=user))",
- account_name);
+ ldb_binary_encode_string(mem_ctx, account_name));
if (ret == -1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}