Commit Graph

119 Commits

Author SHA1 Message Date
Robert Watson
2c19b38f62 o Modify NFS rights comment to note that the early credential changes
to test for a home directory don't set up the additional groups, and
  as such may limit users conservatively.  This does not affect the
  eventual credentials selected.
2001-09-15 17:09:39 +00:00
Mark Murray
142277ce04 Like su(1), make PAM use mandatory. Remove parts of the authentication
logic that are handled by PAM. Fix documentation to reflect this.
2001-08-30 11:27:36 +00:00
Mike Barcroft
ede8b1c50a Fix some bogus strncpy(3) to strlcpy(3) changes I made in the previous
revision.  <utmp.h> structures don't leave room for a NUL character.
Also fix "UNKNOWN" which should have just been UNKNOWN.

Pointed out by:	bde
2001-08-13 05:56:27 +00:00
Mike Barcroft
9ab4f41231 o Replace occurrences of strncpy(3) with strlcpy(3); most of
the uses of it were wrong anyway.
o Always check for NULL returns on strdup(3).
o Fix a possible buffer overflow in strcpy(3).
o Fix a format string vulnerability.
o t->ty_type in stypeof() could be NULL and eventually cause
  a segmentation fault in setenv(3), so check for that.

Eyeballed by:	kris
Reviewed by:	murray
MFC after:	3 days
2001-08-12 17:54:49 +00:00
Mark Murray
9567ba9dda Fix the environment handling:
However, there's still a bug in login.c
because you copy the environment *before* the call to pam_open_session,
which won't set the necessary variables set by /usr/ports/security/pam_ssh.

Submitted by:	Volker Stolz <stolz@hyperion.informatik.rwth-aachen.de>
2001-07-28 19:53:10 +00:00
Brian Somers
7bc6d0158f Fix the type of the NULL arg to execl()
Idea from: Theo de Raadt <deraadt@openbsd.org>
2001-07-09 09:24:06 +00:00
Eric Melville
a37b5e8e4c Remove an accidentaly added extra blank line.
Approved by:	murray
2001-05-22 06:20:27 +00:00
Guido van Rooij
5345e89b9d Disable SIGHUP while getting the login name.
Reviewed by:	security-officer
2001-05-21 20:19:59 +00:00
David E. O'Brien
5de20e57b2 Missed a few things. 2001-05-18 05:46:40 +00:00
David E. O'Brien
91a72a92d6 In a word -- style(9). 2001-05-18 05:33:42 +00:00
David E. O'Brien
078ae588ab Add the "prompt" and "passwd_prompt" fields to /etc/login.conf,
which makes lgoin more like getty in its ability to be configured.

Submitted by:	tlambert (code only)
2001-05-18 04:55:16 +00:00
Eric Melville
40c65ba9c7 Check for the expiration of an account and its password in the proper
order.

Reviewed by:	-audit (silence)
Approved by:	murray
Obtained from:	OpenBSD
MFC after:	5 days
2001-05-17 03:10:04 +00:00
Mark Murray
5bc9d93db3 Add full PAM support for account management and sessions.
The PAM_FAIL_CHECK and PAM_END macros in su.c came from the util-linux
package's PAM patches to the BSD login.c

