From b096321a5a02dda0b6b71ba0f9c4d8feacd979e4 Mon Sep 17 00:00:00 2001 From: Michal Zidek Date: Wed, 22 Aug 2012 15:16:26 +0200 Subject: Fix: IPv6 address with square brackets doesn't work. https://fedorahosted.org/sssd/ticket/1365 --- src/providers/krb5/krb5_common.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/providers/krb5') diff --git a/src/providers/krb5/krb5_common.c b/src/providers/krb5/krb5_common.c index bd7a3021..0e96b806 100644 --- a/src/providers/krb5/krb5_common.c +++ b/src/providers/krb5/krb5_common.c @@ -520,7 +520,13 @@ errno_t krb5_servers_init(struct be_ctx *ctx, continue; } - port_str = strrchr(server_spec, ':'); + /* Do not try to get port number if last character is ']' */ + if (server_spec[strlen(server_spec) - 1] != ']') { + port_str = strrchr(server_spec, ':'); + } else { + port_str = NULL; + } + if (port_str == NULL) { port = 0; } else { @@ -564,6 +570,13 @@ errno_t krb5_servers_init(struct be_ctx *ctx, } } + /* It could be ipv6 address in square brackets. Remove + * the brackets if needed. */ + ret = remove_ipv6_brackets(server_spec); + if (ret != EOK) { + goto done; + } + ret = be_fo_add_server(ctx, service_name, server_spec, (int) port, list[i], primary); if (ret && ret != EEXIST) { -- cgit