bin/89799: Making natd not require a newline at the end of a
dev at fenux.net
Thu Dec 1 16:00:16 GMT 2005
>Synopsis: Making natd not require a newline at the end of a configuration file.
>Arrival-Date: Thu Dec 01 16:00:11 GMT 2005
>Originator: Jason Burgess
FreeBSD saturn.fbfguns.com 5.4-STABLE FreeBSD 5.4-STABLE #2: Tue Oct 11 11:48:46 CDT 2005 root at saturn.fbfguns.com:/usr/obj/usr/src/sys/SATURN i386
When using the -f option with natd to load a config file, the config file is required to contain a newline at the end of the file. If you forget and are restarting natd remotely, you may lose access to the machine to fix the error.
I know that this has caused great inconvenience for me to have to drive to my office to fix the problem when I've forgotten the newline at the end of the file. I am submitting a patch to correct the issue.
Load a config file into natd without a newline at the end of it.
--- natd.c Thu Dec 1 09:45:19 2005
+++ natd.c.orig Thu Dec 1 09:44:48 2005
@@ -1498,17 +1498,8 @@
if (buf[len - 1] == '\n')
buf[len - 1] = '\0';
- if (buf[len - 1] != '\0')
- buf = strcat(buf, "\0");
- * This is being changed to correct the problem instead.
- * errx(1, "config file format error: "
- * "last line should end with newline");
+ errx(1, "config file format error: "
+ "last line should end with newline");
* Check for comments, strip off trailing spaces.
More information about the freebsd-bugs