diff options
author | miwi <miwi@FreeBSD.org> | 2010-02-10 22:38:19 +0800 |
---|---|---|
committer | miwi <miwi@FreeBSD.org> | 2010-02-10 22:38:19 +0800 |
commit | 0a8db0322a0e5c26148b69323e435c6e921917f4 (patch) | |
tree | 2bd1e130e80c8f3138e79a51a87009870cccb253 /misc | |
parent | ace46fbe95a45bb77c707c0e4476becbea561f9e (diff) | |
download | freebsd-ports-gnome-0a8db0322a0e5c26148b69323e435c6e921917f4.tar.gz freebsd-ports-gnome-0a8db0322a0e5c26148b69323e435c6e921917f4.tar.zst freebsd-ports-gnome-0a8db0322a0e5c26148b69323e435c6e921917f4.zip |
- Fix build on HEAD
PR: 143518
Submitted by: Rob Farmer <rfarmer@predatorlabs.net>
Diffstat (limited to 'misc')
-rw-r--r-- | misc/orville-write/Makefile | 18 | ||||
-rw-r--r-- | misc/orville-write/files/utmpx-amin.c | 40 | ||||
-rw-r--r-- | misc/orville-write/files/utmpx-getutent.c | 106 | ||||
-rw-r--r-- | misc/orville-write/files/utmpx-getutent.h | 13 | ||||
-rw-r--r-- | misc/orville-write/files/utmpx-helpers.c | 84 | ||||
-rw-r--r-- | misc/orville-write/files/utmpx-huh.c | 35 | ||||
-rw-r--r-- | misc/orville-write/files/utmpx-lib_common.c | 19 | ||||
-rw-r--r-- | misc/orville-write/files/utmpx-lib_common.h | 11 | ||||
-rw-r--r-- | misc/orville-write/files/utmpx-mesg.c | 159 | ||||
-rw-r--r-- | misc/orville-write/files/utmpx-wrt_him.c | 150 | ||||
-rw-r--r-- | misc/orville-write/files/utmpx-wrt_me.c | 34 | ||||
-rw-r--r-- | misc/orville-write/files/utmpx-wrttmp.h | 37 |
12 files changed, 705 insertions, 1 deletions
diff --git a/misc/orville-write/Makefile b/misc/orville-write/Makefile index 729151b35836..35d2069c4cbd 100644 --- a/misc/orville-write/Makefile +++ b/misc/orville-write/Makefile @@ -17,6 +17,22 @@ GNU_CONFIGURE= yes MAN1= amin.1 helpers.1 huh.1 mesg.1 write.1 +.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} -m 4711 ${WRKSRC}/${i} ${PREFIX}/bin @@ -37,4 +53,4 @@ do-install: ${INSTALL_MAN} ${WRKSRC}/${i} ${MANPREFIX}/man/man1 .endfor -.include <bsd.port.mk> +.include <bsd.port.post.mk> diff --git a/misc/orville-write/files/utmpx-amin.c b/misc/orville-write/files/utmpx-amin.c new file mode 100644 index 000000000000..c469459f5496 --- /dev/null +++ b/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 diff --git a/misc/orville-write/files/utmpx-getutent.c b/misc/orville-write/files/utmpx-getutent.c new file mode 100644 index 000000000000..acbdef74c917 --- /dev/null +++ b/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; + } + } + diff --git a/misc/orville-write/files/utmpx-getutent.h b/misc/orville-write/files/utmpx-getutent.h new file mode 100644 index 000000000000..16147b9e82f1 --- /dev/null +++ b/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 */ diff --git a/misc/orville-write/files/utmpx-helpers.c b/misc/orville-write/files/utmpx-helpers.c new file mode 100644 index 000000000000..3fc7bf2d286e --- /dev/null +++ b/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) diff --git a/misc/orville-write/files/utmpx-huh.c b/misc/orville-write/files/utmpx-huh.c new file mode 100644 index 000000000000..e7508d00d494 --- /dev/null +++ b/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'); + } diff --git a/misc/orville-write/files/utmpx-lib_common.c b/misc/orville-write/files/utmpx-lib_common.c new file mode 100644 index 000000000000..00db6944cf73 --- /dev/null +++ b/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); + } + + diff --git a/misc/orville-write/files/utmpx-lib_common.h b/misc/orville-write/files/utmpx-lib_common.h new file mode 100644 index 000000000000..58da23112e59 --- /dev/null +++ b/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); diff --git a/misc/orville-write/files/utmpx-mesg.c b/misc/orville-write/files/utmpx-mesg.c new file mode 100644 index 000000000000..d1a4a577e360 --- /dev/null +++ b/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; + diff --git a/misc/orville-write/files/utmpx-wrt_him.c b/misc/orville-write/files/utmpx-wrt_him.c new file mode 100644 index 000000000000..ac9dc9e83aa0 --- /dev/null +++ b/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; + diff --git a/misc/orville-write/files/utmpx-wrt_me.c b/misc/orville-write/files/utmpx-wrt_me.c new file mode 100644 index 000000000000..00f9c921a881 --- /dev/null +++ b/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); + } + + diff --git a/misc/orville-write/files/utmpx-wrttmp.h b/misc/orville-write/files/utmpx-wrttmp.h new file mode 100644 index 000000000000..07f221c79f1b --- /dev/null +++ b/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*/ |