summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2010-07-22 15:54:28 +0200
committerStephen Gallagher <sgallagh@redhat.com>2010-08-03 13:50:28 -0400
commit13d90c2ae8413317947d392c89fffca10ec83587 (patch)
treec0a29d768f49a5c0dd150d73912cb71fcc2d2055
parent8f7d6fac40cc2150e66701b00cba32d7dbe59a38 (diff)
downloadsssd-13d90c2ae8413317947d392c89fffca10ec83587.tar.gz
sssd-13d90c2ae8413317947d392c89fffca10ec83587.tar.xz
sssd-13d90c2ae8413317947d392c89fffca10ec83587.zip
Fix getting default realm in the ldap child
-rw-r--r--src/providers/ldap/ldap_child.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/providers/ldap/ldap_child.c b/src/providers/ldap/ldap_child.c
index 8ad0ad1f6..17c26855e 100644
--- a/src/providers/ldap/ldap_child.c
+++ b/src/providers/ldap/ldap_child.c
@@ -133,6 +133,7 @@ static int ldap_child_get_tgt_sync(TALLOC_CTX *memctx,
char *ccname;
char *realm_name = NULL;
char *full_princ = NULL;
+ char *default_realm = NULL;
krb5_context context = NULL;
krb5_keytab keytab = NULL;
krb5_ccache ccache = NULL;
@@ -155,13 +156,21 @@ static int ldap_child_get_tgt_sync(TALLOC_CTX *memctx,
}
if (!realm_str) {
- krberr = krb5_get_default_realm(context, &realm_name);
+ krberr = krb5_get_default_realm(context, &default_realm);
if (krberr) {
DEBUG(2, ("Failed to get default realm name: %s\n",
sss_krb5_get_error_message(context, krberr)));
ret = EFAULT;
goto done;
}
+
+ realm_name = talloc_strdup(memctx, default_realm);
+ krb5_free_default_realm(context, default_realm);
+ if (!realm_name) {
+ ret = ENOMEM;
+ goto done;
+ }
+
} else {
realm_name = talloc_strdup(memctx, realm_str);
if (!realm_name) {