[comp.sources.bugs] Shadow Login: Patch #6

jfh@rpp386.Dallas.TX.US (John F. Haugh II) (03/09/89)

This is a small patch being sent out to add a very simple feature.
Normally I would wait, but as I am already behind with patch5, I am
feeling guilty :-)

In pwconv(1) there is a line which selects the minimum and maximum
number of days a password is valid during.  This update makes that
a configurable number in the config.h file.  Credit for this
option is due to Axel Fischer [ I think that's his name ... ]

- John.
--
*** config.h
--- new/config.h
**************
*** 1,7
  /*
   * Configuration file for login.
   *
!  *	@(#)config.h	1.3	15:59:38	3/4/89
   */
  
  /*
--- 1,7 -----
  /*
   * Configuration file for login.
   *
!  *	@(#)config.h	1.4	11:17:19	3/8/89
   */
  
  /*
**************
*** 39,44
   * empty ones.
  
  #undef	NOBLANK
  
  /*
   * Define NDEBUG for production versions
--- 39,54 -----
   * empty ones.
  
  #undef	NOBLANK
+ 
+ /*
+  * Define MAXDAYS to be the default maximum number of days a password
+  * is valid for when converting to shadow passwords.  Define MINDAYS
+  * to be the minimum number of days before a password may be changed.
+  * See pwconv.c for more details.
+  */
+ 
+ #define	MAXDAYS	10000
+ #define	MINDAYS	0
  
  /*
   * Define NDEBUG for production versions
*** pwconv.c
--- new/pwconv.c
**************
*** 7,13
   *
   *	The new password file is left in npasswd, the new shadow file is
   *	left in nshadow.  Existing shadow entries are copied as is.
!  *	New entries are created with passwords which expire in 10000 days,
   *	with a last changed date of today, unless password aging
   *	information was already present.  Entries with blank passwords
   *	are not copied to the shadow file at all.
--- 7,13 -----
   *
   *	The new password file is left in npasswd, the new shadow file is
   *	left in nshadow.  Existing shadow entries are copied as is.
!  *	New entries are created with passwords which expire in MAXDAYS days,
   *	with a last changed date of today, unless password aging
   *	information was already present.  Likewise, the minimum number of
   *	days before which the password may be changed is controlled by
**************
*** 9,16
   *	left in nshadow.  Existing shadow entries are copied as is.
   *	New entries are created with passwords which expire in 10000 days,
   *	with a last changed date of today, unless password aging
!  *	information was already present.  Entries with blank passwords
!  *	are not copied to the shadow file at all.
   */
  
  #include <sys/types.h>
--- 9,18 -----
   *	left in nshadow.  Existing shadow entries are copied as is.
   *	New entries are created with passwords which expire in MAXDAYS days,
   *	with a last changed date of today, unless password aging
!  *	information was already present.  Likewise, the minimum number of
!  *	days before which the password may be changed is controlled by
!  *	MINDAYS.  Entries with blank passwordsare not copied to the shadow
!  *	file at all.
   */
  
  #include <sys/types.h>
**************
*** 21,27
  #include "lastlog.h"
  #include "shadow.h"
  
! char	buf[BUFSIZ];
  
  long	time ();
  long	a64l ();
--- 23,31 -----
  #include "lastlog.h"
  #include "shadow.h"
  
! #ifndef	lint
! static	char	_sccsidi[] = "@(#)pwconv.c	1.2	11:17:22	3/8/89";
! #endif
  
  char	buf[BUFSIZ];
  
**************
*** 23,28
  
  char	buf[BUFSIZ];
  
  long	time ();
  long	a64l ();
  
--- 27,34 -----
  static	char	_sccsidi[] = "@(#)pwconv.c	1.2	11:17:22	3/8/89";
  #endif
  
+ char	buf[BUFSIZ];
+ 
  long	time ();
  long	a64l ();
  
**************
*** 101,108
  				tspwd.sp_max *= 7;
  				tspwd.sp_lstchg *= 7;
  			} else {	/* fake up new password age stuff */
! 				tspwd.sp_max = 10000;
! 				tspwd.sp_min = 0;
  				tspwd.sp_lstchg = today;
  			}
  			if (! putspent (&tspwd, shadow)) { /* output entry */
--- 107,114 -----
  				tspwd.sp_max *= 7;
  				tspwd.sp_lstchg *= 7;
  			} else {	/* fake up new password age stuff */
! 				tspwd.sp_max = MAXDAYS;
! 				tspwd.sp_min = MINDAYS;
  				tspwd.sp_lstchg = today;
  			}
  			if (! putspent (&tspwd, shadow)) { /* output entry */
*** README
--- new/README
**************
*** 18,24
  
  Begin by reading and editing the config.h file.  All options are selected
  by using #define's.  A brief description for each available option appears
! below.
  
  Note that there are MANY options.  As distributed all options are turned
  on, which produces a really nice package.  This is the system as used on
--- 18,25 -----
  
  Begin by reading and editing the config.h file.  All options are selected
  by using #define's.  A brief description for each available option appears
! below.  You may want to print this file out as it is LONG and you will
! need to refer to it while editting config.h
  
  Note that there are MANY options.  As distributed most options are turned
  on, which produces a really nice package.  This is the system as used on
**************
*** 20,26
  by using #define's.  A brief description for each available option appears
  below.
  
! Note that there are MANY options.  As distributed all options are turned
  on, which produces a really nice package.  This is the system as used on
  the authors machine.
  
--- 21,27 -----
  below.  You may want to print this file out as it is LONG and you will
  need to refer to it while editting config.h
  
! Note that there are MANY options.  As distributed most options are turned
  on, which produces a really nice package.  This is the system as used on
  the authors machine.  [ The one exception is NOBLANK, that is turned off
  because of anonymous UUCP logins. ]
**************
*** 22,28
  
  Note that there are MANY options.  As distributed all options are turned
  on, which produces a really nice package.  This is the system as used on
! the authors machine.
  
  Dialup Password Files -
  	This option permits individual ports to have an additional
--- 23,30 -----
  
  Note that there are MANY options.  As distributed most options are turned
  on, which produces a really nice package.  This is the system as used on
! the authors machine.  [ The one exception is NOBLANK, that is turned off
! because of anonymous UUCP logins. ]
  
  Dialup Password Files -
  	This option permits individual ports to have an additional
**************
*** 67,72
  
  	Select this option by defining the NOBLANK macro.
  
  HZ Environmental Variable -
  	This option pre-defines the HZ environmental variable.
  	Certain systems require this variable be defined for
--- 69,85 -----
  
  	Select this option by defining the NOBLANK macro.
  
+ Password Aging Defaults -
+ 	You may select the default number of days during which a
+ 	password is valid.  The pwconv command adds aging
+ 	information to accounts which do not include it already.
+ 
+ 	The MINDAYS macro must be defined to be the minimum
+ 	number of days which must pass before a password may be
+ 	changed.  The MAXDAYS macro must be defined to be the
+ 	maximum number of days which a password will remain
+ 	valid during.
+ 
  HZ Environmental Variable -
  	This option pre-defines the HZ environmental variable.
  	Certain systems require this variable be defined for
**************
*** 108,114
  	Select this option by defining the CONSOLE macro to
  	have the desired port name.  If this file is a regular
  	file, it is considered to contain a list of legal port
! 	names, one per line.
  
  Message of the Day Printing -
  	This option causes the message of the day to be
--- 121,130 -----
  	Select this option by defining the CONSOLE macro to
  	have the desired port name.  If this file is a regular
  	file, it is considered to contain a list of legal port
! 	names, one per line.  Note that the port names DO NOT
! 	begin with "/dev/" and that a file name would have to
! 	be fully qualified.  See config.h for a pair of
! 	examples.
  
  Message of the Day Printing -
  	This option causes the message of the day to be
-- 
John F. Haugh II                        +--Quote of the Week:------------------
VoiceNet: (214) 250-3311   Data: -6272  | "Give me your poor huddled masses,
InterNet: jfh@rpp386.Dallas.TX.US       |  Let's club 'em to death ..."
UucpNet : <backbone>!killer!rpp386!jfh  +--------------------------------------