Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Dec 2005 15:54:48 GMT
From:      Jason Burgess <dev@fenux.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/89799: Making natd not require a newline at the end of a configuration file.
Message-ID:  <200512011554.jB1Fsmuc098612@www.freebsd.org>
Resent-Message-ID: <200512011600.jB1G0C18036293@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         89799
>Category:       bin
>Synopsis:       Making natd not require a newline at the end of a configuration file.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 01 16:00:11 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Jason Burgess
>Release:        5.4-STABLE
>Organization:
HolosTek, Inc.
>Environment:
FreeBSD saturn.fbfguns.com 5.4-STABLE FreeBSD 5.4-STABLE #2: Tue Oct 11 11:48:46 CDT 2005     root@saturn.fbfguns.com:/usr/obj/usr/src/sys/SATURN  i386
>Description:
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.
>How-To-Repeat:
Load a config file into natd without a newline at the end of it.
>Fix:
--- 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';
                else
-                       if (buf[len - 1] != '\0')
-                       {
-                               len++;
-                               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.
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200512011554.jB1Fsmuc098612>