diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2011-07-16 18:00:40 +0200 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2011-07-21 08:23:17 -0400 |
commit | 9b85268eabe33d624b9d184251e89c0c7ae829a2 (patch) | |
tree | 21ccb9734873f246657a78fb4cb8b60032b20075 /src/providers/ipa | |
parent | 363d2fba991eae199d017f5b2d1b458f070fac6b (diff) | |
download | sssd-9b85268eabe33d624b9d184251e89c0c7ae829a2.tar.gz sssd-9b85268eabe33d624b9d184251e89c0c7ae829a2.tar.bz2 sssd-9b85268eabe33d624b9d184251e89c0c7ae829a2.zip |
fo_get_server_name() getter for a server name
Allows to be more concise in tests and more defensive in resolve
callbacks
Diffstat (limited to 'src/providers/ipa')
-rw-r--r-- | src/providers/ipa/ipa_common.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/providers/ipa/ipa_common.c b/src/providers/ipa/ipa_common.c index 70272a2a..08b05126 100644 --- a/src/providers/ipa/ipa_common.c +++ b/src/providers/ipa/ipa_common.c @@ -602,6 +602,7 @@ static void ipa_resolve_callback(void *private_data, struct fo_server *server) char *address; const char *safe_address; char *new_uri; + const char *srv_name; int ret; tmp_ctx = talloc_new(NULL); @@ -639,7 +640,14 @@ static void ipa_resolve_callback(void *private_data, struct fo_server *server) return; } - new_uri = talloc_asprintf(service, "ldap://%s", fo_get_server_str_name(server)); + srv_name = fo_get_server_name(server); + if (srv_name == NULL) { + DEBUG(1, ("Could not get server host name\n")); + talloc_free(tmp_ctx); + return; + } + + new_uri = talloc_asprintf(service, "ldap://%s", srv_name); if (!new_uri) { DEBUG(2, ("Failed to copy URI ...\n")); talloc_free(tmp_ctx); |