LOCAL_LIBRARIES=-lpty
DEPLOCAL_LIBRARIES=$(TOPLIBD)/../util/pty/libpty.a
-SRCS= krcp.c krlogin.c krsh.c kcmd.c forward.c logutil.c $(SETENVSRC) \
+SRCS= krcp.c krlogin.c krsh.c kcmd.c forward.c $(SETENVSRC) \
login.c krshd.c krlogind.c
-OBJS= krcp.o krlogin.o krsh.o kcmd.o forward.o logutil.o $(SETENVOBJ) \
+OBJS= krcp.o krlogin.o krsh.o kcmd.o forward.o $(SETENVOBJ) \
login.o krshd.o krlogind.o $(LIBOBJS)
UCB_RLOGIN = @UCB_RLOGIN@
$(INSTALL_PROGRAM) rlogin $(DESTDIR)$(CLIENT_BINDIR)/rlogin
$(INSTALL_DATA) $(srcdir)/rlogin.M ${DESTDIR}$(CLIENT_MANDIR)/rlogin.1
-krshd: krshd.o kcmd.o logutil.o forward.o $(SETENVOBJ) $(LIBOBJS) $(DEPLIBS)
- $(LD) $(LDFLAGS) $(LDARGS) -o krshd krshd.o kcmd.o logutil.o forward.o $(SETENVOBJ) $(LIBOBJS) $(LIBS)
+krshd: krshd.o kcmd.o forward.o $(SETENVOBJ) $(LIBOBJS) $(DEPLIBS)
+ $(LD) $(LDFLAGS) $(LDARGS) -o krshd krshd.o kcmd.o forward.o $(SETENVOBJ) $(LIBOBJS) $(LIBS)
install::
$(INSTALL_PROGRAM) krshd $(DESTDIR)$(SERVER_BINDIR)/krshd
$(INSTALL_DATA) $(srcdir)/krshd.M ${DESTDIR}$(SERVER_MANDIR)/krshd.8
-krlogind: krlogind.o logutil.o kcmd.o forward.o $(SETENVOBJ) $(LIBOBJS) $(DEPLIBS)
- $(LD) $(LDFLAGS) $(LDARGS) -o krlogind krlogind.o logutil.o kcmd.o forward.o $(SETENVOBJ) $(LIBOBJS) $(LIBS)
+krlogind: krlogind.o kcmd.o forward.o $(SETENVOBJ) $(LIBOBJS) $(DEPLIBS)
+ $(LD) $(LDFLAGS) $(LDARGS) -o krlogind krlogind.o kcmd.o forward.o $(SETENVOBJ) $(LIBOBJS) $(LIBS)
install::
$(INSTALL_PROGRAM) krlogind $(DESTDIR)$(SERVER_BINDIR)/krlogind
# We load the libraries twice here since des425 has a dependency on
# krb5_read_passwrd in krb5.a. Sigh, circular references.
#
-login.krb5: login.o logutil.o $(SETENVOBJ) $(LIBOBJS) $(DEPLIBS)
- $(LD) $(LDFLAGS) $(LDARGS) -o login.krb5 login.o logutil.o $(SETENVOBJ) $(LIBOBJS) $(LIBS) $(LOGINLIBS)
+login.krb5: login.o $(SETENVOBJ) $(LIBOBJS) $(DEPLIBS)
+ $(LD) $(LDFLAGS) $(LDARGS) -o login.krb5 login.o $(SETENVOBJ) $(LIBOBJS) $(LIBS) $(LOGINLIBS)
install::
$(INSTALL_PROGRAM) login.krb5 $(DESTDIR)$(SERVER_BINDIR)/login.krb5
if (port) {
/* Place entry into wtmp */
sprintf(ttyn,"krsh%1d",getpid());
- logwtmp(ttyn,locuser,hostname);
+ pty_logwtmp(ttyn,locuser,hostname);
}
/* We are simply execing a program over rshd : log entry into wtmp,
as kexe(pid), then finish out the session right after that.
Syslog should have the information as to what was exec'd */
else {
- logwtmp(ttyn,locuser,hostname);
+ pty_logwtmp(ttyn,locuser,hostname);
}
#ifdef CRAY
"Shell process completed.");
#endif
/* Finish session in wmtp */
- logwtmp(ttyn,"","");
+ pty_logwtmp(ttyn,"","");
exit(0);
}
#ifdef SETPGRP_TWOARG
as kexe(pid), then finish out the session right after that.
Syslog should have the information as to what was exec'd */
else {
- logwtmp(ttyn,"","");
+ pty_logwtmp(ttyn,"","");
}
if (*pwd->pw_shell == '\0')
exit(1);
signout_please:
- logwtmp(ttyn,"","");
+ pty_logwtmp(ttyn,"","");
exit(1);
}
#endif
wait(0);
- logwtmp(ttyn,"","");
+ pty_logwtmp(ttyn,"","");
syslog(LOG_INFO ,"Shell process completed.");
exit(0);
}
+++ /dev/null
-/*
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include <sys/types.h>
-#include <sys/file.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <syslog.h>
-#include <utmp.h>
-#ifdef HAVE_SETUTXENT
-#include <utmpx.h>
-#endif
-
-#ifndef UTMP_FILE
-#define UTMP_FILE "/etc/utmp"
-#endif
-#ifndef WTMP_FILE
-#define WTMP_FILE "/usr/adm/wtmp"
-#endif
-
-
-#ifndef EMPTY
-/* linux has UT_UNKNOWN but not EMPTY */
-#define EMPTY UT_UNKNOWN
-#endif
-
-void update_utmp();
-void update_wtmp();
-void logwtmp();
-
-
-void update_utmp(ent, username, line, host)
- struct utmp *ent;
- char *username, *line, *host;
-{
-#ifdef HAVE_SETUTENT
- struct utmp ut;
-#else
- struct stat statb;
- int tty;
-#endif
-#ifdef HAVE_SETUTXENT
- struct utmpx utx;
-#endif
-#ifndef NO_UT_PID
- char *tmpx;
- char utmp_id[5];
-#endif
- int fd;
-
- strncpy(ent->ut_line, line+sizeof("/dev/")-1, sizeof(ent->ut_line));
- ent->ut_time = time(0);
-
-#ifndef NO_UT_HOST
- if (host)
- strncpy(ent->ut_host, host, sizeof(ent->ut_host));
- else
- ent->ut_host[0] = '\0';
-#endif
-
-#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(ent->ut_id, utmp_id, sizeof(ent->ut_id));
- strncpy(ent->ut_user, username, sizeof(ent->ut_user));
-#else
- strncpy(ent->ut_name, username, sizeof(ent->ut_name));
-#endif
-
-#ifdef HAVE_SETUTENT
-
- utmpname(UTMP_FILE);
- setutent();
- pututline(ent);
- endutent();
-
-#if 0
- /* XXX -- NOT NEEDED ANYMORE */
-
- if (ent->ut_type == DEAD_PROCESS) {
- if ((fd = open(UTMP_FILE, O_RDWR)) >= 0) {
- int cnt = 0;
- while(read(fd, (char *)&ut, sizeof(ut)) == sizeof(ut)) {
- if (!strncmp(ut.ut_id, ent->ut_id, sizeof(ut.ut_id))) {
- (void) memset(ut.ut_host, 0, sizeof(ut.ut_host));
- (void) memset(ut.ut_user, 0, sizeof(ut.ut_user));
- (void) time(&ut.ut_time);
- ut.ut_exit.e_exit = ut.ut_pid = 0;
- ut.ut_type = EMPTY;
- (void) lseek(fd, -sizeof(ut), SEEK_CUR);
- (void) write(fd, &ut, sizeof(ut));
- }
- cnt++;
- }
- close(fd);
- }
- }
-#endif
-
-#ifdef HAVE_SETUTXENT
- setutxent();
- getutmpx(ent, &utx);
- pututxline(&utx);
- endutxent();
-#endif /* HAVE_SETUTXENT */
-
-#else /* HAVE_SETUTENT */
-
- tty = ttyslot();
- if (tty > 0 && (fd = open(UTMP_FILE, O_WRONLY, 0)) >= 0) {
- (void)lseek(fd, (off_t)(tty * sizeof(struct utmp)), SEEK_SET);
- (void)write(fd, (char *)ent, sizeof(struct utmp));
- (void)close(fd);
- }
-
-#endif /* HAVE_SETUTENT */
-
- update_wtmp(ent);
-}
-
-void update_wtmp(ent)
- struct utmp *ent;
-{
- struct utmp ut;
- struct stat statb;
- int fd;
-#ifdef HAVE_SETUTXENT
- struct utmpx utx;
-
- getutmpx(ent, &utx);
- updwtmpx(WTMPX_FILE, &utx);
-#endif
-
-#ifdef HAVE_UPDWTMP
- updwtmp(WTMP_FILE, ent);
-#else /* HAVE_UPDWTMP */
-
- if ((fd = open(WTMP_FILE, O_WRONLY|O_APPEND, 0)) >= 0) {
- if (!fstat(fd, &statb)) {
- (void)memset((char *)&ut, 0, sizeof(ut));
- (void)strncpy(ut.ut_line, ent->ut_line, sizeof(ut.ut_line));
- (void)strncpy(ut.ut_name, ent->ut_name, sizeof(ut.ut_name));
-#ifndef NO_UT_HOST
- (void)strncpy(ut.ut_host, ent->ut_host, sizeof(ut.ut_host));
-#endif
- (void)time(&ut.ut_time);
-#if defined(HAVE_GETUTENT) && defined(USER_PROCESS)
- if (ent->ut_name) {
- if (!ut.ut_pid)
- ut.ut_pid = getpid();
- ut.ut_type = USER_PROCESS;
- } else {
- ut.ut_type = EMPTY;
- }
-#endif
- if (write(fd, (char *)&ut, sizeof(struct utmp)) !=
- sizeof(struct utmp))
- (void)ftruncate(fd, statb.st_size);
- }
- (void)close(fd);
- }
-#endif /* HAVE_UPDWTMP */
-}
-
-#ifndef HAVE_LOGWTMP
-void logwtmp(tty, locuser, host)
- char *tty;
- char *locuser;
- char *host;
-{
- struct utmp ut;
- char *tmpx;
- char utmp_id[5];
-
- /* Will be empty for logout */
- int loggingin = locuser[0];
-
-
-#ifndef NO_UT_HOST
- strncpy(ut.ut_host, host, sizeof(ut.ut_host));
-#endif
-
- strncpy(ut.ut_line, tty, sizeof(ut.ut_line));
- ut.ut_time = time(0);
-
-#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));
- ut.ut_pid = (loggingin ? getpid() : 0);
- ut.ut_type = (loggingin ? USER_PROCESS : DEAD_PROCESS);
-#else
- strncpy(ut.ut_name, locuser, sizeof(ut.ut_name));
-#endif
-
- update_wtmp(&ut);
-}
-#endif