glibc/login
Ulrich Drepper 6591c33562 Update.
1998-01-30 19:58  Ulrich Drepper  <drepper@cygnus.com>

	* include/cpio.h: Move to ...
	* posix/cpio.h: ...here.

	* locale/programs/ld-collate.c: Fix typo.

	* signal/signal.h: Declare _sys_siglist with NSIG+1 elements.

	* stdio-common/tiformat.c: Add checks for %#.0o and friends.

	* login/utmp_file.c (pututline_file): Don't always report success
	if similar entry is found.  Patch by Mark M. Kettenis.

1998-01-30 16:06  Philip Blundell  <pb@nexus.co.uk>

	* manual/Makefile: Don't try to install the info files if makeinfo
	is not available.

1998-01-30 12:05  Philip Blundell  <pb@nexus.co.uk>

	* sysdeps/unix/sysv/linux/bits/ioctls.h: Include a copy of the
	kernel's network ioctls, rather than using <linux/sockios.h> to
	get them.  This way we are sure of maintaining compatibility if
	the kernel interface should change.

1998-01-30 15:52  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/Dist: Add netrose/rose.h.

1998-01-25 19:54  Philip Blundell  <Philip.Blundell@pobox.com>

	* sysdeps/unix/sysv/linux/netrose/rose.h: New file.
	* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Install it.

1998-01-27 22:29  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	Implement System V pseudoterminal handling.

	* login/Makefile
	(routines): Add getpt, grantpt, unlockpt, ptsname.
	(libutil-routines): Remove pty. Add openpty, forkpty.
	(distribute): New internal header pty-internal.h.
	(others): Add the helper program, pt_chown.
	(install-others): Install it, in $(libexecdir), mode 4755.

	* login/pty-internal.h: New file.
	* login/openpty.c: New file.
	* login/forkpty.c: New file.
	* login/programs/pt_chown.c: New file.

	* libc.map: Add getpt, grantpt, unlockpt, ptsname, ptsname_r.
	* stdlib/stdlib.h: Prototype them.

	* config.make.in: Define $(libexecdir).
	* Makeconfig: Define $(inst_libexecdir).

	* sysdeps/generic/pty.c: Removed.
	* sysdeps/unix/sysv/linux/pty.c: Removed.

	* sysdeps/generic/getpt.c: Stub out.
	* sysdeps/generic/grantpt.c: Likewise.
	* sysdeps/generic/ptsname.c: Likewise.
	* sysdeps/generic/unlockpt.c: Likewise.

	* sysdeps/unix/grantpt.c: New file.
	* sysdeps/unix/bsd/getpt.c: New file.
	* sysdeps/unix/bsd/unlockpt.c: New file.
	* sysdeps/unix/sysv/linux/getpt.c: New file.
	* sysdeps/unix/sysv/linux/ptsname.c: New file.
	* sysdeps/unix/sysv/linux/unlockpt.c: New file.

1998-01-29 23:56  Ulrich Drepper  <drepper@cygnus.com>

	* localedata/locales/ru_RU: Fix YESEXPR.  Patch by lav@yars.free.net.

1998-01-29  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* nss/Makefile (tests): Add rule for test-netdb.c.

	* nss/test-netdb.c: New file.

1998-01-29 02:38  Ulrich Drepper  <drepper@cygnus.com>

	* elf/dl-open.c (_dl_open): Make sure the variable `reloc' is
	really kept as a variable.  Patch by Richard Henderson,
	reported by Jakub Jelinek <jj@sunsite.ms.mff.cuni.cz>.

	* elf/rtld.c (dl_main): Call _dl_init_paths before handling preloading.
	* elf/genrtldtbl.awk: Mark machine dependent directory of generated
	entries as not existing.

1998-01-26  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* stdio-common/vfprintf.c (process_arg): Fix printing of octal
	zero in alternate form with precision of zero, which must produce
	"0".  Add braces to avoid ambiguous `else'.

1998-01-26  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>

	* nis/nss_compat/compat-grp.c: Fix memory leak and trailing null
	problem with strncpy.
	* nis/nss_compat/compat-pwd.c: Likewise.
	* nis/nss_compat/comapt-spwd.c: Likewise.

1998-01-28  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* assert/assert.h (assert_perror): Correct test for errnum.  Patch
	by uch@nop.or.jp. [PR libc/437]

1997-12-20  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* locales/pl_PL: Fix int_curr_symbol.

1998-01-26  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* nis/nis_cache.c: Include <unistd.h> for declaration of close.

