From nobody@FreeBSD.org  Thu Dec  1 15:54:49 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 2B1F616A41F
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  1 Dec 2005 15:54:49 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id E2B9043D5E
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  1 Dec 2005 15:54:48 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id jB1FsmVJ098614
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 1 Dec 2005 15:54:48 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id jB1Fsmuc098612;
	Thu, 1 Dec 2005 15:54:48 GMT
	(envelope-from nobody)
Message-Id: <200512011554.jB1Fsmuc098612@www.freebsd.org>
Date: Thu, 1 Dec 2005 15:54:48 GMT
From: Jason Burgess <dev@fenux.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Making natd not require a newline at the end of a configuration file.
X-Send-Pr-Version: www-2.3

>Number:         89799
>Category:       bin
>Synopsis:       [patch] Making natd(8) 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:  Thu Dec 01 23:38:26 GMT 2005
>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:
