From 3d0e367a975b0546e3ed2bf99080ee6c7eb8514c Mon Sep 17 00:00:00 2001 From: jmatthew Date: Tue, 23 Aug 2022 02:57:27 +0000 Subject: [PATCH] log a warning if we can't resolve the ldap server hostname --- usr.sbin/ypldap/ypldap_dns.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/usr.sbin/ypldap/ypldap_dns.c b/usr.sbin/ypldap/ypldap_dns.c index 6c3ac0e2bc4..59835a80e5c 100644 --- a/usr.sbin/ypldap/ypldap_dns.c +++ b/usr.sbin/ypldap/ypldap_dns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypldap_dns.c,v 1.14 2021/10/09 18:43:50 deraadt Exp $ */ +/* $OpenBSD: ypldap_dns.c,v 1.15 2022/08/23 02:57:27 jmatthew Exp $ */ /* * Copyright (c) 2003-2008 Henning Brauer @@ -217,11 +217,12 @@ host_dns(const char *s, struct ypldap_addr_list *hn) hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; /* DUMMY */ error = getaddrinfo(s, NULL, &hints, &res0); - if (error == EAI_AGAIN || error == EAI_NODATA || error == EAI_NONAME) - return (0); - if (error) { - log_warnx("could not parse \"%s\": %s", s, + if (error != 0) { + log_warnx("could not resolve \"%s\": %s", s, gai_strerror(error)); + if (error == EAI_AGAIN || error == EAI_NODATA || + error == EAI_NONAME) + return (0); return (-1); } -- 2.20.1