From owner-freebsd-bugs@FreeBSD.ORG Tue Feb 4 04:50:00 2014 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.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 D901E670 for ; Tue, 4 Feb 2014 04:50:00 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (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 B1A4C110E for ; Tue, 4 Feb 2014 04:50:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id s144o0ep088333 for ; Tue, 4 Feb 2014 04:50:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s144o00H088332; Tue, 4 Feb 2014 04:50:00 GMT (envelope-from gnats) Resent-Date: Tue, 4 Feb 2014 04:50:00 GMT Resent-Message-Id: <201402040450.s144o00H088332@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, UEMURA Tetsuya 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 8AFD2657 for ; Tue, 4 Feb 2014 04:47:02 +0000 (UTC) Received: from oldred.freebsd.org (oldred.freebsd.org [IPv6:2001:1900:2254:206a::50:4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 65BFB1101 for ; Tue, 4 Feb 2014 04:47:02 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id s144l1ic092212 for ; Tue, 4 Feb 2014 04:47:01 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id s144l1dB092211; Tue, 4 Feb 2014 04:47:01 GMT (envelope-from nobody) Message-Id: <201402040447.s144l1dB092211@oldred.freebsd.org> Date: Tue, 4 Feb 2014 04:47:01 GMT From: UEMURA Tetsuya To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: bin/186439: libexec/ftpd missing initialization in ftpd.c:sgetpwnam() . X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Feb 2014 04:50:00 -0000 >Number: 186439 >Category: bin >Synopsis: libexec/ftpd missing initialization in ftpd.c:sgetpwnam() . >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Feb 04 04:50:00 UTC 2014 >Closed-Date: >Last-Modified: >Originator: UEMURA Tetsuya >Release: 8.4-STABLE and 9.2-RELEASE >Organization: MACOME, Corp. >Environment: FreeBSD alix-depot.tesla.local 8.4-STABLE FreeBSD 8.4-STABLE #0 r257474: Fri Nov 1 12:33:06 JST 2013 root@alix-depot.tesla.local:/usr/obj/usr/src/sys/ALIX-DEPOT i386 FreeBSD alix-depot 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r255898: Fri Sep 27 03:52:52 UTC 2013 root@bake.isc.freebsd.org:/usr/obj/usr/src/sys/GENERIC i386 >Description: In libexec/ftpd/ftpd.c:sgetpwnam(), char members of struct passwd are remembered individually, except for pw_class. Which triggers login_getclass: unknown class 'XXX' syslog message be printed occasionally on console, in my case. >How-To-Repeat: Syslog message is printed only once just after (re-)start of nscd. 1. Specify my GECOS in master.passwd relatively long. Ie., "UEMURA Tetsuya" , and I'd get unknown class 'uya' . 2. Enable ftpd via inetd. 3. Add "passwd: cache files" to nsswitch.conf and (re-)start nscd. 4. ftp localhost and login by myself. At this point, I should have a syslog message in console. Note that there's no more log until I restart nscd. >Fix: Save pw_class as well. Patch attached with submission follows: t_uemura@macome.co.jp UEMURA Tetsuya MACOME, Corp. libexec/ftpd missing initialization in ftpd.c:sgetpwnam() , bin sw-bug 8.4-STABLE FreeBSD alix-depot.tesla.local 8.4-STABLE FreeBSD 8.4-STABLE #0 r257474: Fri Nov 1 12:33:06 JST 2013 root@alix-depot.tesla.local:/usr/obj/usr/src/sys/ALIX-DEPOT i386 In libexec/ftpd/ftpd.c, char members of struct passwd are handled individually, except for pw_class. Which triggers login_getclass: unknown class 'XXX' syslog message be printed occasionally on console, in my case. Note that the condition to get these messages is a bit complex though. 1. Specify my GECOS in master.passwd relatively long. 2. Add "passwd: cache files" to nsswitch.conf and (re-)start nscd. 3. Enable ftpd via inetd. 4. ftp to the host and login by myself. 5. Then I should have a syslog message in console. Note that there's no more log until restarting nscd. root@alix-depot:/usr/src# diff -u3 libexec/ftpd/ftpd.c.orig libexec/ftpd/ftpd.c --- libexec/ftpd/ftpd.c.orig 2012-10-31 09:52:33.000000000 +0900 +++ libexec/ftpd/ftpd.c 2014-02-04 11:36:02.000000000 +0900 @@ -967,6 +967,7 @@ if (save.pw_name) { free(save.pw_name); free(save.pw_passwd); + free(save.pw_class); free(save.pw_gecos); free(save.pw_dir); free(save.pw_shell); @@ -974,6 +975,7 @@ save = *p; save.pw_name = sgetsave(p->pw_name); save.pw_passwd = sgetsave(p->pw_passwd); + save.pw_class = sgetsave(p->pw_class); save.pw_gecos = sgetsave(p->pw_gecos); save.pw_dir = sgetsave(p->pw_dir); save.pw_shell = sgetsave(p->pw_shell); >Release-Note: >Audit-Trail: >Unformatted: