From owner-freebsd-bugs@FreeBSD.ORG Thu Dec 1 16:00:16 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0212B16A41F for ; Thu, 1 Dec 2005 16:00:15 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 140BB43D5C for ; Thu, 1 Dec 2005 16:00:15 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id jB1G0C9B036300 for ; Thu, 1 Dec 2005 16:00:12 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id jB1G0C18036293; Thu, 1 Dec 2005 16:00:12 GMT (envelope-from gnats) Resent-Date: Thu, 1 Dec 2005 16:00:12 GMT Resent-Message-Id: <200512011600.jB1G0C18036293@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jason Burgess Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2B1F616A41F for ; 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 ; 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 ; 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 To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Cc: Subject: bin/89799: Making natd not require a newline at the end of a configuration file. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2005 16:00:16 -0000 >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: