bin/186439: libexec/ftpd missing initialization in ftpd.c:sgetpwnam() .

UEMURA Tetsuya t_uemura at macome.co.jp
Tue Feb 4 04:50:00 UTC 2014


>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 at 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 at 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 at 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 at 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 at 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:


More information about the freebsd-bugs mailing list