[10634] in Athena Bugs

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

decmips 7.4H: get_message: fix to read $HOME

daemon@ATHENA.MIT.EDU (Calvin Clark)
Mon Jun 28 23:59:25 1993

Date: Mon, 28 Jun 93 23:59:17 -0400
From: Calvin Clark <ckclark@MIT.EDU>
To: bugs@Athena.MIT.EDU

-------
System name:		auditorium
Type and version:	KN02ca 7.4H
Display type:		PMAG-JA 

What were you trying to do?

	Run get_message with my HOME environment variable set to
	something other than the directory listed in /etc/passwd.

What's wrong:

	It doesn't pay attention to the HOME environment variable.
	Almost every other program in the Athena enviornment does.
        I know this because I've had it set to a non-standard
        path for several months, and I've run a lot of programs
	in that time. :-)

What should have happened:

	It should read $HOME.  There are several reasons why a user
	might change $HOME.  One common example is when a user logs in
	with a temporary directory because his fileserver is down, and
	then changes it to /mit/username when it comes back up.

	Here is a fix:

*** /source/athena/athena.bin/gms/check_viewable.c	Mon Oct  3 16:53:12 1988
--- check_viewable.c	Mon Jun 28 23:18:24 1993
***************
*** 43,56 ****
      struct passwd *pw;
      char *userdir;
  
!     pw = getpwuid(getuid());
!       
!     if(pw) {
!       userdir = pw->pw_dir;
!     } else {
!       /* couldn't check user's file, probably better send it. */
!       free(usertfilename);
!       return(0);
      }
  
      usertfilename = malloc(GMS_USERFILE_NAME_LEN+strlen(userdir)+1);
--- 43,60 ----
      struct passwd *pw;
      char *userdir;
  
!     userdir = getenv ("HOME");
! 
!     if (userdir == NULL) {
!       pw = getpwuid(getuid());
! 	
!       if(pw) {
!         userdir = pw->pw_dir;
!       } else {
!         /* couldn't check user's file, probably better send it. */
!         free(usertfilename);
!         return(0);
!       }
      }
  
      usertfilename = malloc(GMS_USERFILE_NAME_LEN+strlen(userdir)+1);

Please describe any relevant documentation references:

	get_message(1)

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