Submitted by:	"David J. MacKenzie" <djm@web.us.uu.net>
2001-03-27 19:40:51 +00:00
Jacques Vidrine
17ada68462 Fix login so that it exports environmental variables that are set by PAM
modules (via pam_putenv).  The following variables will never be set in
this fashion:

   SHELL, HOME, LOGNAME, MAIL, CDPATH, IFS, PATH
   any variable starting with `LD_'
2001-02-09 13:21:50 +00:00
Jacques Vidrine
8ad2668439 Call pam_setcred.
Reviewed by:	markm, months ago
2001-01-23 21:43:32 +00:00
Sheldon Hearn
69f2cf17a3 Add braces to avoid ambiguity in a nested conditional (silences a gcc
warning).
2000-04-26 10:38:19 +00:00
Sheldon Hearn
508d9a5b59 Fix excessive use of parenthesis in previous commit.
Requested by:	bde
2000-04-25 08:59:51 +00:00
Sheldon Hearn
1806a85c5a Do not issue a warning when chflags() fails with EOPNOTSUPP.
PR:		17875
Submitted by:	Bjoern Fischer <bfischer@Techfak.Uni-Bielefeld.DE>
2000-04-13 09:39:29 +00:00
Andrey A. Chernov
5403e5e3f3 Fix diagnostic printing test condition (was always true)
Approved by:	jkh
2000-02-28 01:48:50 +00:00
Yoshinobu Inoue
6d939e82e0 Added IPv6 name resolving support for utmp logging.
Approved by: jkh
2000-02-19 15:57:52 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Warner Losh
a761a4653a Clear all file flags when taking ownership of devices. Do not ignore
chown failures in some places, but instead log them like we do all
other errors.
1999-08-21 18:19:49 +00:00
Andrey A. Chernov
0514336d66 remove uid switching before login_getpwclass, now done inside libutil
add gid switching before chdir and comment why it needed
1999-04-24 17:26:32 +00:00
Brian Somers
3a6afd0d44 Don't perform the trimdomain() functionality twice,
trimdomain() now works as expected.
1999-04-07 14:05:03 +00:00
Andrzej Bialecki
11468b741a Add a compile knob to avoid using PAM code (login will use standard Unix
authentication only). This comes handy when you're tight on space.

Submitted by:	mostly John Baldwin <jobaldwi@vt.edu>
Reviewed by:	John D. Polstra <jdp@polstra.com>
1999-01-19 22:59:37 +00:00
Eivind Eklund
b606e33cb8 Make the timeout handler log any failed logins, to make sure failed
logins get logged.
1999-01-03 23:39:33 +00:00
John Polstra
e83348169b ATTENTION: INSTALL "/etc/pam.conf" FROM "src/etc"!!!
Change login to use PAM for authentication.  I kept the built-in
passwd/NIS authentication support, to handle cases where the system
is missing its "/etc/pam.conf" file.  S/Key and KerberosIV
authentication methods are removed from the login program, but
still available in PAM modules.
1998-11-21 02:22:14 +00:00
John Polstra
6717b4a8dd unifdef -DLOGIN_CAP. After almost 2 years, I think we can assume
it's here to stay.

This code is starting to look almost reasonable again.
1998-11-11 05:47:45 +00:00
John Polstra
8e32ad3bde Remove support for LOGIN_CAP_AUTH. It was never enabled, it was
not complete, and it hasn't been touched for 18 months.  All the
ifdefs obfuscate the code.  I discussed the LOGIN_CAP_AUTH support
with its author and he agreed that it is a dead end.  I am bringing
PAM into the tree within the next two weeks.  It is much more
flexible than LOGIN_CAP_AUTH, and will serve as a superior replacement
for it.
1998-11-11 02:16:01 +00:00
John Polstra
069b715f73 Fix a const-related compiler warning. 1998-11-11 01:53:12 +00:00
Mark Murray
8f176b4353 Use KJH's auth.conf parser to turn on/off Kerberos in userland. 1998-10-09 06:38:33 +00:00
Joseph Koshy
580367f264 Remove hardcoded constant in favour of login.conf value.
PR: 	6529
Submitted by:	Dan Lukes <dan@obluda.cz>
1998-08-17 03:25:07 +00:00
Bruce Evans
e662741c24 Backed out rev.1.31. It was a workaround for bugs in rev.1.4 of
libc/gen/getpass.c.  The old behaviour of blocking SIGINT and not
changing SIGQUIT was restored in rev.1.5 of getpass.c.  The change
here completely restores the old behaviour of not supporting killing
login with keyboard signals (only) at the password prompt.  There
is no reason to support this, since login can be exited normally
by typing a couple of ^D's.  Login certainly shouldn't dump core
in response to user input.  Previously, SIGQUIT killed login
immediately but SIGINT killed it only after the password was
entered.

PR:		7444
1998-07-31 07:22:31 +00:00
John Polstra
79bdd98bf7 Fix a couple of little bugs that prevented login.c from compiling
if LOGIN_CAP_AUTH was defined.  This is kind of silly, because
LOGIN_CAP_AUTH doesn't work anyway, is not defined currently,
probably will never be defined, and IMHO should not be defined.
But I'm sure you'll sleep better tonight, knowing that these bugs
are gone.
1998-07-22 04:33:12 +00:00
Atsushi Murai
89caae2932 Trim a domain part for wtmp as same as showed by "netstat -r".
Here is a some example for avoiding a confusion.

 It asssumes a logged host domain is "spec.co.jp". All
example is longer than UT_HOSTNAMELEN value.

   1) turbo.tama.spec.co.jp: 192.19.0.2  -> trubo.tama
   2) turbo.tama.foo.co.jp : 192.19.0.2  -> 192.19.0.2
   3) specgw.spec.co.jp    : 202.32.13.1 -> specgw

Submitted by:	Atsushi Murai <amurai@spec.co.jp>
1998-06-01 08:47:04 +00:00
Peter Wemm
c8ff18082f *blush*, typo during last minute editing.. 1998-04-30 16:50:07 +00:00
Peter Wemm
159da44105 Change euid while reading the user's .login_cap file in case the homedir
is on a NFS partion without root read access.  Also, flip euid again for
the duration of the chdir() to the homedir for the same reason.

PR: 5145
Submitted by: Joel.Faedi@esial.u-nancy.fr
Also tested by: A Joseph Koshy <koshy@india.hp.com>
1998-04-30 16:48:20 +00:00
Andrey A. Chernov
c8b701a4af Fix very rare but dangerous bug:
for some DES passwords
	crypt(real_password, salt)
is equal to
	crypt("", salt);
It means that this user (and not only he) can login without
entering password at all, just pressing Return.
So if empty password entered and crypted password is not empty,
invalidate any crypt result by assigning ":"
1998-02-13 21:02:53 +00:00
Guido van Rooij
e28be89140 Reset SGINT and SIGQUIT handling to default when asking for passwords.
Otherwise, when pressing the INT ke at the password prompt, the password
will be displayed. Now login will be killed.

Probably the same will have to be done for the LOGIN_CAP_AUTH case.
I have not done that.
Reviewed by:	Joerg Wunsch
1998-02-05 18:37:02 +00:00
Joerg Wunsch
f87ea4059a Fix a fatal typo.
PR:		bin/4801
Submitted by:	mishania@demos.su (Mikhail A. Sokolov)
1997-10-19 09:34:06 +00:00
Mark Murray
7f80a02080 Changes for KTH KerberosIV.
Also quieten -Wall a bit.
1997-09-28 08:57:24 +00:00
Philippe Charnier
9c9cb2bffe = -> ==, strcpy -> strncpy from OpenBSD.
update man page. Add usage().
Obtained from: OpenBSD
1997-07-22 07:39:43 +00:00
Paul Traina
4b2fab7504 Restore backwards compatible default behavior for requirehome 1997-05-23 00:14:27 +00:00
David Nugent
a317d49b93 login_getclass() -> login_getpwclass().
auth_rmfiles() was being called in error without LOGIN_CAP_AUTH defined.
1997-05-10 18:57:16 +00:00
David Nugent
3169e0f139 Use isdialuptty() rather than hard-coded heuristic. 1997-04-13 15:26:04 +00:00
David Nugent
f72b1ff3be Submitted by: Sergei Chechetkin <csl@whale.sunbay.crimea.ua>
Fix incorrect bracket nesting. Closes PR#3144.
1997-04-01 11:54:06 +00:00
Warner Losh
1c8af87873 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
David Nugent
1f5367caee Fix for logic in no-password accounts. 1997-03-27 10:09:09 +00:00
David Nugent
4a028a883d Don't bypass password prompt for root logins on insecure tty if
the root password is empty.
1997-03-25 05:15:04 +00:00
David Nugent
d8a7b3477f strdup() value of term to correctly preserve contents.
Rearrange validation logic so that it works correctly when
compiled with kerberos support. Closes PR#3056.
1997-03-24 21:22:12 +00:00
David Nugent
a52c1be6ff Submitted by: Paul Traina <root@shockwave.com> (partially)
Cleanup of #ifdef's for LOGIN_CAP.

  Fixed bug in empty shell (closes PR#2550).

  Refused root logins now displays standard "Login incorrect" and
	exhibits identical backoff behaviour to a failed login.

  Cleaned up logging of refused logins.

  Use #defines for login retries and backoff. Also implemented
	definable variables if LOGIN_CAP is defined, with
	"login-retries" and  "login-backoff" as capabilities
	in the default class (closes PR#2805).

  TERM from previous environment is no longer truncated.
1997-03-18 16:27:12 +00:00
Wolfram Schneider
67022bfc9f Include copyright message from <sys/copyright.h> 1997-03-01 18:02:44 +00:00
Andrey A. Chernov
7adec20804 Back out "shell" / pw_shell change, I was confused by the same
variable name (with different functionality)
1997-02-27 05:09:58 +00:00
Andrey A. Chernov
60797e8797 Fix few bogons with pw_shell / shell variables values mismatch
introduced by LOGIN_CAP
1997-02-27 03:52:22 +00:00
Jordan K. Hubbard
d87e2a2cc5 Don't dereference NULL pwd on non-existant username (I wonder how long
THAT has been in here!).
1997-01-22 18:36:27 +00:00
David Nugent
5217f56ec6 Fix handling of empty shell field in passwd file (use /bin/sh); problem
was caused by introduction of login classes. Closes PR bin/2550.
Added references to login.conf to manpage, crossreference to login.conf(5).
1997-01-22 02:45:16 +00:00
David Nugent
6acc486b3f Makes login login_cap-savvy.
Note that LOGIN_CAP_AUTH code (login authentication) is not (yet) enabled
and requires /usr/libexec/login_<style> authentication program support to
be added at a later date. The Makefile contains a macro LC_AUTH to turn
it on and prevent unnecessarily linking against skey/krb libs and the
addition of klogin.c module.

All other aspects of login_cap support are fully functional.
1997-01-11 07:16:35 +00:00
Andrey A. Chernov
16ac215c11 Write numerical address instead of hostname for hostnames > UT_HOSTSIZE
to keep valid information in utmp and lastlog
1996-06-17 12:27:55 +00:00
Garrett Wollman
656dcd4316 Delete bogus referneces to timezone code internal header file `tzfile.h',
which is no longer bogusly installed in /usr/include.
1995-08-07 19:17:46 +00:00
Rodney W. Grimes
7799f52a32 Remove trailing whitespace. 1995-05-30 06:41:30 +00:00
Rodney W. Grimes
a164d484cd Fix spelling error that keeps this from compiling with KERBEROS & SKEY
defined.

