[Bug 211141] ports-mgmt/pkg: pkg+pw: Doesn't run pwd_mkdb, maybe other problems

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Apr 11 09:19:30 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211141

Fukang Chen <loader at FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |loader at FreeBSD.org

--- Comment #9 from Fukang Chen <loader at FreeBSD.org> ---
Short answer:
/etc/master.passwd contains a new user _ypldap which wasn't added into
/etc/pwd.db during the upgrade to 11.0.

How to repeat:
# svnlite cat svn://svn.freebsd.org/base/release/10.3.0/etc/master.passwd >
/etc/master.passwd
# pwd_mkdb -p master.passwd
# svnlite cat svn://svn.freebsd.org/base/release/11.0.1/etc/master.passwd >
/etc/master.passwd

# pw useradd _tss -u 601 -g 601 -L daemon -c "TrouSerS user" -d /var/empty -s
/usr/sbin/nologin
pw: user '_tss' disappeared during update

Why getpwnam(3) can't find the user '_tss' in /etc/pwd.db?

There are three copies of the original data in /etc/pwd.db,
- key pw_name field prepended by the _PW_KEYBYNAME
- key pw_uid field prepended by the _PW_KEYBYUID
- key line number in the original file prepended by the _PW_KEYBYNUM

and getpwnam(3) searches the database using the thrid key: line number
https://svnweb.freebsd.org/base/release/11.0.1/lib/libc/gen/getpwent.c?view=markup#l1842

10.3 /etc/master.passwd
23  hast:*:845:845::0:0:HAST unprivileged user:/var/empty:/usr/sbin/nologin
24  nobody:*:65534:65534::0:0:Unprivileged user:/nonexistent:/usr/sbin/nologin

10.3 /etc/pwd.db
B htonl(23) => hast
B htonl(24) => nobody

when running "pw useradd _tss -u" on 11.0, pwd_mkdb(8) inserts the
'_tss' user with the current line number as the key

11.0 /etc/master.passwd:
23  _ypldap:*:160:160::0:0:YP LDAP unprivileged
user:/var/empty:/usr/sbin/nologin
24  hast:*:845:845::0:0:HAST unprivileged user:/var/empty:/usr/sbin/nologin
25  nobody:*:65534:65534::0:0:Unprivileged user:/nonexistent:/usr/sbin/nologin
26  _tss:*:601:601:daemon:0:0:TrouSerS user:/var/empty:/usr/sbin/nologin

11.0 /etc/pwd.db
B htonl(23) => hast
B htonl(24) => nobody
B htonl(26) => _tss

getpwnam(3) stopped after it tried to fetch the key 'B htonl(25)' :P
https://svnweb.freebsd.org/base/release/11.0.1/lib/libc/gen/getpwent.c?view=markup#l1858

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the freebsd-pkg mailing list