Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Sep 2015 03:46:12 +0000 (UTC)
From:      Dmitry Marakasov <amdmi3@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r397528 - in head/misc/orville-write: . files
Message-ID:  <201509220346.t8M3kCqR009705@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: amdmi3
Date: Tue Sep 22 03:46:11 2015
New Revision: 397528
URL: https://svnweb.freebsd.org/changeset/ports/397528

Log:
  - Drop 8.x support
  
  Approved by:	portmgr blanket

Added:
  head/misc/orville-write/files/patch-amin.c
     - copied unchanged from r390640, head/misc/orville-write/files/utmpx-amin.c
  head/misc/orville-write/files/patch-getutent.c
     - copied unchanged from r390640, head/misc/orville-write/files/utmpx-getutent.c
  head/misc/orville-write/files/patch-getutent.h
     - copied unchanged from r390640, head/misc/orville-write/files/utmpx-getutent.h
  head/misc/orville-write/files/patch-helpers.c
     - copied unchanged from r390640, head/misc/orville-write/files/utmpx-helpers.c
  head/misc/orville-write/files/patch-huh.c
     - copied unchanged from r390640, head/misc/orville-write/files/utmpx-huh.c
  head/misc/orville-write/files/patch-lib_common.c
     - copied unchanged from r390640, head/misc/orville-write/files/utmpx-lib_common.c
  head/misc/orville-write/files/patch-lib_common.h
     - copied unchanged from r390640, head/misc/orville-write/files/utmpx-lib_common.h
  head/misc/orville-write/files/patch-mesg.c
     - copied unchanged from r390640, head/misc/orville-write/files/utmpx-mesg.c
  head/misc/orville-write/files/patch-wrt_him.c
     - copied unchanged from r390640, head/misc/orville-write/files/utmpx-wrt_him.c
  head/misc/orville-write/files/patch-wrt_me.c
     - copied unchanged from r390640, head/misc/orville-write/files/utmpx-wrt_me.c
  head/misc/orville-write/files/patch-wrttmp.h
     - copied unchanged from r390640, head/misc/orville-write/files/utmpx-wrttmp.h
Deleted:
  head/misc/orville-write/files/utmpx-amin.c
  head/misc/orville-write/files/utmpx-getutent.c
  head/misc/orville-write/files/utmpx-getutent.h
  head/misc/orville-write/files/utmpx-helpers.c
  head/misc/orville-write/files/utmpx-huh.c
  head/misc/orville-write/files/utmpx-lib_common.c
  head/misc/orville-write/files/utmpx-lib_common.h
  head/misc/orville-write/files/utmpx-mesg.c
  head/misc/orville-write/files/utmpx-wrt_him.c
  head/misc/orville-write/files/utmpx-wrt_me.c
  head/misc/orville-write/files/utmpx-wrttmp.h
Modified:
  head/misc/orville-write/Makefile

Modified: head/misc/orville-write/Makefile
==============================================================================
--- head/misc/orville-write/Makefile	Tue Sep 22 03:46:11 2015	(r397527)
+++ head/misc/orville-write/Makefile	Tue Sep 22 03:46:11 2015	(r397528)
@@ -20,22 +20,6 @@ PLIST_FILES=	"@(,,4711) bin/amin" "@(,,4
 
 MAKE_JOBS_UNSAFE=yes
 
-.include <bsd.port.pre.mk>
-
-.if ${OSVERSION} > 900006
-EXTRA_PATCHES=	${PATCHDIR}/utmpx-wrttmp.h \
-		${PATCHDIR}/utmpx-wrt_him.c \
-		${PATCHDIR}/utmpx-wrt_me.c \
-		${PATCHDIR}/utmpx-lib_common.c \
-		${PATCHDIR}/utmpx-lib_common.h \
-		${PATCHDIR}/utmpx-getutent.h \
-		${PATCHDIR}/utmpx-getutent.c \
-		${PATCHDIR}/utmpx-mesg.c \
-		${PATCHDIR}/utmpx-amin.c \
-		${PATCHDIR}/utmpx-huh.c \
-		${PATCHDIR}/utmpx-helpers.c
-.endif
-
 do-install:
 .for i in amin helpers huh mesg
 	${INSTALL_PROGRAM} ${WRKSRC}/${i} ${STAGEDIR}${PREFIX}/bin
@@ -56,4 +40,4 @@ do-install:
 	${INSTALL_MAN} ${WRKSRC}/${i} ${STAGEDIR}${MANPREFIX}/man/man1
 .endfor
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>

