summaryrefslogtreecommitdiff
path: root/src/providers/ipa
diff options
context:
space:
mode:
authorOndrej Kos <okos@redhat.com>2012-08-21 16:03:32 +0200
committerJakub Hrozek <jhrozek@redhat.com>2012-08-23 14:25:23 +0200
commite4c29d1f8e3b2c2b268105f169e5156a0a36aebf (patch)
tree5e2940d4366e363d993e63a90693282acfffce32 /src/providers/ipa
parente523233315f44b8f77ab9c5143a3d80364ebf955 (diff)
downloadsssd-e4c29d1f8e3b2c2b268105f169e5156a0a36aebf.tar.gz
sssd-e4c29d1f8e3b2c2b268105f169e5156a0a36aebf.tar.bz2
sssd-e4c29d1f8e3b2c2b268105f169e5156a0a36aebf.zip
Consolidation of functions that make realm upper-case
Diffstat (limited to 'src/providers/ipa')
-rw-r--r--src/providers/ipa/ipa_common.c10
-rw-r--r--src/providers/ipa/ipa_subdomains.c18
2 files changed, 3 insertions, 25 deletions
diff --git a/src/providers/ipa/ipa_common.c b/src/providers/ipa/ipa_common.c
index 6ad67845..2e504738 100644
--- a/src/providers/ipa/ipa_common.c
+++ b/src/providers/ipa/ipa_common.c
@@ -47,7 +47,6 @@ int ipa_get_options(TALLOC_CTX *memctx,
char *realm;
char *ipa_hostname;
int ret;
- int i;
char hostname[HOST_NAME_MAX + 1];
opts = talloc_zero(memctx, struct ipa_options);
@@ -95,18 +94,13 @@ int ipa_get_options(TALLOC_CTX *memctx,
/* First check whether the realm has been manually specified */
realm = dp_opt_get_string(opts->basic, IPA_KRB5_REALM);
if (!realm) {
- /* No explicit krb5_realm, use the IPA domain */
- realm = talloc_strdup(opts, domain);
+ /* No explicit krb5_realm, use the IPA domain, transform to upper-case */
+ realm = get_uppercase_realm(opts, domain);
if (!realm) {
ret = ENOMEM;
goto done;
}
- /* Use the upper-case IPA domain for the kerberos realm */
- for (i = 0; realm[i]; i++) {
- realm[i] = toupper(realm[i]);
- }
-
ret = dp_opt_set_string(opts->basic, IPA_KRB5_REALM,
realm);
if (ret != EOK) {
diff --git a/src/providers/ipa/ipa_subdomains.c b/src/providers/ipa/ipa_subdomains.c
index 98c7de34..1da2b8cd 100644
--- a/src/providers/ipa/ipa_subdomains.c
+++ b/src/providers/ipa/ipa_subdomains.c
@@ -178,22 +178,6 @@ 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_subdom_parse(TALLOC_CTX *memctx,
struct sysdb_attrs *attrs,
struct sysdb_subdom *subdom)
@@ -219,7 +203,7 @@ static errno_t ipa_subdom_parse(TALLOC_CTX *memctx,
if (subdom->realm == NULL) {
/* Add Realm as upper(domain name), this is generally always correct
* with AD domains */
- subdom->realm = name_to_realm(memctx, subdom->name);
+ subdom->realm = get_uppercase_realm(memctx, subdom->name);
if (!subdom->realm) {
return ENOMEM;
}