[6663] in Athena Bugs

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

attach

daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Sat Dec 22 21:18:06 1990

To: bugs@ATHENA.MIT.EDU
Date: Sat, 22 Dec 90 21:17:53 EST
From: John Carr <jfc@ATHENA.MIT.EDU>


This diff should have been included in the previous message.  Some
unrelated AIX changes are included.

*** afs.c.orig	Fri Jul 20 15:38:23 1990
--- afs.c	Sat Dec 22 21:17:00 1990
***************
*** 36,43 ****
  	char	buf[BUFSIZ];
  	int	len;
  	int	afs_auth_flags = 0;
- 	int	real_uid = getuid();
- 	int	effective_uid = geteuid();
  
  	if ((at->mode != 'n') && do_nfsid)
  		afs_auth_flags |= AFSAUTH_DOAUTH;
--- 36,41 ----
***************
*** 46,56 ****
  		afs_auth_flags |= AFSAUTH_DOZEPHYR;
  	
  	if (afs_auth_flags & (AFSAUTH_DOZEPHYR | AFSAUTH_DOAUTH))
! 		afs_auth_internal(at->hesiodname, at->hostdir, afs_auth_flags);
! 	
  	if (debug_flag)
  		printf("lstating %s...\n", at->hostdir);
! 	setreuid(effective_uid, real_uid);
  	if (stat(at->hostdir, &statbuf)) {
  		if (errno == ENOENT)
  			fprintf(stderr, "%s: %s does not exist\n",
--- 44,54 ----
  		afs_auth_flags |= AFSAUTH_DOZEPHYR;
  	
  	if (afs_auth_flags & (AFSAUTH_DOZEPHYR | AFSAUTH_DOAUTH))
! 		if(afs_auth_internal(at->hesiodname, at->hostdir, afs_auth_flags) == FAILURE)
! 			return FAILURE;	
  	if (debug_flag)
  		printf("lstating %s...\n", at->hostdir);
! 	setreuid(effective_uid, owner_uid);
  	if (stat(at->hostdir, &statbuf)) {
  		if (errno == ENOENT)
  			fprintf(stderr, "%s: %s does not exist\n",
***************
*** 95,101 ****
  					error_status = ERR_ATTACHINUSE;
  					return(FAILURE);
  				}
! 				if (unlink(at->mntpt)) {
  					fprintf(stderr,
  	"%s: Couldn't remove existing symlink from %s to %s: %s\n",
  			at->hesiodname, at->mntpt, buf, sys_errlist[errno]);
--- 93,104 ----
  					error_status = ERR_ATTACHINUSE;
  					return(FAILURE);
  				}
! 				if (
! #ifdef _AIX
! 				    rmslink(at->mntpt) == -1 &&
! #endif
! 				    unlink(at->mntpt) == -1
! 				    ) {
  					fprintf(stderr,
  	"%s: Couldn't remove existing symlink from %s to %s: %s\n",
  			at->hesiodname, at->mntpt, buf, sys_errlist[errno]);
***************
*** 199,205 ****
  		close(fds[0]);
  		dup2(fds[1], 1);
  		close(fds[1]);
! 		setuid(getuid());
  		execl(aklog_fn, AKLOG_SHORTNAME,
  		      flags & AFSAUTH_CELL ? "-cell" : "-path", 
  		      afs_pathname, "-zsubs",
--- 202,208 ----
  		close(fds[0]);
  		dup2(fds[1], 1);
  		close(fds[1]);
! 		setreuid(effective_uid, owner_uid);
  		execl(aklog_fn, AKLOG_SHORTNAME,
  		      flags & AFSAUTH_CELL ? "-cell" : "-path", 
  		      afs_pathname, "-zsubs",
***************
*** 258,263 ****
--- 261,267 ----
  }
  
  int afs_auth(hesname, afsdir)
+ 	const char *hesname, *afsdir;
  {
      return(afs_auth_internal(hesname, afsdir, AFSAUTH_DOAUTH));
  }
***************
*** 296,302 ****
    if(at->flags & FLAG_PERMANENT)
      return SUCCESS;
       
!   if(unlink(at->mntpt) == -1)
      {
        if(errno == ENOENT)
  	{
--- 300,311 ----
    if(at->flags & FLAG_PERMANENT)
      return SUCCESS;
       
!   if(
! #ifdef _AIX
!      rmslink(at->mntpt) == -1 &&
! #endif
!      unlink(at->mntpt) == -1
!      )
      {
        if(errno == ENOENT)
  	{

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