Blob Blame History Raw
From 529c7ade2f7f633fdb80e2f5b2055afd5a017d2f Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek@redhat.com>
Date: Tue, 11 Feb 2014 15:36:04 +0100
Subject: [PATCH 86/88] IPA: Default to krb5_use_fast=try
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Reviewed-by: Nathaniel McCallum <npmccallum@redhat.com>
Reviewed-by: Alexander Bokovoy <abokovoy@redhat.com>
---
 src/providers/ipa/ipa_common.c | 27 +++++++++++++++++++++++++++
 src/providers/ipa/ipa_opts.h   |  2 +-
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/src/providers/ipa/ipa_common.c b/src/providers/ipa/ipa_common.c
index 671374098afa1f2e00fc9cf1788ba4383b600a1b..e0abd169302406a555728589185b67e0fbbcfe94 100644
--- a/src/providers/ipa/ipa_common.c
+++ b/src/providers/ipa/ipa_common.c
@@ -664,6 +664,33 @@ int ipa_get_auth_options(struct ipa_options *ipa_opts,
                   dp_opt_get_string(ipa_opts->auth, KRB5_REALM)));
     }
 
+    /* If krb5_fast_principal was not set explicitly, default to
+     * host/$client_hostname
+     */
+    value = dp_opt_get_string(ipa_opts->auth, KRB5_FAST_PRINCIPAL);
+    if (value == NULL) {
+        value = talloc_asprintf(ipa_opts->auth, "host/%s",
+                                    dp_opt_get_string(ipa_opts->basic,
+                                                      IPA_HOSTNAME));
+        if (value == NULL) {
+            DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot set %s!\n",
+                     ipa_opts->auth[KRB5_FAST_PRINCIPAL].opt_name));
+            ret = ENOMEM;
+            goto done;
+        }
+
+        ret = dp_opt_set_string(ipa_opts->auth, KRB5_FAST_PRINCIPAL,
+                                value);
+        if (ret != EOK) {
+            DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot set %s!\n",
+                     ipa_opts->auth[KRB5_FAST_PRINCIPAL].opt_name));
+            goto done;
+        }
+
+        DEBUG(SSSDBG_CONF_SETTINGS, ("Option %s set to %s\n",
+              ipa_opts->auth[KRB5_FAST_PRINCIPAL].opt_name, value));
+    }
+
     /* Set flag that controls whether we want to write the
      * kdcinfo files at all
      */
diff --git a/src/providers/ipa/ipa_opts.h b/src/providers/ipa/ipa_opts.h
index 27dc3e2f977383836c18cb824abceb03c9e9056c..c46d421ad0bfb9272cbdadbfeea5ebcf65a7deb1 100644
--- a/src/providers/ipa/ipa_opts.h
+++ b/src/providers/ipa/ipa_opts.h
@@ -274,7 +274,7 @@ struct dp_option ipa_def_krb5_opts[] = {
     { "krb5_renewable_lifetime", DP_OPT_STRING, NULL_STRING, NULL_STRING },
     { "krb5_lifetime", DP_OPT_STRING, NULL_STRING, NULL_STRING },
     { "krb5_renew_interval", DP_OPT_STRING, NULL_STRING, NULL_STRING },
-    { "krb5_use_fast", DP_OPT_STRING, NULL_STRING, NULL_STRING },
+    { "krb5_use_fast", DP_OPT_STRING, { "try" }, NULL_STRING },
     { "krb5_fast_principal", DP_OPT_STRING, NULL_STRING, NULL_STRING },
     { "krb5_canonicalize", DP_OPT_BOOL, BOOL_TRUE, BOOL_TRUE },
     { "krb5_use_enterprise_principal", DP_OPT_BOOL, BOOL_FALSE, BOOL_FALSE },
-- 
1.8.5.3