head	1.2;
access;
symbols
	Real-Release-0-59:1.2
	Release-0-59:1.2
	pniam_change:1.2.0.2
	Real-Release-0-58:1.2
	Release-0-58:1.2
	broken-signals-0-57:1.1.0.2
	Release-0-57:1.1;
locks; strict;
comment	@# @;


1.2
date	98.06.13.06.39.28;	author saw;	state Rel;
branches;
next	1.1;

1.1
date	98.06.12.17.10.52;	author saw;	state Exp;
branches;
next	;


desc
@@


1.2
log
@  - utmp_{open,close}_session() were modified to fail gracefully.
  - pam_get_user() abuse was removed from utmp_open_session.
  - wtmp file locking was rewritten.
  - Unnecessary malloc()s were eliminated in utmp_{open,close}_session().
  - More accurate struct utmp clearing was implemented. Glibc had introduced
    additional fields and could do it further.
  - utmp search was rewritten to be more compatible with libc.
  - Protection against unexpected SIGPIPEs was implemented.
  - TODO file was revived.
  - RCS logs were removed.
@
text
@This file describes the behavior of 'su' in respect of the session and terminal
control.

1. 'su' immediately exits if its stdin be not a terminal and the invoker
   isn't root (getuid() != 0);

2. 'su' needs a record in utmp file corresponding to its controlling
   terminal; this information is retrieved by getlogin() and is passed
   to the PAM stack in PAM_RUSER item;

3. 'su' invoked as 'su - [user]' emulates a login session:
       *  the current utmp record is replaced by a new one;
       *  the owner of the controlling terminal is changed to <user>;
       *  environment variables like HOME are set to new values;
       *  chdir() to <user>'s home directory is performed;
       *  <user>'s shell is invoked as a login shell;

    certainly, the utmp record and terminal ownership (and even mode)
    are restored after the finish of the shell;

4. 'su' invoked as 'su -c <command> [user]' tries to allow you
   to use the common job control actions on the command, i.e. you
   may stop the command, put it in the background and so on;
   however due to a bug in bash you sometimes may face very strange
   results;

5. in the case of both command and '-' (login shell marker) presence
   the command is ignored and login shell is invoked.

I hope the notes help to understand 'su' behavior without
digging in the source (which however isn't a very bad thing IMHO).
Sometime the notes will be added to the manual page.

1998/06/12		Andrey V. Savochkin <saw@@msu.ru>
@


1.1
log
@A code cleanup:
  - _BSD_SOURCE was defined. We had already used several non-POSIX features
    like fchown() and setgroups(). The program can't be compiled
    in a strictly POSIX environment.
  - SU_STRICTLY_POSIX condition was removed.
  - Variable 'login' was renamed to 'is_login' in su.c.
  - Some my earlier comment were rewritten.
  - Return value checks were added to an additional calls.
  - The stdin ownership change was allowed only if is_terminal and is_login
    for security reasons.
  - A major restructurization of the code in su.c as it had been done
    by Andrew in sshd.
  - More detailed error reporting was implemented.
  - A few '(void)' were added to calls like fprintf().
  - More correct handling of a child exit in wait_for_child() was implemented.
  - Changes enabling terminal ownership control for 'su - -c ...'
    were undone.
  - Improper call of pwdb_error was fixed.
  - A new documentation file with the description of tty session and ownership
    control was added.
  - Andrew's email address was fixed in several places.
  - Ancient files were moved to 'Historic' directory.
  - Something else what I've forgotten.
@
text
@d1 1
a1 1
This file describes the behavior of 'su' in respect of session and terminal
d11 6
a16 6
3. 'su' invoked as 'su - [user]' will emulate a complete login session:
       *  the current utmp record will be replaced by a new one;
       *  the owner of the controlling terminal will be changed to <user>;
       *  environment variables like HOME will be set to new values;
       *  chdir() to <user>'s home directory will be performed;
       *  <user>'s shell will be invoked as a login shell;
d19 1
a19 1
    will be restored after the finish of the shell;
d21 1
a21 1
4. 'su' invoked as 'su -c <command> [user]' will try to allow you
d24 1
a24 1
   however due to a bug in bash you sometimes may face very `strange'
d28 1
a28 2
   (like 'su - -c <command>') the command is ignored and login shell
   is invoked.
d30 1
a30 1
I hope the notes will help to understand 'su' behavior without
d32 1
a32 1
May be sometimes the notes will be appended to the manual page.
d34 1
a34 1
1998/04/25		Andrey V. Savochkin <saw@@msu.ru>
@
