diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-04-05 16:21:14 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-04-05 23:46:04 +0200 |
commit | 86baefe2245a74f1777418b1e2c7b97e33c42529 (patch) | |
tree | d0ba0dbeeac6ae85cf4c2ffcff18898560baa987 /source4 | |
parent | 663dc94e630910b0b5b61801a03622641b2b83b4 (diff) | |
download | samba-86baefe2245a74f1777418b1e2c7b97e33c42529.tar.gz samba-86baefe2245a74f1777418b1e2c7b97e33c42529.tar.bz2 samba-86baefe2245a74f1777418b1e2c7b97e33c42529.zip |
kdc: always ldb escape the realm
Diffstat (limited to 'source4')
-rw-r--r-- | source4/kdc/db-glue.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source4/kdc/db-glue.c b/source4/kdc/db-glue.c index 6ef928caa1..732e553ca3 100644 --- a/source4/kdc/db-glue.c +++ b/source4/kdc/db-glue.c @@ -1002,9 +1002,19 @@ static krb5_error_code samba_kdc_lookup_trust(krb5_context context, struct ldb_c const char * const *attrs = trust_attrs; struct ldb_result *res = NULL; - filter = talloc_asprintf(mem_ctx, "(&(objectClass=trustedDomain)(|(flatname=%s)(trustPartner=%s)))", realm, realm); + char *realm_encoded = ldb_binary_encode_string(mem_ctx, realm); + if (!realm_encoded) { + if (!filter) { + ret = ENOMEM; + krb5_set_error_message(context, ret, "talloc_asprintf: out of memory"); + return ret; + } + } + filter = talloc_asprintf(mem_ctx, "(&(objectClass=trustedDomain)(|(flatname=%s)(trustPartner=%s)))", + realm_encoded, realm_encoded); if (!filter) { + talloc_free(realm_encoded); ret = ENOMEM; krb5_set_error_message(context, ret, "talloc_asprintf: out of memory"); return ret; |