diff options
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; |