1998-01-06  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* stdio-common/test-popen.c: Include <errno.h>.

	* sysdeps/unix/sysv/linux/if_index.c: Include <unistd.h> for
	close.

	* inet/getnetgrent_r.c: Include <errno.h>.

	* db2/db/db_conv.c: Include <string.h> for memcpy.

	* gmon/bb_exit_func.c: Include <string.h> instead of <strings.h>
	so that memcpy is declared.

	* iconv/iconv_open.c: Include <stdlib.h> for alloca.

	* misc/init-misc.c: Remove unneeded inclusion of <errno.h>.

1998-01-26  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* pwd/fgetpwent_r.c (__fgetpwent_r): Correctly handle buffer
	overflow while reading line with fgets.
	* grp/fgetgrent_r.c (__fgetgrent_r): Likewise.

1998-01-27 00:46  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/bits/types.h (__ipc_pid_t): Change to
	unsigned short, not short.
	Reported by Andreas Jaeger.

1998-01-06  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* sysdeps/unix/sysv/linux/mips/syscalls.list: Correct typo
	(ccept->accept).

	* sysdeps/generic/inttypes.h: Fix spelling.

1998-01-04  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* sysdeps/unix/sysv/linux/arm/Dist: Add bits/mman.h.

	* sysdeps/unix/sysv/linux/alpha/Dist: Add net/route.h.

1998-01-27 00:30  Ulrich Drepper  <drepper@cygnus.com>

	* stdio-common/printf.h (struct print_info): Add new bitfield is_char.
	* stdio-common/printf-parse.h (parse_one_spec): Fill in is_char
	field for hh modifier.
	* stdio-common/vfprint.c: Use is_char field and do not depend in
	is_short having the value 2.
	Bug reported by Andreas Jaeger.

1998-01-05  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* libio/freopen.c (freopen): Call _IO_old_freopen only if defined
	PIC && DO_VERSIONING.

1998-01-24  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Rules: Add rules for $(common-objpfx)dummy$o.
1998-01-30 11:44:34 +00:00
..
programs Update. 1998-01-30 11:44:34 +00:00
forkpty.c Update. 1998-01-30 11:44:34 +00:00
getutent_r.c Update. 1997-08-10 18:37:15 +00:00
getutent.c Update. 1997-07-12 23:35:19 +00:00
getutid_r.c Update. 1997-08-10 18:37:15 +00:00
getutid.c Update. 1997-08-14 01:54:13 +00:00
getutline_r.c Update. 1997-08-10 18:37:15 +00:00
getutline.c Update. 1997-08-10 18:37:15 +00:00
lastlog.h Update. 1997-06-21 02:59:26 +00:00
libutil.map Update. 1997-06-13 22:46:42 +00:00
login_tty.c update from main archive 961001 1996-10-02 01:40:17 +00:00
login.c Update. 1997-08-14 01:54:13 +00:00
logout.c Update. 1997-08-10 18:37:15 +00:00
logwtmp.c Update. 1997-05-29 12:06:58 +00:00
Makefile Update. 1998-01-30 11:44:34 +00:00
openpty.c Update. 1998-01-30 11:44:34 +00:00
pty-internal.h Update. 1998-01-30 11:44:34 +00:00
pty.h Update. 1997-11-26 04:23:08 +00:00
README.utmpd Update. 1997-10-26 20:13:00 +00:00
updwtmp.c Update. 1997-05-29 12:06:58 +00:00
utmp_daemon.c Update. 1997-11-06 00:02:46 +00:00
utmp_file.c Update. 1998-01-30 11:44:34 +00:00
utmp-private.h Update. 1997-08-02 21:00:51 +00:00
utmp.h Update. 1997-06-21 02:59:26 +00:00
utmpname.c Update. 1997-08-10 18:37:15 +00:00
utmpx.h Update. 1997-07-12 23:35:19 +00:00

With the introduction of version 2 of the GNU C Library the format of
the UTMP and WTMP files changed for some configurations (see Q&A 10 of
the FAQ).  This version of the GNU C Library contains a solution for
the problems this may cause, by providing an UTMP daemon `utmpd'.

Do I need it?
=============

If your configuration is one of the following:

                i[3456]86-*-linux-gnu    Linux-2.0 on Intel
                m68k-*-linux-gnu         Linux-2.0 on Motorola 680x0

you might need it, so please read on.  If it is not, please read the
section titled `Programming' at the end of this text.

In principle, you only need the daemon if you want to keep using old
programs linked against the previous version of the Linux C Library
(libc5).  In addition you will need the daemon if you are running
Linux on Intel, and you are planning to use iBCS (Intel Binary
Compatibility Standard).  If you have no libc5 programs left on your
system and you are not using iBCS, it is probably better not to
install the daemon since it uses (a small amount of) memory and CPU
time.  But apart from that it shouldn't hurt to install `utmpd', so
when in doubt install it anyway.


Installation
============