Copied: head/misc/orville-write/files/patch-amin.c (from r390640, head/misc/orville-write/files/utmpx-amin.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/orville-write/files/patch-amin.c	Tue Sep 22 03:46:11 2015	(r397528, copy of r390640, head/misc/orville-write/files/utmpx-amin.c)
@@ -0,0 +1,40 @@
+--- amin.c.orig	2010-02-02 23:04:35.773467035 -0800
++++ amin.c	2010-02-02 23:06:45.674814831 -0800
+@@ -194,16 +194,16 @@
+ 
+ void locate_wrttmp(char *tty, struct wrttmp *wbuf, long *pos)
+ {
+-struct utmp *ut;
++struct utmpx *ut;
+ 
+     /* Find utmp entry */
+-    if ((ut= find_utmp(tty)) == NULL || ut->ut_name[0] == '\0')
++    if ((ut= find_utmp(tty)) == NULL || ut->ut_user[0] == '\0')
+     {
+ 	printf("%s: Can't find your tty (%s) in utmp\n",progname,tty);
+ 	exit(1);
+     }
+ 
+-    find_wrttmp(tty, ut->ut_time, wbuf, pos);
++    find_wrttmp(tty, ut->ut_tv.tv_sec, wbuf, pos);
+ }
+ 
+ 
+@@ -230,7 +230,7 @@
+     }
+ 
+     /* Close utmp file */
+-    endutent();
++    endutxent();
+ 
+     /* Figure out name of program being exec'ed */
+     if ((shortcmd= strrchr(fullcmd,'/')) == NULL)
+@@ -241,7 +241,7 @@
+     /* Fix my entry in wrttmp */
+     newwrt= mywrt;
+     newwrt.wrt_what[0]= '!';
+-    strncpy(newwrt.wrt_what+1, shortcmd, UT_NAMESIZE-1);
++    strncpy(newwrt.wrt_what+1, shortcmd, sizeof(((struct utmpx *)0)->ut_user)-2);
+ #ifndef TTYPERMS
+     if (tmp_mesg != 's') newwrt.wrt_mesg= tmp_mesg;
+ #endif

Copied: head/misc/orville-write/files/patch-getutent.c (from r390640, head/misc/orville-write/files/utmpx-getutent.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/orville-write/files/patch-getutent.c	Tue Sep 22 03:46:11 2015	(r397528, copy of r390640, head/misc/orville-write/files/utmpx-getutent.c)
@@ -0,0 +1,106 @@
+--- getutent.c.orig	2000-01-31 22:02:45.000000000 -0800
++++ getutent.c	2010-02-02 22:53:30.347068707 -0800
+@@ -20,18 +20,8 @@
+ {
+     if (utmp.state == 0)
+     {
+-	if ((utmp.fd= open(utmp.fname ? utmp.fname : _PATH_UTMP,
+-		O_RDONLY)) < 0)
+-	{
+-	    utmp.state= -1;
+-	    return -1;
+-	}
+-	else
+-	{
+ 	    utmp.state= 1;
+-	    fcntl(utmp.fd, F_SETFD, 1);		/* Close over execs */
+ 	    return 0;
+-	}
+     }
+ }
+ 
+@@ -42,8 +32,7 @@
+ void endutent()
+ {
+     if (utmp.state == 1)
+-    	close(utmp.fd);
+-    utmp.state= 0;
++    	utmp.state= 0;
+ }
+ 
+ 
+@@ -52,8 +41,7 @@
+ 
+ void setutent()
+ {
+-    if (utmp.state == 1)
+-    	lseek(utmp.fd, 0L, 0);
++	;
+ }
+ 
+ 
+@@ -75,9 +63,9 @@
+ /* GETUTENT - Read the next entry from the utmp file into static storage.
+  */
+ 
+-struct utmp *getutent()
++struct utmpx *getutent()
+ {
+-static struct utmp ut;
++static struct utmpx *ut;
+ 
+     switch (utmp.state)
+     {
+@@ -85,11 +73,11 @@
+ 	openut();
+     	/* Drop through */
+     case 1:
+-	if (read(utmp.fd, &ut, sizeof(struct utmp)) == sizeof(struct utmp))
+-	    return &ut;
++	if ((ut = getutxent()) != NULL)
++	    return ut;
+     	/* Drop through */
+     default:
+-    	return (struct utmp *)NULL;
++    	return (struct utmpx *)NULL;
+     }
+ }
+ 
+@@ -100,9 +88,9 @@
+  * we conform with Linux and Solaris.
+  */
+ 
+-struct utmp *getutline(const struct utmp *in)
++struct utmpx *getutline(const struct utmpx *in)
+ {
+-static struct utmp ut;
++static struct utmpx *ut;
+ 
+     switch (utmp.state)
+     {
+@@ -110,20 +98,20 @@
+ 	openut();
+     	/* Drop through */
+     case 1:
+-	while (read(utmp.fd, &ut, sizeof(struct utmp)) == sizeof(struct utmp))
++	while ((ut = getutxent()) != NULL)
+ 	{
+ 	    if (
+ #if defined(USER_PROCESS) && defined(LOGIN_PROCESS)
+-	        (ut.ut_type == USER_PROCESS || ut.ut_type == LOGIN_PROCESS) &&
++	        (ut->ut_type == USER_PROCESS || ut->ut_type == LOGIN_PROCESS) &&
+ #endif
+-		!strncmp(ut.ut_line, in->ut_line, UT_LINESIZE))
++		!strncmp(ut->ut_line, in->ut_line, sizeof(ut->ut_line)))
+ 	    {
+-		return &ut;
++		return ut;
+ 	    }
+     	}
+     	/* Drop through */
+     default:
+-    	return (struct utmp *)NULL;
++    	return (struct utmpx *)NULL;
+     }
+ }
+ 

