From owner-svn-src-stable-7@FreeBSD.ORG Thu Mar 25 00:37:14 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 927D2106567E; Thu, 25 Mar 2010 00:37:14 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 818F08FC1E; Thu, 25 Mar 2010 00:37:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2P0bEiL084918; Thu, 25 Mar 2010 00:37:14 GMT (envelope-from sobomax@svn.freebsd.org) Received: (from sobomax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2P0bEd9084916; Thu, 25 Mar 2010 00:37:14 GMT (envelope-from sobomax@svn.freebsd.org) Message-Id: <201003250037.o2P0bEd9084916@svn.freebsd.org> From: Maxim Sobolev Date: Thu, 25 Mar 2010 00:37:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205633 - stable/7/contrib/tcp_wrappers X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Mar 2010 00:37:14 -0000 Author: sobomax Date: Thu Mar 25 00:37:13 2010 New Revision: 205633 URL: http://svn.freebsd.org/changeset/base/205633 Log: MFC: allow comment in the middle of configuration line not only at the beginning. Modified: stable/7/contrib/tcp_wrappers/hosts_access.c Directory Properties: stable/7/contrib/tcp_wrappers/ (props changed) Modified: stable/7/contrib/tcp_wrappers/hosts_access.c ============================================================================== --- stable/7/contrib/tcp_wrappers/hosts_access.c Wed Mar 24 23:08:25 2010 (r205632) +++ stable/7/contrib/tcp_wrappers/hosts_access.c Thu Mar 25 00:37:13 2010 (r205633) @@ -148,6 +148,7 @@ struct request_info *request; char *sh_cmd; /* becomes optional shell command */ int match = NO; struct tcpd_context saved_context; + char *cp; saved_context = tcpd_context; /* stupid compilers */ @@ -164,7 +165,16 @@ struct request_info *request; tcpd_warn("missing newline or line too long"); continue; } - if (sv_list[0] == '#' || sv_list[strspn(sv_list, " \t\r\n")] == 0) + /* Ignore anything after unescaped # character */ + for (cp = strchr(sv_list, '#'); cp != NULL;) { + if (cp > sv_list && cp[-1] == '\\') { + cp = strchr(cp + 1, '#'); + continue; + } + *cp = '\0'; + break; + } + if (sv_list[strspn(sv_list, " \t\r\n")] == 0) continue; if ((cl_list = split_at(sv_list, ':')) == 0) { tcpd_warn("missing \":\" separator");