diff options
Diffstat (limited to 'sysutils/screen49/files')
-rw-r--r-- | sysutils/screen49/files/patch-attacher.c | 79 | ||||
-rw-r--r-- | sysutils/screen49/files/patch-configure.ac | 14 | ||||
-rw-r--r-- | sysutils/screen49/files/patch-doc__Makefile.in | 12 | ||||
-rw-r--r-- | sysutils/screen49/files/patch-misc.c | 4 | ||||
-rw-r--r-- | sysutils/screen49/files/patch-os.h | 8 | ||||
-rw-r--r-- | sysutils/screen49/files/patch-osdef.h.in | 6 | ||||
-rw-r--r-- | sysutils/screen49/files/patch-resize.c | 10 | ||||
-rw-r--r-- | sysutils/screen49/files/patch-screen.c | 115 | ||||
-rw-r--r-- | sysutils/screen49/files/patch-socket.c | 169 | ||||
-rw-r--r-- | sysutils/screen49/files/patch-termcap.c | 6 | ||||
-rw-r--r-- | sysutils/screen49/files/patch-terminfo__checktc.c | 8 | ||||
-rw-r--r-- | sysutils/screen49/files/patch-utmp.c | 22 |
12 files changed, 322 insertions, 131 deletions
diff --git a/sysutils/screen49/files/patch-attacher.c b/sysutils/screen49/files/patch-attacher.c index 0f89189898e3..c5f670bb6ceb 100644 --- a/sysutils/screen49/files/patch-attacher.c +++ b/sysutils/screen49/files/patch-attacher.c @@ -1,6 +1,75 @@ ---- attacher.c.orig 2003-09-08 07:24:48.000000000 -0700 -+++ attacher.c 2011-01-02 21:42:39.547897531 -0800 -@@ -662,7 +662,7 @@ +--- attacher.c.orig 2023-08-16 00:29:26 UTC ++++ attacher.c +@@ -73,7 +73,6 @@ extern int multiattach, multi_uid, own_uid; + #ifdef MULTIUSER + extern char *multi; + extern int multiattach, multi_uid, own_uid; +-extern int tty_mode, tty_oldmode; + # ifndef USE_SETEUID + static int multipipe[2]; + # endif +@@ -160,9 +159,6 @@ int how; + + if (pipe(multipipe)) + Panic(errno, "pipe"); +- if (chmod(attach_tty, 0666)) +- Panic(errno, "chmod %s", attach_tty); +- tty_oldmode = tty_mode; + eff_uid = -1; /* make UserContext fork */ + real_uid = multi_uid; + if ((ret = UserContext()) <= 0) +@@ -174,11 +170,6 @@ int how; + Panic(errno, "UserContext"); + close(multipipe[1]); + read(multipipe[0], &dummy, 1); +- if (tty_oldmode >= 0) +- { +- chmod(attach_tty, tty_oldmode); +- tty_oldmode = -1; +- } + ret = UserStatus(); + #ifdef LOCK + if (ret == SIG_LOCK) +@@ -224,9 +215,6 @@ int how; + xseteuid(multi_uid); + xseteuid(own_uid); + #endif +- if (chmod(attach_tty, 0666)) +- Panic(errno, "chmod %s", attach_tty); +- tty_oldmode = tty_mode; + } + # endif /* USE_SETEUID */ + #endif /* MULTIUSER */ +@@ -423,13 +411,6 @@ int how; + ContinuePlease = 0; + # ifndef USE_SETEUID + close(multipipe[1]); +-# else +- xseteuid(own_uid); +- if (tty_oldmode >= 0) +- if (chmod(attach_tty, tty_oldmode)) +- Panic(errno, "chmod %s", attach_tty); +- tty_oldmode = -1; +- xseteuid(real_uid); + # endif + } + #endif +@@ -505,14 +486,6 @@ AttacherFinit SIGDEFARG + close(s); + } + } +-#ifdef MULTIUSER +- if (tty_oldmode >= 0) +- { +- if (setuid(own_uid)) +- Panic(errno, "setuid"); +- chmod(attach_tty, tty_oldmode); +- } +-#endif + exit(0); + SIGRETURN; + } +@@ -732,7 +705,7 @@ LockTerminal() printf("\n"); prg = getenv("LOCKPRG"); @@ -9,8 +78,8 @@ { signal(SIGCHLD, SIG_DFL); debug1("lockterminal: '%s' seems executable, execl it!\n", prg); -@@ -676,7 +676,11 @@ - setuid(real_uid); /* this should be done already */ +@@ -751,7 +724,11 @@ LockTerminal() + Panic(errno, "setuid"); #endif closeallfiles(0); /* important: /etc/shadow may be open */ - execl(prg, "SCREEN-LOCK", NULL); diff --git a/sysutils/screen49/files/patch-configure.ac b/sysutils/screen49/files/patch-configure.ac index 1f32616b3797..1fc7eb310d6a 100644 --- a/sysutils/screen49/files/patch-configure.ac +++ b/sysutils/screen49/files/patch-configure.ac @@ -1,6 +1,6 @@ ---- configure.ac.orig 2023-08-15 17:29:26.000000000 -0700 -+++ configure.ac 2024-01-02 18:30:11.205776000 -0800 -@@ -669,7 +669,7 @@ +--- configure.ac.orig 2023-08-16 00:29:26 UTC ++++ configure.ac +@@ -669,7 +669,7 @@ olibs="$LIBS" tgetent((char *)0, (char *)0); ],, olibs="$LIBS" @@ -9,7 +9,7 @@ AC_CHECKING(libcurses) AC_TRY_LINK([ #include <curses.h> -@@ -756,19 +756,6 @@ +@@ -756,19 +756,6 @@ fi fi fi @@ -29,7 +29,7 @@ AC_CHECK_FUNCS(getpt) dnl check for openpty() -@@ -900,11 +887,11 @@ +@@ -900,11 +887,11 @@ dnl dnl dnl **** utmp handling **** dnl @@ -43,7 +43,7 @@ #include <utmpx.h> #define utmp utmpx #else -@@ -917,11 +904,11 @@ +@@ -917,11 +904,11 @@ LIBS="$LIBS -lgen" [int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent();], AC_DEFINE(GETUTENT), olibs="$LIBS" LIBS="$LIBS -lgen" @@ -57,7 +57,7 @@ #include <utmpx.h> #define utmp utmpx #else -@@ -931,13 +918,13 @@ +@@ -931,13 +918,13 @@ AC_TRY_LINK([ #define pututline _pututline #endif ], diff --git a/sysutils/screen49/files/patch-doc__Makefile.in b/sysutils/screen49/files/patch-doc__Makefile.in index 8666be063fe5..c90450268d09 100644 --- a/sysutils/screen49/files/patch-doc__Makefile.in +++ b/sysutils/screen49/files/patch-doc__Makefile.in @@ -1,7 +1,7 @@ ---- doc/Makefile.in.orig 2014-04-29 20:26:42.618832001 -0700 -+++ doc/Makefile.in 2014-04-29 20:29:26.379384101 -0700 -@@ -31,7 +31,10 @@ - $(MAKEINFO) --no-split $(srcdir)/screen.texinfo -o screen.info +--- doc/Makefile.in.orig 2023-08-16 00:29:26 UTC ++++ doc/Makefile.in +@@ -31,7 +31,10 @@ install: installdirs + $(MAKEINFO) $(srcdir)/screen.texinfo -o screen.info install: installdirs +ifeq (${WITH_MAN},1) @@ -11,8 +11,8 @@ -$(MAKE) screen.info -if test -f screen.info; then d=.; else d=$(srcdir); fi; \ if test -f $$d/screen.info; then \ -@@ -40,13 +43,19 @@ - install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/screen.info; \ +@@ -40,13 +43,19 @@ install: installdirs + install-info --info-dir=$(DESTDIR)$(infodir) $$d/screen.info; \ else true; fi; \ fi +endif diff --git a/sysutils/screen49/files/patch-misc.c b/sysutils/screen49/files/patch-misc.c index 1364b230d55a..6ea949fbf7a4 100644 --- a/sysutils/screen49/files/patch-misc.c +++ b/sysutils/screen49/files/patch-misc.c @@ -1,4 +1,4 @@ ---- misc.c.orig 2022-01-28 14:06:02 UTC +--- misc.c.orig 2023-08-16 00:29:26 UTC +++ misc.c @@ -28,8 +28,10 @@ @@ -11,7 +11,7 @@ #include "config.h" #include "screen.h" -@@ -796,3 +798,17 @@ +@@ -720,3 +722,17 @@ xvsnprintf(char *s, int n, char *fmt, xva_list stack) } #endif diff --git a/sysutils/screen49/files/patch-os.h b/sysutils/screen49/files/patch-os.h index 80e7ec3c0bcb..ca0237af91ac 100644 --- a/sysutils/screen49/files/patch-os.h +++ b/sysutils/screen49/files/patch-os.h @@ -1,6 +1,6 @@ ---- os.h.orig 2019-10-01 15:08:00.000000000 -0700 -+++ os.h 2019-10-28 19:37:41.585526000 -0700 -@@ -250,9 +250,11 @@ +--- os.h.orig 2023-08-16 00:29:26 UTC ++++ os.h +@@ -250,9 +250,11 @@ extern int errno; #endif #if defined(UTMPOK) || defined(BUGGYGETLOGIN) @@ -23,7 +23,7 @@ #endif #ifndef MAXPATHLEN -@@ -524,6 +526,6 @@ +@@ -524,6 +526,6 @@ typedef struct fd_set { int fds_bits[1]; } fd_set; /* Changing those you won't be able to attach to your old sessions * when changing those values in official tree don't forget to bump * MSG_VERSION */ diff --git a/sysutils/screen49/files/patch-osdef.h.in b/sysutils/screen49/files/patch-osdef.h.in index 3b32fe80ed81..c8249fc3d3bc 100644 --- a/sysutils/screen49/files/patch-osdef.h.in +++ b/sysutils/screen49/files/patch-osdef.h.in @@ -1,5 +1,5 @@ ---- osdef.h.in.orig 2023-08-15 17:29:26.000000000 -0700 -+++ osdef.h.in 2024-07-17 20:59:56.936179000 -0700 +--- osdef.h.in.orig 2023-08-16 00:29:26 UTC ++++ osdef.h.in @@ -28,6 +28,8 @@ **************************************************************** */ @@ -9,7 +9,7 @@ extern int printf __P((char *, ...)); extern int fprintf __P((FILE *, char *, ...)); extern int sprintf __P((char *, char *, ...)); -@@ -71,6 +73,7 @@ +@@ -71,6 +73,7 @@ extern void bcopy __P((char *, char *, int)); #else extern void bcopy __P((char *, char *, int)); #endif diff --git a/sysutils/screen49/files/patch-resize.c b/sysutils/screen49/files/patch-resize.c index a2af125f12ff..216fec9c1ab6 100644 --- a/sysutils/screen49/files/patch-resize.c +++ b/sysutils/screen49/files/patch-resize.c @@ -1,8 +1,8 @@ ---- resize.c.orig Mon Sep 8 07:26:31 2003 -+++ resize.c Mon Dec 1 17:16:29 2003 -@@ -682,6 +682,17 @@ - if (wi == 0) - he = hi = 0; +--- resize.c.orig 2023-08-16 00:29:26 UTC ++++ resize.c +@@ -683,6 +683,17 @@ int wi, he, hi; + he = MAXWIDTH; + } + if (wi > 1000) + { diff --git a/sysutils/screen49/files/patch-screen.c b/sysutils/screen49/files/patch-screen.c index 50b28c02a955..bde83a3b06cc 100644 --- a/sysutils/screen49/files/patch-screen.c +++ b/sysutils/screen49/files/patch-screen.c @@ -1,6 +1,115 @@ ---- screen.c.orig 2017-07-10 12:26:25.000000000 -0700 -+++ screen.c 2017-08-25 20:20:20.471073000 -0700 -@@ -2214,7 +2214,7 @@ +--- screen.c.orig 2023-08-16 00:29:26 UTC ++++ screen.c +@@ -230,8 +230,6 @@ int multiattach; + int multi_uid; + int own_uid; + int multiattach; +-int tty_mode; +-int tty_oldmode = -1; + #endif + + char HostName[MAXSTR]; +@@ -1009,9 +1007,6 @@ int main(int ac, char** av) + + /* ttyname implies isatty */ + SetTtyname(true, &st); +-#ifdef MULTIUSER +- tty_mode = (int)st.st_mode & 0777; +-#endif + + fl = fcntl(0, F_GETFL, 0); + if (fl != -1 && (fl & (O_RDWR|O_RDONLY|O_WRONLY)) == O_RDWR) +@@ -1127,15 +1122,28 @@ int main(int ac, char** av) + #endif + } + +- if (stat(SockPath, &st) == -1) +- Panic(errno, "Cannot access %s", SockPath); +- else +- if (!S_ISDIR(st.st_mode)) ++ if (stat(SockPath, &st) == -1) { ++ if (eff_uid == real_uid) { ++ Panic(errno, "Cannot access %s", SockPath); ++ } else { ++ Panic(0, "Error accessing %s", SockPath); ++ } ++ } else if (!S_ISDIR(st.st_mode)) { ++ if (eff_uid == real_uid || st.st_uid == real_uid) { + Panic(0, "%s is not a directory.", SockPath); ++ } else { ++ Panic(0, "Error accessing %s", SockPath); ++ } ++ } + #ifdef MULTIUSER + if (multi) { +- if ((int)st.st_uid != multi_uid) +- Panic(0, "%s is not the owner of %s.", multi, SockPath); ++ if ((int)st.st_uid != multi_uid) { ++ if (eff_uid == real_uid || st.st_uid == real_uid) { ++ Panic(0, "%s is not the owner of %s.", multi, SockPath); ++ } else { ++ Panic(0, "Error accessing %s", SockPath); ++ } ++ } + } + else + #endif +@@ -1149,9 +1157,13 @@ int main(int ac, char** av) + Panic(0, "You are not the owner of %s.", SockPath); + #endif + } +- +- if ((st.st_mode & 0777) != 0700) +- Panic(0, "Directory %s must have mode 700.", SockPath); ++ if ((st.st_mode & 0777) != 0700) { ++ if (eff_uid == real_uid || st.st_uid == real_uid) { ++ Panic(0, "Directory %s must have mode 700.", SockPath); ++ } else { ++ Panic(0, "Error accessing %s", SockPath); ++ } ++ } + if (SockMatch && index(SockMatch, '/')) + Panic(0, "Bad session name '%s'", SockMatch); + SockName = SockPath + strlen(SockPath) + 1; +@@ -1189,8 +1201,14 @@ int main(int ac, char** av) + else + exit(9 + (fo || oth ? 1 : 0) + fo); + } +- if (fo == 0) +- Panic(0, "No Sockets found in %s.\n", SockPath); ++ if (fo == 0) { ++ if (eff_uid == real_uid || st.st_uid == real_uid) { ++ Panic(0, "No Sockets found in %s.\n", SockPath); ++ } else { ++ Panic(0, "Error accessing %s", SockPath); ++ } ++ } ++ + Msg(0, "%d Socket%s in %s.", fo, fo > 1 ? "s" : "", SockPath); + eexit(0); + } +@@ -2170,20 +2188,6 @@ DEFINE_VARARGS_FN(Panic) + if (D_userpid) + Kill(D_userpid, SIG_BYE); + } +-#ifdef MULTIUSER +- if (tty_oldmode >= 0) { +- +-# ifdef USE_SETEUID +- if (setuid(own_uid)) +- xseteuid(own_uid); /* may be a loop. sigh. */ +-# else +- setuid(own_uid); +-# endif +- +- debug1("Panic: changing back modes from %s\n", attach_tty); +- chmod(attach_tty, tty_oldmode); +- } +-#endif + eexit(1); + } + +@@ -2234,7 +2238,7 @@ static char *pad_expand(char *buf, char *p, int numpad pn2 = pn = p + padlen; r = winmsg_numrend; while (p >= buf) { diff --git a/sysutils/screen49/files/patch-socket.c b/sysutils/screen49/files/patch-socket.c index cfa52856c2e7..01bd213ae5c4 100644 --- a/sysutils/screen49/files/patch-socket.c +++ b/sysutils/screen49/files/patch-socket.c @@ -1,84 +1,97 @@ ---- socket.c.orig 2022-01-28 14:06:02 UTC +--- socket.c.orig 2025-05-13 14:58:03 UTC +++ socket.c -@@ -141,12 +141,14 @@ - char *firstn = NULL; - int nfound = 0, ngood = 0, ndead = 0, nwipe = 0, npriv = 0; - int nperfect = 0; -+ char timestr[64]; - struct sent - { - struct sent *next; - int mode; - char *name; -- } *slist, **slisttail, *sent, *nsent; -+ time_t time_created; -+ } *slist, **slisttail, *sent, *nsent, *schosen; +@@ -171,8 +171,13 @@ bool *is_sock; + xsetegid(real_gid); + #endif - if (match) - { -@@ -258,8 +260,13 @@ - sent->next = 0; - sent->name = SaveStr(name); - sent->mode = mode; -+ sent->time_created = SessionCreationTime(name); -+ for (slisttail = &slist; *slisttail; slisttail = &((*slisttail)->next)) -+ { -+ if ((*slisttail)->time_created < sent->time_created) break; -+ } -+ sent->next = *slisttail; - *slisttail = sent; -- slisttail = &sent->next; - nfound++; - sockfd = MakeClientSocket(0, *is_sock); - #ifdef USE_SETEUID -@@ -359,34 +366,42 @@ - } - for (sent = slist; sent; sent = sent->next) +- if ((dirp = opendir(SockPath)) == 0) +- Panic(errno, "Cannot opendir %s", SockPath); ++ if ((dirp = opendir(SockPath)) == 0) { ++ if (eff_uid == real_uid) { ++ Panic(errno, "Cannot opendir %s", SockPath); ++ } else { ++ Panic(0, "Error accessing %s", SockPath); ++ } ++ } + + slist = 0; + slisttail = &slist; +@@ -841,6 +846,11 @@ int pid; + return UserStatus(); + } + ++static void KillUnpriv(pid_t pid, int sig) { ++ UserContext(); ++ UserReturn(kill(pid, sig)); ++} ++ + #ifdef hpux + /* + * From: "F. K. Bruner" <napalm@ugcs.caltech.edu> +@@ -926,14 +936,14 @@ struct win *wi; + { + Msg(errno, "Could not perform necessary sanity checks on pts device."); + close(i); +- Kill(pid, SIG_BYE); ++ KillUnpriv(pid, SIG_BYE); + return -1; + } + if (strcmp(ttyname_in_ns, m->m_tty)) + { + Msg(errno, "Attach: passed fd does not match tty: %s - %s!", ttyname_in_ns, m->m_tty[0] != '\0' ? m->m_tty : "(null)"); + close(i); +- Kill(pid, SIG_BYE); ++ KillUnpriv(pid, SIG_BYE); + return -1; + } + /* m->m_tty so far contains the actual name of the pts device in the +@@ -950,19 +960,19 @@ struct win *wi; { -+ if (sent->time_created == 0) -+ { -+ sprintf(timestr, "??" "?"); -+ } -+ else -+ { -+ strftime(timestr, 64, "%x %X", localtime(&sent->time_created)); -+ } - switch (sent->mode) - { - case 0700: -- printf("\t%s\t(Attached)\n", sent->name); -+ printf("\t%s\t(%s)\t(Attached)\n", sent->name, timestr); - break; - case 0600: -- printf("\t%s\t(Detached)\n", sent->name); -+ printf("\t%s\t(%s)\t(Detached)\n", sent->name, timestr); - break; + Msg(errno, "Attach: passed fd does not match tty: %s - %s!", m->m_tty, myttyname ? myttyname : "NULL"); + close(i); +- Kill(pid, SIG_BYE); ++ KillUnpriv(pid, SIG_BYE); + return -1; + } + } + else if ((i = secopen(m->m_tty, O_RDWR | O_NONBLOCK, 0)) < 0) + { + Msg(errno, "Attach: Could not open %s!", m->m_tty); +- Kill(pid, SIG_BYE); ++ KillUnpriv(pid, SIG_BYE); + return -1; + } #ifdef MULTIUSER - case 0701: -- printf("\t%s\t(Multi, attached)\n", sent->name); -+ printf("\t%s\t(%s)\t(Multi, attached)\n", sent->name, timestr); - break; - case 0601: -- printf("\t%s\t(Multi, detached)\n", sent->name); -+ printf("\t%s\t(%s)\t(Multi, detached)\n", sent->name, timestr); - break; + if (attach) +- Kill(pid, SIGCONT); ++ KillUnpriv(pid, SIGCONT); #endif - case -1: - /* No trigraphs here! */ -- printf("\t%s\t(Dead ?%c?)\n", sent->name, '?'); -+ printf("\t%s\t(%s)\t(Dead ?%c?)\n", sent->name, timestr, '?'); - break; - case -2: -- printf("\t%s\t(Removed)\n", sent->name); -+ printf("\t%s\t(%s)\t(Removed)\n", sent->name, timestr); - break; - case -3: -- printf("\t%s\t(Remote or dead)\n", sent->name); -+ printf("\t%s\t(%s)\t(Remote or dead)\n", sent->name, timestr); - break; - case -4: -- printf("\t%s\t(Private)\n", sent->name); -+ printf("\t%s\t(%s)\t(Private)\n", sent->name, timestr); - break; - } + + #if defined(ultrix) || defined(pyr) || defined(NeXT) +@@ -975,7 +985,7 @@ struct win *wi; + { + write(i, "Attaching from inside of screen?\n", 33); + close(i); +- Kill(pid, SIG_BYE); ++ KillUnpriv(pid, SIG_BYE); + Msg(0, "Attach msg ignored: coming from inside."); + return -1; } +@@ -986,7 +996,7 @@ struct win *wi; + { + write(i, "Access to session denied.\n", 26); + close(i); +- Kill(pid, SIG_BYE); ++ KillUnpriv(pid, SIG_BYE); + Msg(0, "Attach: access denied for user %s.", user); + return -1; + } +@@ -1304,7 +1314,7 @@ ReceiveMsg() + Msg(0, "Query attempt with bad pid(%d)!", m.m.command.apid); + } + else { +- Kill(m.m.command.apid, ++ KillUnpriv(m.m.command.apid, + (queryflag >= 0) + ? SIGCONT + : SIG_BYE); /* Send SIG_BYE if an error happened */ diff --git a/sysutils/screen49/files/patch-termcap.c b/sysutils/screen49/files/patch-termcap.c index cbe7a90f11a2..a7abaa54ce81 100644 --- a/sysutils/screen49/files/patch-termcap.c +++ b/sysutils/screen49/files/patch-termcap.c @@ -1,6 +1,6 @@ ---- termcap.c.orig 2020-02-05 12:09:38.000000000 -0800 -+++ termcap.c 2020-02-11 20:10:12.747990000 -0800 -@@ -361,11 +361,7 @@ +--- termcap.c.orig 2023-08-16 00:29:26 UTC ++++ termcap.c +@@ -361,11 +361,7 @@ int he; if (D_CG0) { if (D_CS0 == 0) diff --git a/sysutils/screen49/files/patch-terminfo__checktc.c b/sysutils/screen49/files/patch-terminfo__checktc.c index d4ffb75cc0c1..7c38ac40c386 100644 --- a/sysutils/screen49/files/patch-terminfo__checktc.c +++ b/sysutils/screen49/files/patch-terminfo__checktc.c @@ -1,6 +1,6 @@ ---- terminfo/checktc.c.orig Fri Sep 29 09:13:22 1995 -+++ terminfo/checktc.c Tue Apr 22 20:37:18 2003 -@@ -171,6 +171,7 @@ +--- terminfo/checktc.c.orig 2023-08-16 00:29:26 UTC ++++ terminfo/checktc.c +@@ -171,6 +171,7 @@ char *s; fflush(stdout); } @@ -8,7 +8,7 @@ void CPutStr(s, c) char *s; int c; -@@ -178,6 +179,7 @@ +@@ -178,6 +179,7 @@ int c; tputs(tgoto(s, 0, c), 1, putcha); fflush(stdout); } diff --git a/sysutils/screen49/files/patch-utmp.c b/sysutils/screen49/files/patch-utmp.c index 0573d96ceab5..e019f8cedc09 100644 --- a/sysutils/screen49/files/patch-utmp.c +++ b/sysutils/screen49/files/patch-utmp.c @@ -1,5 +1,5 @@ ---- utmp.c.orig 2023-08-15 17:29:26.000000000 -0700 -+++ utmp.c 2023-08-19 08:57:48.376313000 -0700 +--- utmp.c.orig 2023-08-16 00:29:26 UTC ++++ utmp.c @@ -26,6 +26,7 @@ **************************************************************** */ @@ -8,7 +8,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -@@ -89,11 +90,13 @@ +@@ -89,11 +90,13 @@ static struct utmp *getutslot __P((slot_t)); static int pututslot __P((slot_t, struct utmp *, char *, struct win *)); static struct utmp *getutslot __P((slot_t)); #ifndef GETUTENT @@ -22,7 +22,7 @@ #if defined(linux) && defined(GETUTENT) static struct utmp *xpututline __P((struct utmp *utmp)); # define pututline xpututline -@@ -102,9 +105,7 @@ +@@ -102,9 +105,7 @@ static char UtmpName[] = UTMPFILE; static int utmpok; static char UtmpName[] = UTMPFILE; @@ -32,7 +32,7 @@ # if defined(GETUTENT) && (!defined(SVR4) || defined(__hpux)) && ! defined(__CYGWIN__) -@@ -409,12 +410,6 @@ +@@ -409,12 +410,6 @@ struct win *wi; register slot_t slot; struct utmp u; int saved_ut; @@ -45,7 +45,7 @@ wi->w_slot = (slot_t)0; if (!utmpok || wi->w_type != W_TYPE_PTY) -@@ -435,51 +430,13 @@ +@@ -435,51 +430,13 @@ struct win *wi; makeuser(&u, stripdev(wi->w_tty), LoginName, wi->w_pid); #ifdef UTHOST @@ -100,7 +100,7 @@ { Msg(errno,"Could not write %s", UtmpName); UT_CLOSE; -@@ -607,7 +564,7 @@ +@@ -607,7 +564,7 @@ struct utmp *u; struct utmp *u; { u->ut_type = DEAD_PROCESS; @@ -109,7 +109,7 @@ u->ut_exit.e_termination = 0; u->ut_exit.e_exit = 0; #endif -@@ -640,7 +597,11 @@ +@@ -640,7 +597,11 @@ int pid; /* must use temp variable because of NetBSD/sparc64, where * ut_xtime is long(64) but time_t is int(32) */ (void)time(&now); @@ -122,7 +122,7 @@ } static slot_t -@@ -670,6 +631,7 @@ +@@ -670,6 +631,7 @@ initutmp() return (utmpfd = open(UtmpName, O_RDWR)) >= 0; } @@ -130,7 +130,7 @@ static void setutent() { -@@ -694,6 +656,7 @@ +@@ -694,6 +656,7 @@ getutent() return 0; return &uent; } @@ -138,7 +138,7 @@ static struct utmp * getutslot(slot) -@@ -750,9 +713,13 @@ +@@ -750,9 +713,13 @@ int pid; { time_t now; strncpy(u->ut_line, line, sizeof(u->ut_line)); |