Copied: head/misc/orville-write/files/patch-getutent.h (from r390640, head/misc/orville-write/files/utmpx-getutent.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/orville-write/files/patch-getutent.h	Tue Sep 22 03:46:11 2015	(r397528, copy of r390640, head/misc/orville-write/files/utmpx-getutent.h)
@@ -0,0 +1,13 @@
+--- getutent.h.orig	2000-01-31 22:01:13.000000000 -0800
++++ getutent.h	2010-02-02 22:49:58.043092643 -0800
+@@ -14,8 +14,8 @@
+ int utmpname(const char *file);
+ void endutent(void);
+ void setutent(void);
+-struct utmp *getutent(void);
+-struct utmp *getutline(const struct utmp *ut);
++struct utmpx *getutent(void);
++struct utmpx *getutline(const struct utmpx *ut);
+ #endif /*HAVE_GETUTENT*/
+ 
+ #endif /* GETUTENT_H */

Copied: head/misc/orville-write/files/patch-helpers.c (from r390640, head/misc/orville-write/files/utmpx-helpers.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/orville-write/files/patch-helpers.c	Tue Sep 22 03:46:11 2015	(r397528, copy of r390640, head/misc/orville-write/files/utmpx-helpers.c)
@@ -0,0 +1,84 @@
+--- helpers.c.orig	2000-02-20 09:28:08.000000000 -0800
++++ helpers.c	2010-02-02 23:20:25.434811144 -0800
+@@ -11,7 +11,7 @@
+ 
+ struct hlp {
+ 	time_t time;			/* login time from wrttmp file */
+-	char line[UT_LINESIZE];		/* ttyline occupied by a helper */
++	char line[sizeof(((struct utmpx *)0)->ut_line) -1];		/* ttyline occupied by a helper */
+ 	int busy;			/* is he busy? */
+ 	struct hlp *next;		/* next helper */
+ 	} *list= NULL;
+@@ -27,7 +27,7 @@
+ 
+     for (curr= list, prev= NULL; curr != NULL; prev= curr,curr= prev->next)
+     {
+-	if (!strncmp(tty, curr->line, UT_LINESIZE))
++	if (!strncmp(tty, curr->line, ((struct utmpx *)0)->ut_line -1))
+ 	{
+ 	    if (prev == NULL)
+ 	    	list= curr->next;
+@@ -47,7 +47,7 @@
+ int perms_on(struct wrttmp *w)
+ {
+ struct stat st;
+-char devname[UT_LINESIZE+7];
++char devname[sizeof(((struct utmpx *)0)->ut_line) +6];
+ 
+ #ifdef TTYPERMS
+ #define MASK 022
+@@ -59,7 +59,7 @@
+ 
+     /* Is his tty physically writable? */
+ 
+-    sprintf(devname,"/dev/%.*s",UT_LINESIZE,w->wrt_line);
++    sprintf(devname,"/dev/%.*s",((struct utmpx *)0)->ut_line -1,w->wrt_line);
+     if (stat(devname,&st))
+     	return(0);
+ 
+@@ -72,7 +72,7 @@
+ FILE *fp;
+ struct wrttmp w;
+ struct wrthdr wt_head;
+-struct utmp *u;
++struct utmpx *u;
+ struct hlp *tmp;
+ int i, j;
+ int slot= 0;
+@@ -146,7 +146,7 @@
+     if (list != NULL)
+     {
+     	/* Do the scan */
+-	while ((u= getutent()) != NULL)
++	while ((u= getutxent()) != NULL)
+     	{
+ #ifdef USER_PROCESS
+ 	    if (u->ut_type != USER_PROCESS)
+@@ -155,15 +155,15 @@
+ 	    if ((tmp= findlist(u->ut_line)) != NULL)
+ 	    {
+ 	    	/* If the time stamps don't match, this isn't a real helper */
+-	    	if (u->ut_time == tmp->time)
++	    	if (u->ut_tv.tv_sec == tmp->time)
+ 	    	{
+ 		    /* Found a real helper -- count and print */
+ 		    count++;
+ 
+ 		    if (listthem)
+ 			printf("%-*.*s %-*.*s%s\n",
+-			    UT_NAMESIZE, UT_NAMESIZE, u->ut_name,
+-			    UT_LINESIZE, UT_LINESIZE, u->ut_line,
++			    sizeof(u->ut_user)-1, sizeof(u->ut_user)-1, u->ut_user,
++			    sizeof(u->ut_line)-1, sizeof(u->ut_user)-1, u->ut_line,
+ 			    tmp->busy ? " [busy]" : "");
+ 
+ 	    	}
+@@ -172,7 +172,7 @@
+ 	    }
+     	}
+ 
+-    	endutent();
++    	endutxent();
+     }
+ 
+     if (!listthem)

Copied: head/misc/orville-write/files/patch-huh.c (from r390640, head/misc/orville-write/files/utmpx-huh.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/orville-write/files/patch-huh.c	Tue Sep 22 03:46:11 2015	(r397528, copy of r390640, head/misc/orville-write/files/utmpx-huh.c)
@@ -0,0 +1,35 @@
+--- huh.c.orig	2010-02-02 23:11:01.823876514 -0800
++++ huh.c	2010-02-02 23:11:54.475034412 -0800
+@@ -34,13 +34,13 @@
+ 
+ int record_on()
+ {
+-struct utmp *ut;
++struct utmpx *ut;
+ struct wrttmp wt;
+ char *tty;
+ long pos;
+ 
+     /* Open the utmp file */
+-    setutent();
++    setutxent();
+ 
+     /* Open the wrttmp file */
+     if (init_wstream(O_RDONLY)) return 1;
+@@ -50,13 +50,13 @@
+     tty= mydevname+5;
+ 
+     /* Find our entry in the utmp file */
+-    if ((ut= find_utmp(tty)) == NULL || ut->ut_name[0] == '\0') return 1;
++    if ((ut= find_utmp(tty)) == NULL || ut->ut_user[0] == '\0') return 1;
+ 
+     /* Find the entry in the wrttmp file */
+-    find_wrttmp(tty, ut->ut_time, &wt, &pos);
++    find_wrttmp(tty, ut->ut_tv.tv_sec, &wt, &pos);
+ 
+     /* Close utmp file */
+-    endutent();
++    endutxent();
+ 
+     return (wt.wrt_record != 'n');
+ }

Copied: head/misc/orville-write/files/patch-lib_common.c (from r390640, head/misc/orville-write/files/utmpx-lib_common.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/orville-write/files/patch-lib_common.c	Tue Sep 22 03:46:11 2015	(r397528, copy of r390640, head/misc/orville-write/files/utmpx-lib_common.c)
@@ -0,0 +1,19 @@
+--- lib_common.c.orig	2010-02-02 22:34:36.829638978 -0800
++++ lib_common.c	2010-02-02 22:36:28.170798539 -0800
+@@ -141,13 +141,13 @@
+  * fail.  The tty name need not be null terminated.
+  */
+ 
+-struct utmp *find_utmp(char *tty)
++struct utmpx *find_utmp(char *tty)
+ {
+-struct utmp tmputmp;
++struct utmpx tmputmp;
+ 
+     strncpy(tmputmp.ut_line, tty, UT_LINESIZE);
+     setutent(); /* open and/or rewind */
+-    return getutline(&tmputmp);
++    return getutxline(&tmputmp);
+ }
+ 
+ 

Copied: head/misc/orville-write/files/patch-lib_common.h (from r390640, head/misc/orville-write/files/utmpx-lib_common.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/orville-write/files/patch-lib_common.h	Tue Sep 22 03:46:11 2015	(r397528, copy of r390640, head/misc/orville-write/files/utmpx-lib_common.h)
@@ -0,0 +1,11 @@
+--- lib_common.h.orig	2010-02-02 22:40:13.646402561 -0800
++++ lib_common.h	2010-02-02 22:40:30.475105092 -0800
+@@ -6,7 +6,7 @@
+ #include "getutent.h"
+ 
+ int init_wstream(int mode);
+-struct utmp *find_utmp(char *tty);
++struct utmpx *find_utmp(char *tty);
+ void find_wrttmp(char *tty, time_t time,struct wrttmp *wbuf, long *pos);
+ void dflt_wrttmp(struct wrttmp *wbuf, char *tty, time_t time);
+ char *leafname(char *fullpath);

Copied: head/misc/orville-write/files/patch-mesg.c (from r390640, head/misc/orville-write/files/utmpx-mesg.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/orville-write/files/patch-mesg.c	Tue Sep 22 03:46:11 2015	(r397528, copy of r390640, head/misc/orville-write/files/utmpx-mesg.c)
@@ -0,0 +1,159 @@
+--- mesg.c.orig	2010-02-02 22:54:21.613120678 -0800
++++ mesg.c	2010-02-02 23:01:31.739763589 -0800
+@@ -19,7 +19,7 @@
+ char *mytty;			/* my tty name in tty?? format */
+ long mypos;			/* offset of my entry in wrttmp file */
+ struct wrttmp mywrt;		/* my wrttmp entry */
+-struct utmp myutmp;		/* A tmp buffer for reading utmp entries */
++struct utmpx myutmp;		/* A tmp buffer for reading utmp entries */
+ 
+ char silent= FALSE;		/* generates no output if true */
+ int verbose= FALSE;		/* generate whole table of output if true */
+@@ -335,7 +335,7 @@
+     }
+ 
+     /* Close the utmp file */
+-    endutent();
++    endutxent();
+ 
+    if (f_wrthist != NULL &&
+        !wassilent && (new[SMESG] == 'n' || new[SEXCP] == 'y'))
+@@ -549,12 +549,12 @@
+ 
+ void do_disconnect()
+ {
+-struct utmp *ut;		/* A tmp buffer for reading utmp entries */
++struct utmpx *ut;		/* A tmp buffer for reading utmp entries */
+ struct wrttmp hiswrt;		/* Someone's wrttmp entry */
+ int slot= 0;
+ 
+     /* Rewind utmp file */
+-    setutent();
++    setutxent();
+ 
+     /* For each user who is writing me */
+     for (;;)
+@@ -564,16 +564,16 @@
+ 	       sizeof(struct wrttmp))
+ 	   break;
+ 
+-	if (!strncmp(hiswrt.wrt_what, myutmp.ut_name, UT_NAMESIZE))
++	if (!strncmp(hiswrt.wrt_what, myutmp.ut_user, sizeof(myutmp.ut_user)))
+ 	{
+ 	    setutent();
+ 	    /* Check apparant writer against utmp file */
+-	    while ((ut= getutent()) != NULL)
++	    while ((ut= getutxent()) != NULL)
+ 		if (
+ #ifdef USER_PROCESS
+ 		    ut->ut_type == USER_PROCESS &&
+ #endif
+-		    !strncmp(hiswrt.wrt_line, ut->ut_line, UT_LINESIZE))
++		    !strncmp(hiswrt.wrt_line, ut->ut_line, sizeof(ut->ut_line)))
+ 		{
+ 		    /* Writer is for real: bonk him one */
+ 		    kill(hiswrt.wrt_pid, SIGTERM);
+@@ -590,10 +590,10 @@
+ 
+ int find_me()
+ {
+-struct utmp *ut;
++struct utmpx *ut;
+ 
+     /* Find our entry in the Utmp file */
+-    if ((ut= find_utmp(mytty)) == NULL || ut->ut_name[0] == '\0')
++    if ((ut= find_utmp(mytty)) == NULL || ut->ut_user[0] == '\0')
+     {
+ 	printf("%s: Unable to find your tty (%s) in utmp file\n",
+ 		progname,mytty);
+@@ -602,7 +602,7 @@
+     myutmp= *ut;
+ 
+     /* Find the entry in the wrttmp file */
+-    find_wrttmp(mytty,myutmp.ut_time,&mywrt,&mypos);
++    find_wrttmp(mytty,myutmp.ut_tv.tv_sec,&mywrt,&mypos);
+ }
+ 
+ 
+@@ -616,13 +616,13 @@
+ #define BUFSZ 80
+ FILE *hfp;
+ char buf[BUFSZ+1];
+-char myname[UT_NAMESIZE+2];
++char myname[sizeof(myutmp.ut_user)+1];
+ 
+ 	if (f_helperlist == NULL || (hfp= fopen(f_helperlist,"r")) == NULL)
+ 		return TRUE;
+ 	
+-	strncpy(myname,myutmp.ut_name,UT_NAMESIZE);
+-	myname[UT_NAMESIZE]= '\0';
++	strncpy(myname,myutmp.ut_user,sizeof(myutmp.ut_user) -1);
++	myname[sizeof(myutmp.ut_user)]= '\0';
+ 	strcat(myname,"\n");
+ 	
+ 	while (fgets(buf,BUFSZ,hfp) != NULL)
+@@ -645,7 +645,7 @@
+ {
+ struct wrthist *hist;
+ struct wrttmp w;
+-struct utmp *u;
++struct utmpx *u;
+ long writer, writee;
+ time_t now;
+ int n, foundsome= 0;
+@@ -669,7 +669,7 @@
+ 
+     for (writee= 0; writee < n; writee++)
+     {
+-	if (hist[writee].tm > myutmp.ut_time &&
++	if (hist[writee].tm > myutmp.ut_tv.tv_sec &&
+ 	    now - hist[writee].tm <= f_answertel)
+ 	{
+ 	    /* Fetch "his" wrttmp entry - it may actually belong to a previous
+@@ -688,12 +688,12 @@
+ 	    /* Fetch his utmp entry, and confirm that the current user was
+ 	     * already logged in there when we sent our last telegram there.
+ 	     */
+-	    if ((u= find_utmp(w.wrt_line)) == NULL || u->ut_name[0] == '\0' ||
+-	        hist[writee].tm < u->ut_time)
++	    if ((u= find_utmp(w.wrt_line)) == NULL || u->ut_user[0] == '\0' ||
++	        hist[writee].tm < u->ut_tv.tv_sec)
+ 	    	continue;
+ 
+ 	    /* Check if due to exceptions he may write us anyway */
+-	    if (f_exceptions && newmode > 1 && maywriteme(u->ut_name, newmode))
++	    if (f_exceptions && newmode > 1 && maywriteme(u->ut_user, newmode))
+ 	    	continue;
+ 
+ 	    if (!foundsome)
+@@ -703,8 +703,8 @@
+ 	        foundsome= 1;
+ 	    }
+ 	    printf("  %-*.*s %-*.*s %4.1f more minutes\n",
+-	    	UT_NAMESIZE, UT_NAMESIZE, u->ut_name,
+-	    	UT_LINESIZE, UT_LINESIZE, u->ut_line,
++	    	sizeof(u->ut_user) -1, sizeof(u->ut_user) -1, u->ut_user,
++	    	sizeof(u->ut_line) -1, sizeof(u->ut_line) -1, u->ut_line,
+ 	        (float)(f_answertel - now + hist[writee].tm)/60.0);
+ 	}
+     }
+@@ -717,7 +717,7 @@
+ 
+ char *myhomedir()
+ {
+-char myname[UT_NAMESIZE+2];
++char myname[sizeof(myutmp.ut_user)+1];
+ struct passwd *pw;
+ char *dir, *getenv();
+ 
+@@ -726,8 +726,8 @@
+ 	return dir;
+ 
+     /* If that don't work, try passwd file */
+-    strncpy(myname,myutmp.ut_name,UT_NAMESIZE);
+-    myname[UT_NAMESIZE]= '\0';
++    strncpy(myname,myutmp.ut_user,sizeof(myutmp.ut_user) -1);
++    myname[sizeof(myutmp.ut_user)]= '\0';
+     if ((pw= getpwnam(myname)) != NULL)
+     	return pw->pw_dir;
+ 

Copied: head/misc/orville-write/files/patch-wrt_him.c (from r390640, head/misc/orville-write/files/utmpx-wrt_him.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/orville-write/files/patch-wrt_him.c	Tue Sep 22 03:46:11 2015	(r397528, copy of r390640, head/misc/orville-write/files/utmpx-wrt_him.c)
@@ -0,0 +1,150 @@
+--- wrt_him.c.orig	2004-09-28 20:32:13.000000000 -0700
++++ wrt_him.c	2010-02-02 22:31:08.634155195 -0800
+@@ -116,7 +116,7 @@
+ extern struct wrttmp mywrt;
+ 
+     /* Open utmp file */
+-    setutent();
++    setutxent();
+ 
+     /* Look me up */
+     find_me();
+@@ -204,7 +204,7 @@
+ int perm, hisperm= 0;
+ time_t hisatime= 0;
+ time_t atime;
+-struct utmp *ut;
++struct utmpx *ut;
+ struct wrttmp tmpwrt;
+ long tmppos;
+ 
+@@ -213,16 +213,14 @@
+     {
+         /* Check if this is the target user, ignoring X-window lines */
+         if (ut->ut_line[0] != ':' &&
+-#ifdef USER_PROCESS
+ 	    ut->ut_type == USER_PROCESS &&
+-#endif
+-	    !strncmp(hisname, ut->ut_name, UT_NAMESIZE))
++	    !strncmp(hisname, ut->ut_user, UT_NAMESIZE))
+ 	{
+ 	    /* Count matches */
+ 	    cnt++;
+ 
+ 	    /* Find wrttmp entry */
+-	    find_wrttmp(ut->ut_line, ut->ut_time, &tmpwrt, &tmppos);
++	    find_wrttmp(ut->ut_line, ut->ut_tv.tv_sec, &tmpwrt, &tmppos);
+ 
+ 	    /* Is this guy writing me? */
+ 	    write_me= !strncmp(tmpwrt.wrt_what,myname,UT_NAMESIZE);
+@@ -283,7 +281,7 @@
+ 
+ int find_tty()
+ {
+-struct utmp *ut;
++struct utmpx *ut;
+ 
+     if ((ut= find_utmp(histty)) == NULL)
+ 	return(1);
+@@ -291,23 +289,23 @@
+     if (*hisname != '\0')
+     {
+ 	/* Does the name not match? */
+-	if (strncmp(hisname, ut->ut_name, UT_NAMESIZE))
++	if (strncmp(hisname, ut->ut_user, UT_NAMESIZE))
+ 	    return(2);
+     }
+     else
+     {
+ 	/* Is anyone on that line? */
+-	if (*ut->ut_name == '\0')
++	if (*ut->ut_user == '\0')
+ 	{
+ 	    printf("No one logged onto %s\n",histty);
+ 	    wrtlog("FAIL: empty tty");
+ 	    done(1);
+ 	}
+-	strncpy(hisname, ut->ut_name, UT_NAMESIZE);
++	strncpy(hisname, ut->ut_user, UT_NAMESIZE);
+     }
+     printf("%s to %s on %s...",what[telegram],hisname,histty);
+     if (!telegram) putchar('\n');
+-    find_wrttmp(histty,ut->ut_time,&hiswrt,&hispos);
++    find_wrttmp(histty,ut->ut_tv.tv_sec,&hiswrt,&hispos);
+     return(0);
+ }
+ 
+@@ -321,7 +319,7 @@
+ 
+ void find_answer()
+ {
+-struct utmp *ut;
++struct utmpx *ut;
+ int slot;
+ 
+     lseek(wstream,hispos= wrttmp_offset(slot= 0),0);
+@@ -332,9 +330,9 @@
+ 	{
+ 	    /* Found someone writing me - get his name from utmp */
+ 	    strncpy(histty,hiswrt.wrt_line,UT_LINESIZE);
+-	    if ((ut= find_utmp(histty)) != NULL && ut->ut_name[0] != '\0')
++	    if ((ut= find_utmp(histty)) != NULL && ut->ut_user[0] != '\0')
+ 	    {
+-		strncpy(hisname,ut->ut_name,UT_NAMESIZE);
++		strncpy(hisname,ut->ut_user,UT_NAMESIZE);
+ 		printf("Replying to %s on %s...",hisname,histty);
+ 		if (!telegram) putchar('\n');
+ 		return;
+@@ -363,7 +361,7 @@
+ int ahelpers= 0;	/* Number of helpers available */
+ int previous;
+ int slot= 0;
+-struct utmp *ut;
++struct utmpx *ut;
+ struct wrttmp tmpwrt;
+ long tmppos;
+ 
+@@ -387,7 +385,7 @@
+ 	
+ 	/* Find the helper candidate in utmp - if he's not there skip out */
+ 	if ((ut= find_utmp(tmpwrt.wrt_line)) == NULL ||
+-	    ut->ut_name[0] == '\0' || ut->ut_time != tmpwrt.wrt_time)
++	    ut->ut_user[0] == '\0' || ut->ut_tv.tv_sec != tmpwrt.wrt_time)
+ 	    continue;
+ 	
+ 	/* Reject helpers with their message permissions off */
+@@ -397,14 +395,14 @@
+ 	    {
+ 	    	/* Perms off - but am I in .yeswrite file? */
+ 	    	if (!f_exceptions || tmpwrt.wrt_except != 'y' ||
+-	    	    !isuexception(ut->ut_name, 1, myname))
++	    	    !isuexception(ut->ut_user, 1, myname))
+ 	    	    	continue;
+ 	    }
+ 	    else
+ 	    {
+ 	    	/* Perms on - but am I in .nowrite file? */
+ 	    	if (f_exceptions && tmpwrt.wrt_except == 'y' &&
+-	    	    isuexception(ut->ut_name, 0, myname))
++	    	    isuexception(ut->ut_user, 0, myname))
+ 	    	    	continue;
+ 	    }
+         }
+@@ -422,7 +420,7 @@
+ 	ahelpers++;
+ 
+ 	/* Has he helped us before? */
+-	previous= !strncmp(ut->ut_name, mywrt.wrt_last, UT_NAMESIZE);
++	previous= !strncmp(ut->ut_user, mywrt.wrt_last, UT_NAMESIZE);
+ 
+ 	/* So roll the dice to see if we will choose him */
+ 	if (!previous && (unsigned)RAND() > (unsigned)RAND_MAX / ahelpers)
+@@ -430,7 +428,7 @@
+ 
+ 	/* We chose him, so make him our helper candidate so far */
+ 	strncpy(histty, tmpwrt.wrt_line, UT_LINESIZE);
+-	strncpy(hisname, ut->ut_name, UT_NAMESIZE);
++	strncpy(hisname, ut->ut_user, UT_NAMESIZE);
+ 	hiswrt= tmpwrt;
+ 	hispos= tmppos;
+ 

Copied: head/misc/orville-write/files/patch-wrt_me.c (from r390640, head/misc/orville-write/files/utmpx-wrt_me.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/orville-write/files/patch-wrt_me.c	Tue Sep 22 03:46:11 2015	(r397528, copy of r390640, head/misc/orville-write/files/utmpx-wrt_me.c)
@@ -0,0 +1,34 @@
+--- wrt_me.c.orig	2010-02-02 22:31:42.972816673 -0800
++++ wrt_me.c	2010-02-02 22:33:09.915329757 -0800
+@@ -14,19 +14,19 @@
+ 
+ void find_me()
+ {
+-struct utmp *ut;
++struct utmpx *ut;
+ struct passwd *pw;
+ int myuid;
+ 
+     /* Search utmp for myself */
+ 
+-    if ((ut= find_utmp(mytty)) == NULL || ut->ut_name[0] == '\0')
++    if ((ut= find_utmp(mytty)) == NULL || ut->ut_user[0] == '\0')
+     {
+ 	printf("%s: Panic - Unable to find your tty (%s) in "_PATH_UTMP"\n",
+ 	    progname, mytty);
+ 	done(1);
+     }
+-    strncpy(myname, ut->ut_name, UT_NAMESIZE);
++    strncpy(myname, ut->ut_user, UT_NAMESIZE);
+ 
+     /* Check if this is our real identity */
+ #ifndef SLOWPASSWD
+@@ -48,7 +48,7 @@
+ 
+     /* Find my wrt_tmp entry */
+ 
+-    find_wrttmp(mytty, ut->ut_time, &mywrt, &mypos);
++    find_wrttmp(mytty, ut->ut_tv.tv_sec, &mywrt, &mypos);
+ }
+ 
+ 

Copied: head/misc/orville-write/files/patch-wrttmp.h (from r390640, head/misc/orville-write/files/utmpx-wrttmp.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/orville-write/files/patch-wrttmp.h	Tue Sep 22 03:46:11 2015	(r397528, copy of r390640, head/misc/orville-write/files/utmpx-wrttmp.h)
@@ -0,0 +1,37 @@
+--- wrttmp.h.orig	2010-02-02 22:10:42.237520427 -0800
++++ wrttmp.h	2010-02-02 22:18:11.802300308 -0800
+@@ -30,7 +30,7 @@
+ #define WRTTMP_H
+ 
+ #include <sys/types.h>
+-#include <utmp.h>
++#include <utmpx.h>
+ 
+ /* BSDI is only Unix I know of that threatens to change namesize from 8 to
+  * anything else.  Most don't even have a define for it.  Here we default
+@@ -38,10 +38,10 @@
+  * for us.
+  */
+ #ifndef UT_NAMESIZE
+-#define UT_NAMESIZE 8
++#define UT_NAMESIZE (sizeof(((struct utmpx *)0)->ut_user) -1)
+ #endif
+ #ifndef UT_LINESIZE
+-#define UT_LINESIZE 8
++#define UT_LINESIZE (sizeof(((struct utmpx *)0)->ut_line) -1)
+ #endif
+ 
+ #if defined(TTY_GROUP) || defined(TTY_OTHERS)
+@@ -65,9 +65,9 @@
+ 	};
+ 
+ struct wrttmp {
+-	char wrt_line[UT_LINESIZE];	/* a tty line */
+-	char wrt_what[UT_NAMESIZE];	/* what this user is doing? */
+-	char wrt_last[UT_NAMESIZE];	/* Who did he last write to? */
++	char wrt_line[sizeof(((struct utmpx *)0)->ut_line) -1];	/* a tty line */
++	char wrt_what[sizeof(((struct utmpx *)0)->ut_user) -1];	/* what this user is doing? */
++	char wrt_last[sizeof(((struct utmpx *)0)->ut_user) -1];	/* Who did he last write to? */
+ #ifndef TTYPERMS
+ 	char wrt_mesg;			/* user's write perms (y or n) */
+ #endif /*TTYPERMS*/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509220346.t8M3kCqR009705>