Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/net Handle herrors properly so that postfix can ret...
details: https://anonhg.NetBSD.org/src/rev/06a4609b0024
branches: trunk
changeset: 340647:06a4609b0024
user: christos <christos%NetBSD.org@localhost>
date: Tue Sep 22 14:46:09 2015 +0000
description:
Handle herrors properly so that postfix can return 4XX codes when appropriate.
Pointed out by Viktor Dukhovni.
diffstat:
lib/libc/net/getnameinfo.c | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diffs (51 lines):
diff -r 5436f58ca05c -r 06a4609b0024 lib/libc/net/getnameinfo.c
--- a/lib/libc/net/getnameinfo.c Tue Sep 22 13:28:02 2015 +0000
+++ b/lib/libc/net/getnameinfo.c Tue Sep 22 14:46:09 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getnameinfo.c,v 1.57 2015/09/03 15:01:19 christos Exp $ */
+/* $NetBSD: getnameinfo.c,v 1.58 2015/09/22 14:46:09 christos Exp $ */
/* $KAME: getnameinfo.c,v 1.45 2000/09/25 22:43:56 itojun Exp $ */
/*
@@ -47,7 +47,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getnameinfo.c,v 1.57 2015/09/03 15:01:19 christos Exp $");
+__RCSID("$NetBSD: getnameinfo.c,v 1.58 2015/09/22 14:46:09 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#ifndef RUMP_ACTION
@@ -64,6 +64,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
+#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <netdb.h>
@@ -404,8 +405,22 @@
}
strlcpy(host, hp->h_name, hostlen);
} else {
- if (flags & NI_NAMEREQD)
- return EAI_NONAME;
+ switch (he) {
+ case NETDB_INTERNAL:
+ case NO_RECOVERY:
+ return EAI_SYSTEM;
+ case NO_DATA:
+ case HOST_NOT_FOUND:
+ if (flags & NI_NAMEREQD)
+ return EAI_NONAME;
+ break;
+ case TRY_AGAIN:
+ return EAI_AGAIN;
+ case NETDB_SUCCESS:
+ /*FALLTHROUGH*/
+ default:
+ abort();
+ }
switch(afd->a_af) {
#ifdef INET6
case AF_INET6:
Home |
Main Index |
Thread Index |
Old Index