[1075] in Kerberos

home help back first fref pref prev next nref lref last post

nasty interaction between login.krb and setenv

daemon@ATHENA.MIT.EDU (Greg Wohletz)
Mon Aug 27 05:29:04 1990

To: kerberos@ATHENA.MIT.EDU
Date: Sun, 26 Aug 90 18:32:01 -0700
From: Greg Wohletz <greg%duke.cs.unlv.edu@RELAY.CS.NET>

Due to the way the setenv routine is implemented once you have called
setenv, and further values assigned to environ must be obtained through
malloc.  The following diff will keep login.krb from dumping core when
not run with the -p option.

*** login.c.athena	Tue Aug 14 13:53:54 1990
--- login.c	Sun Aug 26 18:22:24 1990
***************
*** 169,177 ****
  	int kflag, Kflag, eflag;
  	int quietlog, passwd_req, ioctlval;
  	sigtype timedout();
! 	char *domain, *salt, *envinit[1], *ttyn, *tty;
  	char tbuf[MAXPATHLEN + 2];
! 	char *ttyname(), *stypeof(), *crypt(), *getpass();
  	time_t time();
  	off_t lseek();
  
--- 169,177 ----
  	int kflag, Kflag, eflag;
  	int quietlog, passwd_req, ioctlval;
  	sigtype timedout();
! 	char *domain, *salt, *ttyn, *tty;
  	char tbuf[MAXPATHLEN + 2];
! 	char *ttyname(), *stypeof(), *crypt(), *getpass(), *malloc();
  	time_t time();
  	off_t lseek();
  
***************
*** 600,607 ****
  	}
  
  	/* destroy environment unless user has requested preservation */
! 	if (!pflag)
! 		environ = envinit;
  	(void)setenv("HOME", pwd->pw_dir, 1);
  	(void)setenv("SHELL", pwd->pw_shell, 1);
  	if (term[0] == '\0')
--- 600,609 ----
  	}
  
  	/* destroy environment unless user has requested preservation */
! 	if (!pflag) {
! 		environ = (char **) malloc(sizeof(char *)); /* must be allocated by malloc! */
! 		environ[0] = NULL; 
! 	}
  	(void)setenv("HOME", pwd->pw_dir, 1);
  	(void)setenv("SHELL", pwd->pw_shell, 1);
  	if (term[0] == '\0')

home help back first fref pref prev next nref lref last post