summaryrefslogtreecommitdiff
path: root/src/providers/ipa
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2012-07-19 19:15:57 -0400
committerJakub Hrozek <jhrozek@redhat.com>2012-08-01 22:24:44 +0200
commit204cfc89a076fd32bf34f2abb3f809304aaa88ab (patch)
tree908b05e88f0648b5e22b334f6ea3de53eb139bc0 /src/providers/ipa
parent067bfcaad9baae2d962528839fde30ebd1a5ba2b (diff)
downloadsssd-204cfc89a076fd32bf34f2abb3f809304aaa88ab.tar.gz
sssd-204cfc89a076fd32bf34f2abb3f809304aaa88ab.tar.bz2
sssd-204cfc89a076fd32bf34f2abb3f809304aaa88ab.zip
Add realm paramter to subdomain list
This will be used later for setting domain_realm mappings in krb5.conf
Diffstat (limited to 'src/providers/ipa')
-rw-r--r--src/providers/ipa/ipa_subdomains.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/providers/ipa/ipa_subdomains.c b/src/providers/ipa/ipa_subdomains.c
index e842e24b..8a49c634 100644
--- a/src/providers/ipa/ipa_subdomains.c
+++ b/src/providers/ipa/ipa_subdomains.c
@@ -25,6 +25,7 @@
#include "providers/ldap/sdap_async.h"
#include "providers/ipa/ipa_subdomains.h"
#include "providers/ipa/ipa_common.h"
+#include <ctype.h>
#define SUBDOMAINS_FILTER "objectclass=ipaNTTrustedDomain"
#define MASTER_DOMAIN_FILTER "objectclass=ipaNTDomainAttrs"
@@ -151,6 +152,22 @@ done:
return ret;
}
+static char *name_to_realm(TALLOC_CTX *memctx, const char *name)
+{
+ char *realm;
+ char *p;
+
+ realm = talloc_strdup(memctx, name);
+ if (!realm) {
+ return NULL;
+ }
+ for (p = realm; *p; p++) {
+ *p = toupper(*p);
+ }
+
+ return realm;
+}
+
static errno_t ipa_subdomains_parse_results(struct be_subdom_req *sd_data,
size_t count,
struct sysdb_attrs **reply)
@@ -187,6 +204,16 @@ static errno_t ipa_subdomains_parse_results(struct be_subdom_req *sd_data,
goto done;
}
+ /* Add Realm as upper(domain name), this is generally always correct
+ * with AD domains */
+ new_domain_list[c]->realm = name_to_realm(new_domain_list[c],
+ new_domain_list[c]->name);
+ if (!new_domain_list[c]->realm) {
+ DEBUG(SSSDBG_OP_FAILURE, ("talloc_strdup failed.\n"));
+ ret = ENOMEM;
+ goto done;
+ }
+
ret = sysdb_attrs_get_string(reply[c], IPA_FLATNAME, &value);
if (ret == EOK) {
new_domain_list[c]->flat_name = talloc_strdup(new_domain_list[c],