From ed9a50d3bb49a44ad441943db2e0746b2d138d31 Mon Sep 17 00:00:00 2001 From: op Date: Thu, 4 Jan 2024 09:30:09 +0000 Subject: [PATCH] set_localaddrs(): don't wrap IPv6s address with braces twice ss_to_text() already wraps ipv6 addresses in braces, so no need to do it again and no need to do that for IPv4 addresses too. ok millert@ --- usr.sbin/smtpd/config.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/usr.sbin/smtpd/config.c b/usr.sbin/smtpd/config.c index a93e09cb6cf..c13d2bef933 100644 --- a/usr.sbin/smtpd/config.c +++ b/usr.sbin/smtpd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.57 2021/06/14 17:58:15 eric Exp $ */ +/* $OpenBSD: config.c,v 1.58 2024/01/04 09:30:09 op Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -171,7 +171,6 @@ set_localaddrs(struct smtpd *conf, struct table *localnames) struct sockaddr_in *sain; struct sockaddr_in6 *sin6; struct table *t; - char buf[NI_MAXHOST + 5]; t = table_create(conf, "static", "", NULL); table_add(t, "local", NULL); @@ -194,8 +193,6 @@ set_localaddrs(struct smtpd *conf, struct table *localnames) sain->sin_len = sizeof(struct sockaddr_in); table_add(t, ss_to_text(&ss), NULL); table_add(localnames, ss_to_text(&ss), NULL); - (void)snprintf(buf, sizeof buf, "[%s]", ss_to_text(&ss)); - table_add(localnames, buf, NULL); break; case AF_INET6: @@ -215,10 +212,6 @@ set_localaddrs(struct smtpd *conf, struct table *localnames) #endif table_add(t, ss_to_text(&ss), NULL); table_add(localnames, ss_to_text(&ss), NULL); - (void)snprintf(buf, sizeof buf, "[%s]", ss_to_text(&ss)); - table_add(localnames, buf, NULL); - (void)snprintf(buf, sizeof buf, "[ipv6:%s]", ss_to_text(&ss)); - table_add(localnames, buf, NULL); break; } } -- 2.20.1