Index: attacher.c --- attacher.c.orig 2017-01-17 20:28:29.361404481 +0100 +++ attacher.c 2017-01-18 13:03:46.295949000 +0100 @@ -721,7 +721,7 @@ printf("\n"); prg = getenv("LOCKPRG"); - if (prg && strcmp(prg, "builtin") && !access(prg, X_OK)) + if (prg && (strcmp(prg, "builtin") || strcmp(prg,"builtin-passwd")) && !access(prg, X_OK)) { signal(SIGCHLD, SIG_DFL); debug1("lockterminal: '%s' seems executable, execl it!\n", prg); @@ -738,7 +738,11 @@ Panic(errno, "setuid"); #endif closeallfiles(0); /* important: /etc/shadow may be open */ - execl(prg, "SCREEN-LOCK", NULL); + if (strcmp(prg,"builtin-passwd")) + /* use system passsword for lock */ + execl(prg, "SCREEN-LOCK", "-p", "-n", NULL); + else + execl(prg, "SCREEN-LOCK", NULL); exit(errno); } if (pid == -1) Index: configure --- configure.orig 2017-01-17 20:29:21.885664935 +0100 +++ configure 2017-01-18 13:03:46.296845000 +0100 @@ -5020,7 +5020,8 @@ main() { - exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1); + char *tgoto(const char *, int, int); + exit(strcmp(tgoto("%d%d", 0, 1), "1") ? 0 : 1); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : @@ -5067,7 +5068,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SVR4 ptys..." >&5 $as_echo "$as_me: checking for SVR4 ptys..." >&6;} sysvr4ptys= -if test -c /dev/ptmx ; then +if test -c /nonexistent ; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5178,19 +5179,16 @@ fi rm -f conftest* -if test "$ptys" != "$pdir/pty??" ; then -p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'` -p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'` +# XXX: hardcoded to be devfs and various setups independent + cat >>confdefs.h <<_ACEOF -#define PTYRANGE0 "$p0" +#define PTYRANGE0 "pqrsPQRSlmnoLMNO" _ACEOF cat >>confdefs.h <<_ACEOF -#define PTYRANGE1 "$p1" +#define PTYRANGE1 "0123456789abcdefghijklmnopqrstuv" _ACEOF -fi - # Check whether --with-pty-mode was given. if test "${with_pty_mode+set}" = set; then : @@ -5417,6 +5415,8 @@ #if defined(SVR4) && !defined(DGUX) #include #define utmp utmpx +#define pututline pututxline +#define getutent getutxent #else #include #endif @@ -5485,6 +5485,10 @@ #if defined(SVR4) && !defined(DGUX) #include #define utmp utmpx +#define pututline pututxline +#define getutent getutxent +#define pututline pututxline +#define getutent getutxent #else #include #endif Index: os.h --- os.h.orig 2017-01-17 20:28:29.389404620 +0100 +++ os.h 2017-01-18 13:03:46.296998000 +0100 @@ -252,7 +252,9 @@ #if defined(UTMPOK) || defined(BUGGYGETLOGIN) # if defined(SVR4) && !defined(DGUX) && !defined(__hpux) && !defined(linux) # include +# ifdef UTMPX_FILE # define UTMPFILE UTMPX_FILE +# endif # define utmp utmpx # define getutent getutxent # define getutid getutxid @@ -524,6 +526,6 @@ /* 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 */ -#define MAXTERMLEN 32 +#define MAXTERMLEN 63 #define MAXLOGINLEN 256 Index: osdef.h.in --- osdef.h.in.orig 2017-01-17 20:28:29.389404620 +0100 +++ osdef.h.in 2017-01-18 13:03:46.297112000 +0100 @@ -111,7 +111,7 @@ extern int setpgid __P((int, int)); extern int tcsetpgrp __P((int, int)); #endif -extern int ioctl __P((int, int, char *)); +extern int ioctl __P((int, unsigned long, ...)); extern int kill __P((int, int)); Index: pty.c --- pty.c.orig 2017-01-17 20:28:29.393404640 +0100 +++ pty.c 2017-01-18 13:03:46.297241000 +0100 @@ -57,6 +57,11 @@ # include #endif /* sgi */ +#if defined(__FreeBSD__) +#include +#include +#endif + #include "extern.h" /* Index: resize.c --- resize.c.orig 2017-01-17 20:28:29.393404640 +0100 +++ resize.c 2017-01-18 13:03:46.297430000 +0100 @@ -683,6 +683,17 @@ he = MAXWIDTH; } + if (wi > 1000) + { + Msg(0, "Window width too large, truncated"); + wi = 1000; + } + if (he > 1000) + { + Msg(0, "Window height too large, truncated"); + he = 1000; + } + if (p->w_width == wi && p->w_height == he && p->w_histheight == hi) { debug("ChangeWindowSize: No change.\n"); Index: screen.c --- screen.c.orig 2017-01-17 20:28:29.397404660 +0100 +++ screen.c 2017-01-18 13:04:55.218656000 +0100 @@ -2222,7 +2222,7 @@ pn2 = pn = p + padlen; r = winmsg_numrend; while (p >= buf) { - if (r && *p != 127 && p - buf == winmsg_rendpos[r - 1]) { + if (r && p - buf == winmsg_rendpos[r - 1]) { winmsg_rendpos[--r] = pn - buf; continue; } Index: termcap.c --- termcap.c.orig 2017-01-17 20:28:29.397404660 +0100 +++ termcap.c 2017-01-18 13:03:46.298037000 +0100 @@ -360,11 +360,7 @@ if (D_CG0) { if (D_CS0 == 0) -#ifdef TERMINFO - D_CS0 = "\033(%p1%c"; -#else - D_CS0 = "\033(%."; -#endif + D_CS0 = "\033(%p1%c"; /* Old ncurses can't handle %. */ if (D_CE0 == 0) D_CE0 = "\033(B"; D_AC = 0; Index: terminfo/checktc.c --- terminfo/checktc.c.orig 2017-01-17 20:27:18.977055464 +0100 +++ terminfo/checktc.c 2017-01-18 13:03:46.298168000 +0100 @@ -171,6 +171,7 @@ fflush(stdout); } +#ifndef __FreeBSD__ void CPutStr(s, c) char *s; int c; @@ -178,6 +179,7 @@ tputs(tgoto(s, 0, c), 1, putcha); fflush(stdout); } +#endif /* __FreeBSD__ */ void CCPutStr(s, x, y) char *s; Index: utmp.c --- utmp.c.orig 2017-01-17 20:28:29.397404660 +0100 +++ utmp.c 2017-01-18 13:03:46.298363000 +0100 @@ -26,6 +26,7 @@ **************************************************************** */ +#include #include #include #include @@ -409,12 +410,6 @@ register slot_t slot; struct utmp u; int saved_ut; -#ifdef UTHOST - char *p; - char host[sizeof(D_loginhost) + 15]; -#else - char *host = 0; -#endif /* UTHOST */ wi->w_slot = (slot_t)0; if (!utmpok || wi->w_type != W_TYPE_PTY) @@ -435,51 +430,12 @@ makeuser(&u, stripdev(wi->w_tty), LoginName, wi->w_pid); #ifdef UTHOST - host[sizeof(host) - 15] = '\0'; - if (display) - { - strncpy(host, D_loginhost, sizeof(host) - 15); - if (D_loginslot != (slot_t)0 && D_loginslot != (slot_t)-1 && host[0] != '\0') - { - /* - * we want to set our ut_host field to something like - * ":ttyhf:s.0" or - * "faui45:s.0" or - * "132.199.81.4:s.0" (even this may hurt..), but not - * "faui45.informati"......:s.0 - * HPUX uses host:0.0, so chop at "." and ":" (Eric Backus) - */ - for (p = host; *p; p++) - if ((*p < '0' || *p > '9') && (*p != '.')) - break; - if (*p) - { - for (p = host; *p; p++) - if (*p == '.' || (*p == ':' && p != host)) - { - *p = '\0'; - break; - } - } - } - else - { - strncpy(host + 1, stripdev(D_usertty), sizeof(host) - 15 - 1); - host[0] = ':'; - } - } - else - strncpy(host, "local", sizeof(host) - 15); - - sprintf(host + strlen(host), ":S.%d", wi->w_number); - debug1("rlogin hostname: '%s'\n", host); - # if !defined(_SEQUENT_) && !defined(sequent) - strncpy(u.ut_host, host, sizeof(u.ut_host)); + strncpy(u.ut_host, D_loginhost, sizeof(u.ut_host)); # endif #endif /* UTHOST */ - if (pututslot(slot, &u, host, wi) == 0) + if (pututslot(slot, &u, D_loginhost, wi) == 0) { Msg(errno,"Could not write %s", UtmpName); UT_CLOSE; @@ -598,7 +554,7 @@ struct utmp *u; { u->ut_type = DEAD_PROCESS; -#if (!defined(linux) || defined(EMPTY)) && !defined(__CYGWIN__) +#if (!defined(linux) || defined(EMPTY)) && !defined(__CYGWIN__) && !defined(__FreeBSD__) u->ut_exit.e_termination = 0; u->ut_exit.e_exit = 0; #endif @@ -631,7 +587,11 @@ /* must use temp variable because of NetBSD/sparc64, where * ut_xtime is long(64) but time_t is int(32) */ (void)time(&now); +#if defined(__FreeBSD__) + u->ut_tv.tv_sec = now; +#else u->ut_time = now; +#endif } static slot_t