summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2009-10-28 13:09:51 +0100
committerStephen Gallagher <sgallagh@redhat.com>2009-11-02 15:33:02 -0500
commitf3ee1ed5fa40dcfe4a64c10905ef159ca4069c9f (patch)
tree8694d7dfbae7fc8ba335dfba64e51047c76790d9 /server
parent37c1d615be2745d518792f1ca8a7c2a98ecb12b2 (diff)
downloadsssd-f3ee1ed5fa40dcfe4a64c10905ef159ca4069c9f.tar.gz
sssd-f3ee1ed5fa40dcfe4a64c10905ef159ca4069c9f.tar.bz2
sssd-f3ee1ed5fa40dcfe4a64c10905ef159ca4069c9f.zip
set ipa_hostname if not given in config file
Diffstat (limited to 'server')
-rw-r--r--server/providers/ipa/ipa_common.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/server/providers/ipa/ipa_common.c b/server/providers/ipa/ipa_common.c
index d3249707..3f4d25de 100644
--- a/server/providers/ipa/ipa_common.c
+++ b/server/providers/ipa/ipa_common.c
@@ -144,7 +144,9 @@ int ipa_get_options(TALLOC_CTX *memctx,
struct ipa_options *opts;
char *domain;
char *server;
+ char *ipa_hostname;
int ret;
+ char hostname[HOST_NAME_MAX + 1];
opts = talloc_zero(memctx, struct ipa_options);
if (!opts) return ENOMEM;
@@ -173,6 +175,24 @@ int ipa_get_options(TALLOC_CTX *memctx,
goto done;
}
+ ipa_hostname = dp_opt_get_string(opts->basic, IPA_HOSTNAME);
+ if (ipa_hostname == NULL) {
+ ret = gethostname(hostname, HOST_NAME_MAX);
+ if (ret != EOK) {
+ DEBUG(1, ("gethostname failed [%d][%s].\n", errno,
+ strerror(errno)));
+ ret = errno;
+ goto done;
+ }
+ hostname[HOST_NAME_MAX] = '\0';
+ DEBUG(9, ("Setting ipa_hostname to [%s].\n", hostname));
+ ret = dp_opt_set_string(opts->basic, IPA_HOSTNAME, hostname);
+ if (ret != EOK) {
+ goto done;
+ }
+ }
+
+
ret = EOK;
*_opts = opts;