Thu Dec 29 10:12:48 1994 Richard Basch (probe@tardis)
* krlogind.c
+ Conditionalize grantpt/unlockpt on HAVE_GRANTPT (not just Sun)
+ Conditionalized references to ut_type and ut_pid.
+ Try all the methods for getting a pty...
+
* logutil.c
- Conditionalized references to ut_type.
+ Conditionalized references to ut_type and ut_pid.
- * krlogind.c
* configure.in
Conditionalize grantpt/unlockpt on HAVE_GRANTPT
- (added check to configure.in)
-
- * krlogind.c
- Try all the pty master devices. Other systems frequently
- use the same names.
+ Corrected a minor syntactical error with extraneous "],"
Thu Dec 29 01:38:17 1994 Richard Basch <probe@k9>
* krlogind.c:
- More error checking for Solaris tty setup routines (grantpt/unlockpt)
- Commented out the OOB code, as it causes problems currently.
- Cleaned up some of the #ifdef's for logging incoming users
- Removed extraneous declaration of malloc()
- Pass a "" for the hostname rather than NULL to update_utmp.
- Some additional cosmetic changes.
- Included/excluded #ifdef SYSV code (SYSV is not defined anywhere)
+ Error checks for Solaris tty setup routines (grantpt/unlockpt)
+ Commented out the OOB code, as it causes problems currently.
+ Cleaned up some of the #ifdef's for logging incoming users
+ Removed extraneous declaration of malloc()
+ Pass a "" for the hostname rather than NULL to update_utmp.
+ Some additional cosmetic changes.
+ Included/excluded SYSV code (SYSV is not defined anywhere)
Wed Dec 28 14:59:58 1994 Richard Basch (probe@tardis)
CHECK_DIRENT
CHECK_FCNTL
CHECK_WAIT_TYPE
-AC_HEADER_CHECK(termios.h,AC_FUNC_CHECK([cfsetispeed],AC_DEFINE(POSIX_TERMIOS)))
+AC_HEADER_CHECK(termios.h,AC_FUNC_CHECK(cfsetispeed,AC_DEFINE(POSIX_TERMIOS)))
KRB_INCLUDE
CHECK_UTMP
WITH_KRB5ROOT
krb5_cv_setpgrp_args=two, krb5_cv_setpgrp_args=void)])
AC_MSG_RESULT($krb5_cv_setpgrp_args)
if test $krb5_cv_setpgrp_args = two; then
-AC_DEFINE(SETPGRP_TWOARG)],
+AC_DEFINE(SETPGRP_TWOARG)
fi
dnl
dnl
int i,ptynum;
struct stat stb;
-#ifdef HAVE_STREAMS
-
*fd = open("/dev/ptmx", O_RDWR|O_NDELAY); /* Solaris, IRIX */
if (*fd < 0) *fd = open("/dev/ptc", O_RDWR|O_NDELAY); /* AIX */
- if (*fd < 0) *fd = open("/dev/ptm", O_RDWR|O_NDELAY); /* OSF/1 */
if (*fd < 0) *fd = open("/dev/pty", O_RDWR|O_NDELAY); /* sysvimp */
- if (*fd < 0) return 1;
+ if (*fd >= 0) {
#ifdef HAVE_GRANTPT
- if (grantpt(*fd) || unlockpt(*fd)) return 1;
+ if (grantpt(*fd) || unlockpt(*fd)) return 1;
#endif
#ifdef HAVE_PTSNAME
- p = ptsname(*fd);
+ p = ptsname(*fd);
#else
- p = ttyname(*fd);
+ p = ttyname(*fd);
#endif
- if (p) {
- strcpy(slave, p);
+ if (p) {
+ strcpy(slave, p);
+ return 0;
+ }
+
+ if (fstat(*fd, &stb) < 0) {
+ close(*fd);
+ return 1;
+ }
+ ptynum = (int)(stb.st_rdev&0xFF);
+ sprintf(slave, "/dev/ttyp%x", ptynum);
return 0;
- }
- if (fstat(*fd, &stb) < 0) {
- close(*fd);
- return 1;
- }
- ptynum = (int)(stb.st_rdev&0xFF);
- sprintf(slave, "/dev/ttyp%x", ptynum);
- return 0;
+ } else {
-#else /* NOT STREAMS */
-
- for (c = 'p'; c <= 's'; c++) {
- sprintf(slave,"/dev/ptyXX");
- slave[strlen("/dev/pty")] = c;
- slave[strlen("/dev/ptyp")] = '0';
- if (stat(slave, &stb) < 0)
- break;
- for (i = 0; i < 16; i++) {
- slave[sizeof("/dev/ptyp") - 1] = "0123456789abcdef"[i];
- *fd = open(slave, O_RDWR);
- if (*fd > 0)
- goto gotpty;
+ for (c = 'p'; c <= 's'; c++) {
+ sprintf(slave,"/dev/ptyXX");
+ slave[strlen("/dev/pty")] = c;
+ slave[strlen("/dev/ptyp")] = '0';
+ if (stat(slave, &stb) < 0)
+ break;
+ for (i = 0; i < 16; i++) {
+ slave[sizeof("/dev/ptyp") - 1] = "0123456789abcdef"[i];
+ *fd = open(slave, O_RDWR);
+ if (*fd < 0) continue;
+
+ /* got pty */
+ slave[strlen("/dev/")] = 't';
+ return 0;
+ }
}
+ return 1;
}
- return 1;
- gotpty:
- slave[strlen("/dev/")] = 't';
- return 0;
-#endif /* STREAMS */
}
ent->ut_host[0] = '\0';
#endif
-#ifdef HAVE_SETUTENT
+#ifndef NO_UT_PID
tmpx = line + strlen(line)-1;
if (*(tmpx-1) != '/') tmpx--; /* last two characters, unless it's a / */
sprintf(utmp_id, "kl%s", tmpx);
strncpy(ut.ut_line, tty, sizeof(ut.ut_line));
ut.ut_time = time(0);
-#ifdef HAVE_SETUTENT
+#ifndef NO_UT_PID
+ ut.ut_pid = getpid();
strncpy(ut.ut_user, locuser, sizeof(ut.ut_user));
tmpx = tty + strlen(tty) - 2;
sprintf(utmp_id, "kr%s", tmpx);
strncpy(ut.ut_id, utmp_id, sizeof(ut.ut_id));
+#else
+ strncpy(ut.ut_name, locuser, sizeof(ut.ut_name));
+#endif
#ifndef NO_UT_TYPE
ut.ut_type = (loggingin ? USER_PROCESS : DEAD_PROCESS);
#endif
#ifndef NO_UT_PID
ut.ut_pid = (loggingin ? getpid() : 0);
-#endif
#endif
update_wtmp(&ut);