Submitted by:	Mark Murray <mark@grondar.za>
1995-04-16 20:00:21 +00:00
Garrett Wollman
ed8be72c29 Disallow Kerberos when S/Key is required. Fixes PR #339.
Submitted by: Paul Traina <pst@Shockwave.com>
1995-04-13 15:20:35 +00:00
Garrett Wollman
758f3a64bd Modify klogin to:
1) Don't spit out an error message if Kerberos is installed but not yet
   set up.

2) Don't attempt to verify the ticket you got back, as workstations
   are not intended to have srvtab files of their own.

Both behaviors can be re-enabled with KLOGIN_PARANOID.
1995-01-14 22:57:41 +00:00
Ugen J.S. Antsilevich
6dc4937281 Patch of password expired bug.
Now password changed for right user and
no longer possible to skip password change.
I hope it will be ok....
1994-11-30 15:40:09 +00:00
Paul Traina
2ddadf840c Include most of the logdaemon v4.4 S/key changes 1994-10-19 00:03:45 +00:00
Paul Traina
c9bdc15213 Install support for skey and login.access 1994-09-29 18:59:15 +00:00
Jordan K. Hubbard
83274713b2 Problem:
Accounts that have "pw_change" set, are supposed to change their passwords
by the date specified in "pw_change".  If they have not changed their passwords
by that date, currently they get "LOCKED OUT" of the system.  This is not the
correct behavior, the user should be prompt (forced?) to change their password
at this time.  If the behavior of "pw_change" was meant to be a LOCKOUT,
then you should use "pw_expire".

Solution:
     Instead of locking out the user, prompt them to change their password.

Reviewed by:	jkh
Submitted by:	rls
1994-09-07 01:42:29 +00:00
Guido van Rooij
f88fe8675b Implemnet fbtab ala SunOS (thanks to WZV, see login_fbtab.c)
Reviewed by:
Submitted by:	guido
1994-08-22 19:56:14 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00