The installation process (`make install') already places the `utmpd'
binary in $(sbindir).  The only thing you have to do is modifying your
startup scripts to start the daemon.  Unfortunately this is a bit of a
hassle, since the layout of these scripts is not standardized.  You
should try to find the command that creates the file `/var/run/utmp'.
This is usually done in a script named `/etc/rc', `/etc/init.d/boot'
(Debian) or `/etc/rc.d/rc.S' (Slackware).  You could try:

     grep utmp /etc/* /etc/init.d/* /etc/rc.d/*

to find the right script.  The creation of `/var/run/utmp' is usually
done with a command like:

     : > /var/run/utmp

or

     cat /dev/null > /var/run/utmp

Now add a line before this command to create the file `/var/run/utmpx'
e.g.

     : > /var/run/utmpx

or

     cat /dev/null > /var/run/utmpx

whatever you prefer, and after this command, add a line to start the
daemon

     utmpd

The entire fragment could look something like

     # Clean up /var/run and create /var/run/utmp so that we can login.
     ( cd /var/run && find . ! -type d -exec rm -f -- {} \; )
     : > /var/run/utmpx
     : > /var/run/utmp
     utmpd

If the file `/var/log/wtmp' exists on your system, you will probably
want to create the file `/var/log/wtmpx'.  Programs linked against the
GNU C Library will now write to `/var/log/wtmpx', while programs
linked against the old library will continue to write to
`/var/log/wtmp'.  Of course this means that the information gets
spread over two files.  We hope to provide a better solution in the
future.

After a reboot, user accounting should be working again.  If not,
please refer to the section titled `Troubleshooting' below before
submitting a bug report.


What is `utmpd' doing?
======================

After installation there will be two files that store the user
accounting information: `/var/run/utmp' and `/var/run/utmpx'.  The
file `/var/run/utmp' will be in the old format so libc5 programs will
continue to work (even if they are broken and do not use the library
functions to access the user accounting database).  And on Intel, you
can safely link `/var/run/utmp' to `/etc/utmp' for iBCS programs.
Programs linked against the new GNU C Library (glibc2) will contact
the daemon for all user accounting database access.  The daemon will
store its information in `/var/run/utmpx' and keeps this file in sync
with `/var/run/utmp'.  Entries added to `/var/run/utmpx' will be
converted to the old format and will be added to `/var/run/utmp' and
vice versa.  This way both libc5 and glibc2 see the same information
in the same fields of `struct utmp'. Of course libc5 programs see only
part of the information that glibc2 programs see because not all
members of the glibc2 `struct utmp' are present in the libc5 `struct
utmp'.  For the same reason libc5 will see a truncated version of
those fields where the length of the glibc2 field is larger than the
corresponding libc5 field (ut_user, ut_line, ut_host).


Troubleshooting
===============

If user accounting is not working on your system, e.g. programs like
`who' or `logname' return rubbish, or you cannot login, make
sure that:

*  The file `/var/run/utmpx' exists.

*  The file `/var/log/wtmpx' exists.

*  No program linked against the GNU C Library (libc6) is accessing
   `/var/run/utmp' directly (see the section on `Programming' below).

If that does not solve your problems, please use the `glibcbug' script
to report the problem to <bugs@gnu.org>.

The `utmpd' daemon uses `syslogd' to report problems.  It uses the
`daemon' facility and `warning' and `error' levels.  Alternatively you
could use the following option to ease debugging:

`--debug'
    Use this option if you want the daemon to output its warnings and
    error messages to the terminal instead of sending them to the
    system logger (`syslogd').  When using this option the daemon does
    not auto-background itself.

To use this option you should first kill the daemon that is already
running, and start a fresh one with the desired option:

    kill `cat /var/run/utmpd.pid`
    utmpd --debug

Please include any warnings or error messages from `utmpd' in your
bug reports.


Programming
===========

In order for the `utmpd' approach to work it is essential that NO
program EVER accesses the UTMP and WTMP files directly.  Instead, a
program should use ONLY the available library functions:

     * utmpname()	Select the database used (UTMP, WTMP, ...).
     * setutent()	Open the database.
     * getutent()	Read the next entry from the database.
     * getutid()	Search for the next entry with a specific ID.
     * getutline()	Search for the next entry for a specific line.
     * pututline()	Write an entry to the database.
     * endutent()	Close the database.
     * updwtmp()	Add an entry to a database (WTMP, ...).

For details, please refer to `The GNU C Library Reference Manual',
which also contains information about some additional functions
derived from BSD and XPG that may be of interest.  The command

    info libc "User Accounting Database"

should point you at the right location.

If you encounter a program that reads from or, even worse, writes to
the UTMP and WTMP files directly, please report this as a bug to the
author of that program.  Note that the files referred to by the macros
`_PATH_UTMP' and `_PATH_WTMP' might even disappear in the future, so
please do not use these, except in a call to `utmpname()' or
`updwtmp()', not even to check their existence.