glibc/login
Ulrich Drepper 4bca4c1748 Update.
1998-04-07 08:51  Ulrich Drepper  <drepper@cygnus.com>

	* iconv/gconv.c: Take care for NULL arguments.
	* iconv/gconv_dl.c: Make find_func function global.
	* iconv/gconv_int.h: Add prototype for __gconv_find_func.
	Add prototypes for ASCII conversion functions.
	* iconv/gconv_simple.c: Add ASCII conversion functions.
	* locale/C-ctype.c: Correct charset name.

	* wcsmbs/Makefile (distribute): Add wcsmbsload.h.
	(routines): Remove wmemrtowcs and wmemrtombs, add wcsnlen and
	wcsmbsload.
	* wcsmbs/btowc.c: Rewrite to use iconv functionality.
	* wcsmbs/mbrtowc.c: Likewise.
	* wcsmbs/mbsnrtowcs.c: Likewise.
	* wcsmbs/mbsrtowcs.c: Likewise.
	* wcsmbs/wcrtomb.c: Likewise.
	* wcsmbs/wcsnrtombs.c: Likewise.
	* wcsmbs/wcsrtombs.c: Likewise.
	* wcsmbs/wctob.c: Likewise.
	* wcsmbs/wchar.h: Add prototype for __wcslen, wcsnlen.  Remove
	prototypes for wmemr*.
	* wcsmbs/wcslen.c: Rename to __wcslen and make wcslen weak alias.
	* wcsmbs/wcsnlen.c: New file.
	* wcsmbs/wcsmbsload.c: New file.
	* wcsmbs/wcsmbsload.h: New file.

	* manual/filesys.texi: Mention risks of tmpnam and mktemp.

	* manual/install.texi: Describe some more critical points.

	* string/string.h: Add prototype for __strnlen.
	* string/strnlen.c: Rename to __strnlen and make strnlen weak alias.

	* sysdeps/posix/mktemp.c: Rewrite to allow many more files and
	much less predictable names.
	* sysdeps/posix/mkstemp.c: Likewise.

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

	* manual/libc.texinfo (Top): Change "file namespace" to "local
	namespace".

	* manual/socket.texi: Change file namespace to local namespace.
	(Out-of-Band Data): Remove unneeded variable link.
	(Host Address Functions): Use uint32_t consequently and add a
	number of clarifications for IPv4/IPv6, classless addresses.
	(Internet Namespace): Added some paragraphs about IPv6.
	Based on suggestions by Francesco Potorti` <F.Potorti@cnuce.cnr.it>.

1998-04-05  Philip Blundell  <Philip.Blundell@pobox.com>

	Update for draft-ietf-ipngwg-bsd-api-new-01.txt:

	* resolv/netdb.h (getnameinfo): Use `socklen_t' not `size_t'.
	(NI_NUMERICHOST, et al.): Tidy up and add comments.
	(AI_NUMERICHOST): Define.
	(getnodebyname): New prototype.
	(AI_V4MAPPED, et al.): New constants.

	* sysdeps/unix/bsd/bsd4.4/bits/sockaddr.h (SA_LEN): New macro.<
	* sysdeps/generic/bits/sockaddr.h (SA_LEN): Likewise.
	* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add sa_len
	for socket.
	* sysdeps/unix/sysv/linux/sa_len.c: New file.
	* sysdeps/unix/sysv/linux/Dist: Add sa_len.c.

	* sysdeps/unix/sysv/linux/bits/socket.h: Make multiple #inclusion safe.

	* sysdeps/generic/bits/sockunion.h: New file, defining sockaddr_union.
	* sysdeps/unix/sysv/linux/bits/sockunion.h: Likewise.
	* socket/Makefile (headers): Add bits/sockunion.h.
	* socket/sys/socket.h: Include <bits/sockunion.h>
	* inet/netinet/in.h: Include <bits/sockaddr.h> rather than
	<sys/socket.h>, to avoid getting sockaddr_union defined.
	* sysdeps/generic/bits/socket.h: Allow inclusion from netinet.in.h.
	* sysdeps/unix/sysv/linux/bits/socket.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/socket.h: Likewise.

	* sysdeps/unix/sysv/linux/if_index.c: Remove use of SIOCGIFCOUNT
	(2.2.x kernels won't have it).

1998-04-06 21:21  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/mach/hurd/bits/ioctls.h: Allow inclusion from hurd/ioctl.h.
	* sysdeps/mach/hurd/dl-sysdep.c: Use __ptr_t not caddr_t.
	* iconv/gconv_conf.c: Define MAXPATHLEN if not available before.
	Patches by UCHIYAMA Yasushi <uch@nop.or.jp>.

1998-04-05  Philip Blundell  <Philip.Blundell@pobox.com>

	* manual/socket.texi (Socket Addresses): Fix a typo.
	(Interface Naming): New section.

1998-04-05 23:29  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* configure.in: Check for CC using $ac_tool_prefix, to handle
	cross-compilation.  Use AC_CHECK_TOOL to find MiG.
	* config.make.in: Add MIG to be substituted.
	* mach/Machrules: Don't define MIG variable.

	Patch by Gordon Matzigkeit <gord@profitpress.com>.

1998-04-05  Mark Kettenis  <kettenis@phys.uva.nl>

	* elf/dl-load.c (decompose_rpath): Use local_strdup instead of
	strdupa to copy rpath.

1998-04-05  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* configure.in: Fix gcc version check.

	* aclocal.m4 (AC_PROG_CHECK_VER): Rewritten to make less confusing.

1998-04-05  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* configure.in: Fix gcc version check.

	* aclocal.m4 (AC_PROG_CHECK_VER): Rewritten to make less
	confusing.

1998-04-05  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* configure.in: Fix gcc version check.

	* aclocal.m4 (AC_PROG_CHECK_VER): Rewritten to make less
	confusing.

1998-03-31  Mark Kettenis  <kettenis@phys.uva.nl>

	* sysdeps/unix/bsd/unlockpt.c (unlockpt): Call __ptsname_r instead
	of ptsname_r.

	* stdlib/stdlib.h: Change prototype of ptsname_r to make it more
	like ttyname_r.
	* sysdeps/unix/sysv/linux/ptsname.c (__ptsname_r): Likewise.
	* sysdeps/generic/ptsname.c (__ptsname_r): Likewise.
	* sysdeps/unix/grantpt.c (grantpt): Change check of return value
	of __ptsname_r accordingly.
	* login/openpty.c (openpty): Likewise.

1998-06-04 18:47  H.J. Lu  <hjl@gnu.org>

	* libio/fileops.c (_IO_file_xsgetn): Adjust pointers.

1998-04-06 13:58  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Makeconfig (libtypes): Redo H.J. Lu's change of 1998-03-27.

	* Makerules: Readd missing rule for $(objpfx)stamp.oS.

1998-04-06  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>

	* nis/ypclnt.c: Don't give YPERR_RPC back, use the do_ypcall
	return value for better error checking.
1998-04-07 09:21:28 +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-02-10 20:06:30 +00:00
openpty.c Update. 1998-04-07 09:21:28 +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.