aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2020-01-10 14:40:04 +0000
committerKyle Evans <kevans@FreeBSD.org>2020-01-10 14:40:04 +0000
commit36cac5570ff0541f62fafbb42eec54ddbf584ca4 (patch)
treed99a38a027ed937dc4c64c020fa4d21dbe55f8f4
parent3898f9bdb3c9f920dac580588e635adab09a961d (diff)
downloadsrc-36cac5570ff0541f62fafbb42eec54ddbf584ca4.tar.gz
src-36cac5570ff0541f62fafbb42eec54ddbf584ca4.zip
inetd: free WITHOUT_INET6_SUPPORT build of warnings
If inetd is compiled without inet6 support, we need to error out on rpc+inet6 services rather than attempting to call into rpc bits with an uninitialized netid. v4bind is only used with INET6 support, so move it under the proper #ifdefs with v6bind. Reported by: Pavel Timofeev <timp87 gmail com> MFC after: 3 days
Notes
Notes: svn path=/head/; revision=356601
-rw-r--r--usr.sbin/inetd/inetd.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c
index f8b95b3eb1be..02a9a9f0df68 100644
--- a/usr.sbin/inetd/inetd.c
+++ b/usr.sbin/inetd/inetd.c
@@ -1360,6 +1360,15 @@ setsockopt(fd, SOL_SOCKET, opt, (char *)&on, sizeof (on))
sock.sin_port = sep->se_ctrladdr6.sin6_port;
}
}
+#else
+ else {
+ syslog(LOG_ERR,
+ "%s/%s: inetd compiled without inet6 support\n",
+ sep->se_service, sep->se_proto);
+ (void) close(sep->se_fd);
+ sep->se_fd = -1;
+ return;
+ }
#endif
if (debug)
print_service("REG ", sep);
@@ -1611,8 +1620,8 @@ getconfigent(void)
#ifdef IPSEC
char *policy;
#endif
- int v4bind;
#ifdef INET6
+ int v4bind;
int v6bind;
#endif
int i;
@@ -1622,8 +1631,8 @@ getconfigent(void)
policy = NULL;
#endif
more:
- v4bind = 0;
#ifdef INET6
+ v4bind = 0;
v6bind = 0;
#endif
while ((cp = nextline(fconfig)) != NULL) {
@@ -1787,7 +1796,9 @@ more:
#endif
if (sep->se_proto[strlen(sep->se_proto) - 1] == '4') {
sep->se_proto[strlen(sep->se_proto) - 1] = '\0';
+#ifdef INET6
v4bind = 1;
+#endif
continue;
}
/* illegal version num */