From owner-svn-src-head@FreeBSD.ORG Sun Mar 2 00:47:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 586F9A85; Sun, 2 Mar 2014 00:47:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 44EB8125E; Sun, 2 Mar 2014 00:47:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s220lmKY056456; Sun, 2 Mar 2014 00:47:48 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s220lmDP056455; Sun, 2 Mar 2014 00:47:48 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201403020047.s220lmDP056455@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 2 Mar 2014 00:47:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r262673 - head/contrib/telnet/telnetd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Mar 2014 00:47:48 -0000 Author: marcel Date: Sun Mar 2 00:47:47 2014 New Revision: 262673 URL: http://svnweb.freebsd.org/changeset/base/262673 Log: Revive support for /etc/issue, lost due revision 81963. Obtained from: Juniper Networks, Inc. Modified: head/contrib/telnet/telnetd/telnetd.c Modified: head/contrib/telnet/telnetd/telnetd.c ============================================================================== --- head/contrib/telnet/telnetd/telnetd.c Sun Mar 2 00:30:42 2014 (r262672) +++ head/contrib/telnet/telnetd/telnetd.c Sun Mar 2 00:47:47 2014 (r262673) @@ -740,6 +740,10 @@ telnet(int f, int p, char *host) char *HE; char *HN; char *IM; + char *IF; + char *if_buf; + int if_fd = -1; + struct stat statbuf; int nfd; /* @@ -905,8 +909,13 @@ telnet(int f, int p, char *host) HE = Getstr("he", &cp); HN = Getstr("hn", &cp); IM = Getstr("im", &cp); + IF = Getstr("if", &cp); if (HN && *HN) (void) strlcpy(host_name, HN, sizeof(host_name)); + if (IF) { + if_fd = open(IF, O_RDONLY, 000); + IM = 0; + } if (IM == 0) IM = strdup(""); } else { @@ -916,6 +925,16 @@ telnet(int f, int p, char *host) edithost(HE, host_name); if (hostinfo && *IM) putf(IM, ptyibuf2); + if (IF && if_fd != -1) { + if(fstat (if_fd, &statbuf)!=-1) { + if (statbuf.st_size > 0) { + if_buf = (char *) mmap (0, statbuf.st_size, PROT_READ, 0, if_fd, 0); + putf(if_buf, ptyibuf2); + munmap (if_buf, statbuf.st_size); + } + close (if_fd); + } + } if (pcc) (void) strncat(ptyibuf2, ptyip, pcc+1);