[2191] in Kerberos-V5-bugs

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

krb5-beta6 / hpux-10.10 fixes

daemon@ATHENA.MIT.EDU (Jim Garlick)
Thu Aug 29 15:26:37 1996

Date: Thu, 29 Aug 1996 12:25:57 -0700 (PDT)
From: Jim Garlick <garlick@ecst.csuchico.edu>
To: krb5-bugs@MIT.EDU
Cc: Jim Garlick <garlick@ecst.csuchico.edu>

Hi, here are a couple of diffs for problems I encountered on hpux 10.10
with the krb5-beta6 distribution, in util/pty.

getpty.c has a space in the pathname for /dev/ptym/clone, and tries to map
slave pty names to the usual /dev/ptyXX space.  (On hpux, pty's are in 
/dev/pty/ttyXX).

update_utmp.c expects a getutmpx() function if HAVE_SETUTXENT, which is missing
on hpux10.10, so I supplied one below.

Regards and thanks for a great pacakge.

Jim Garlick
CSU Chico
______________________________
*** getpty.c.orig	Wed Aug 28 16:07:10 1996
--- getpty.c	Thu Aug 29 12:14:17 1996
***************
*** 62,69 ****
      else strcpy(slave, slaveret);
      return 0;
  #else /*HAVE__GETPTY*/
!     
!     *fd = open(" /dev/ptym/clone", O_RDWR|O_NDELAY);	/* HPUX*/
  #ifdef HAVE_STREAMS
      if (*fd < 0) *fd = open("/dev/ptmx",O_RDWR|O_NDELAY); /*Solaris*/
  #endif
--- 62,68 ----
      else strcpy(slave, slaveret);
      return 0;
  #else /*HAVE__GETPTY*/
!     *fd = open("/dev/ptym/clone", O_RDWR|O_NDELAY);	/* HPUX*/
  #ifdef HAVE_STREAMS
      if (*fd < 0) *fd = open("/dev/ptmx",O_RDWR|O_NDELAY); /*Solaris*/
  #endif
***************
*** 96,114 ****
  	    strcpy(slave, p);
  	    return 0;
  	}
! 
  	if (fstat(*fd, &stb) < 0) {
  	    close(*fd);
  	    return PTY_GETPTY_FSTAT;
  	}
  	ptynum = (int)(stb.st_rdev&0xFF);
!     sprintf(slavebuf, "/dev/ttyp%x", ptynum);
!     if ( strlen(slavebuf) > slavelength) {
! 	close(*fd);
! 	*fd = -1;
! 	return PTY_GETPTY_SLAVE_TOOLONG;
!     }
!     strncpy ( slave, slavebuf, slavelength);
  	return 0;
  
      } else {
--- 95,116 ----
  	    strcpy(slave, p);
  	    return 0;
  	}
! #ifndef __hpux 
  	if (fstat(*fd, &stb) < 0) {
  	    close(*fd);
  	    return PTY_GETPTY_FSTAT;
  	}
  	ptynum = (int)(stb.st_rdev&0xFF);
!         sprintf(slavebuf, "/dev/ttyp%x", ptynum);
!     	if ( strlen(slavebuf) > slavelength) {
! 	    close(*fd);
! 	    *fd = -1;
! 	    return PTY_GETPTY_SLAVE_TOOLONG;
!         }
!         strncpy ( slave, slavebuf, slavelength);
! #else
! 	strncpy ( slave, p, slavelength);
! #endif
  	return 0;
  
      } else {
*** update_utmp.c.orig	Tue Jun 11 07:21:25 1996
--- update_utmp.c	Wed Aug 28 09:27:01 1996
***************
*** 32,37 ****
--- 32,60 ----
  #ifndef NO_UT_PID
  #define WTMP_REQUIRES_USERNAME
  #endif
+ 
+ #if HAVE_SETUTXENT && defined(__hpux)
+ /* jg -- hpux10.10 needs this */
+ void getutmpx(ut, utx)
+     const struct utmp *ut;
+     struct utmpx *utx;
+ {
+     strncpy(utx->ut_user, ut->ut_user, 8); /* utmpx allocates 24 bytes */
+     utx->ut_user[8] = '\0';
+     strncpy(utx->ut_id, ut->ut_id, 4); 
+     strncpy(utx->ut_line, ut->ut_line, 12);
+     utx->ut_pid = ut->ut_pid;
+     utx->ut_type = ut->ut_type;
+     utx->ut_exit.__e_termination = ut->ut_exit.e_termination;
+     utx->ut_exit.__e_exit = ut->ut_exit.e_exit;
+     utx->ut_tv.tv_sec = ut->ut_time;
+     utx->ut_tv.tv_usec = 0;
+     strncpy(utx->ut_host, ut->ut_host, 16); /* utmpx allocates 64 bytes */
+     utx->ut_host[16] = '\0';
+     utx->ut_addr = ut->ut_addr;
+ }
+ #endif
+ 
  long pty_update_utmp (process_type, pid, username, line, host, flags)
      int process_type;
      int pid;
***************
*** 171,173 ****
--- 194,197 ----
  
      return ptyint_update_wtmp(&ent, host, userbuf);
  }
+ 


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