rick@uunet.UU.NET (Rick Adams) (01/25/89)
Description: This single logical patch is being distributed as 3 physical patches. You MUST install patches 15, 16 and 17 or things won't compile. *** You MUST do "make update" after the "make install". These are patches #15, 16 & 17 for news 2.11 source. They address the following problems: better integrates NFS support better handling of "make install" checkgroups doesn't generate the leading "|" in egrep "|whatever" any more. fixes the 'l' and 'L' commands of vnews and readnews. Formerly, they were always one less than they should have been. better handling of errors for compress/uncompress/zcat rename MANUALLY to NORMGROUPS for consistency. NONEWGROUPS and NORMGROUPS are now defined as a pattern, so you can say something like: #define NONEWGROUPS "comp,sci,news" and it will send you mail for newgroup messages in those groups and go ahead and do the newgroup for those that don't match. You get the old behavior by defining them as the pattern "all". control messages that send you mail now include the body of the control message in the mail. systems with signals returning void* instead of int* can define VOIDSIGNALS in defs.h 4.3 BSD based systems can define SYSLOG to use the syslog facility in place of the usual logging. (Very handy with a network of machines and 1 admin.) If ALLOW_LIB_EXECS is not defined (default) arbitrary commands in /usr/lib/news will not be executable as batch commands. If it is defined, the previous behavior occurs. expire is much faster and no longer loses the history of expired articles when doing a rebuild (expire -r) expire now accepts arguments expressing time in floating point days instead of int. So, expire -e 0.5 would expire things over 12 hours old (Yes there are sites that do this) fullname now better handles hyphenated names. many places now do a much better job of checking buffer overflow, especially when reading in a new article and parsing the sys file. when unparsable dates are found, the offending file name is logged. getdate better handles some forms of dates. It was previously confusing years with numerical time zone offsets in some cases. message-ids now can only contain printing characters. messages received from OTHER machines with "local" distribution are rejected. "local" articles should NEVER leave your machine. local means local to that machine, not your site. You can now transmit articles based on size. If >XXX or < YYY appear in the third field of the sys file, then the article will only be transmitted if the size > XXX. E.g. site1:world,comp:IF>50000 site1:world,comp:F would send all articles > 50,000 bytes via ihave/sendme and the rest "immediately" via normal batching. /usr/spool/news isn't clutter up by temporary and failed articles any more. /usr/spool/news/.tmp and /usr/spool/news/.bad get the temp and bad articles respectively. locking is handled a little better. Inews insists on a followup-to: line being present of you are following up to an article posted to multiple groups. This will only affect followups to your followup. Similarly, postnews asks (but doesn't insist) you to specify a folloup group. recnews may finally get quoted arguments right. sendbatch has lots of new options, all off by default. Look at the shell script if you want to know what they are. uurec is a little better at catching forged articles. define DIRENT if your system uses struct dirent instead of struct direct Fix: cd to the src directory and apply the following patch THEN apply patch 16 as well. ********************************************************** * You MUST do "make update" after the "make install" * ********************************************************** Index: Makefile.dst Prereq: 1.30 *** old/Makefile.dst Fri Dec 4 02:51:51 1987 --- Makefile.dst Thu Jan 19 00:04:22 1989 *************** *** 1,2 ! # '@(#)Makefile.dst 1.30 12/1/87' # Generic Makefile. --- 1,2 ----- ! # '@(#)Makefile.dst 1.33 1/19/89' # Generic Makefile. *************** *** 34,36 ! #NNTP NNTPDIR = NNTPSRC --- 34,36 ----- ! #NNTP NNTPDIR = NNTPLOC *************** *** 46,47 #NFSCLIENT INST = nfs --- 46,48 ----- #NFSCLIENT INST = nfs + #NNTP INST = nntp *************** *** 99,101 OBJECTS = funcs.o funcs2.o header.o ndir.o $(MISC) getdate.o ! IOBJECTS = inews.o ifuncs.o iextern.o control.o fullname.o \ $(OBJECTS) ipathinit.o --- 100,102 ----- OBJECTS = funcs.o funcs2.o header.o ndir.o $(MISC) getdate.o ! IOBJECTS = inews.o ifuncs.o iextern.o control.o fullname.o elock.o \ $(OBJECTS) ipathinit.o *************** *** 107,110 $(OBJECTS) visual.o virtterm.o rpathinit.o ! EXPOBJS = expire.o header.o funcs.o getdate.o iextern.o \ ! funcs2.o ndir.o $(MISC) epathinit.o --- 108,111 ----- $(OBJECTS) visual.o virtterm.o rpathinit.o ! EXPOBJS = expire.o header.o funcs.o getdate.o iextern.o elock.o \ ! funcs2.o ndir.o $(MISC) epathinit.o *************** *** 113,115 SRCS = funcs.c funcs2.c header.c ! ISRCS = inews.c ifuncs.c iextern.c control.c fullname.c $(SRCS) PSRCS = postnews.c rextern.c funcs.c $(CSRCS) --- 114,116 ----- SRCS = funcs.c funcs2.c header.c ! ISRCS = inews.c ifuncs.c iextern.c control.c fullname.c elock.c $(SRCS) PSRCS = postnews.c rextern.c funcs.c $(CSRCS) *************** *** 119,121 visual.c virtterm.c $(CSRCS) ! ESRCS = expire.c header.c funcs.c iextern.c \ funcs2.c --- 120,122 ----- visual.c virtterm.c $(CSRCS) ! ESRCS = expire.c header.c funcs.c iextern.c elock.c \ funcs2.c *************** *** 130,131 NFSOTHERS = inews OTHERS = $(NFSOTHERS) $(UTILS) $(SCRIPTS) --- 131,133 ----- NFSOTHERS = inews + NNTPOTHERS = OTHERS = $(NFSOTHERS) $(UTILS) $(SCRIPTS) *************** *** 140,141 install: $(INST)install --- 142,145 ----- + nntpall: $(P) $(NNTPOTHERS) $(COMMANDS) + install: $(INST)install *************** *** 147,149 for i in $(COMMANDS); do \ ! ./installit -m 755 -o $(NEWSUSR) -g $(NEWSGRP) -s $$i \ $(DESTDIR)$(BINDIR); \ --- 151,153 ----- for i in $(COMMANDS); do \ ! ./installit -c -m 755 -o $(NEWSUSR) -g $(NEWSGRP) -s $$i \ $(DESTDIR)$(BINDIR); \ *************** *** 150,152 done ! cp help vnews.help $(DESTDIR)$(LIBDIR) for i in $(UTILS); do \ --- 154,159 ----- done ! for i in help vnews.help; do \ ! ./installit -c -m 644 -o $(NEWSUSR) -g $(NEWSGRP) $$i\ ! $(DESTDIR)$(LIBDIR); \ ! done for i in $(UTILS); do \ *************** *** 152,154 for i in $(UTILS); do \ ! ./installit -m 755 -o $(NEWSUSR) -g $(NEWSGRP) -s $$i \ $(DESTDIR)$(LIBDIR); \ --- 159,161 ----- for i in $(UTILS); do \ ! ./installit -c -m 755 -o $(NEWSUSR) -g $(NEWSGRP) -s $$i \ $(DESTDIR)$(LIBDIR); \ *************** *** 156,158 for i in $(SCRIPTS); do \ ! ./installit -m 755 -o $(NEWSUSR) -g $(NEWSGRP) $$i \ $(DESTDIR)$(LIBDIR); \ --- 163,165 ----- for i in $(SCRIPTS); do \ ! ./installit -c -m 755 -o $(NEWSUSR) -g $(NEWSGRP) $$i \ $(DESTDIR)$(LIBDIR); \ *************** *** 159,161 done ! ./installit -m 6755 -o $(NEWSUSR) -g $(NEWSGRP) -s inews \ $(DESTDIR)$(LIBDIR) --- 166,168 ----- done ! ./installit -c -m 6755 -o $(NEWSUSR) -g $(NEWSGRP) -s inews \ $(DESTDIR)$(LIBDIR) *************** *** 172,174 for i in $(COMMANDS); do \ ! ./installit -m 755 -o $(NEWSUSR) -g $(NEWSGRP) -s $$i \ $(DESTDIR)$(BINDIR); \ --- 179,181 ----- for i in $(COMMANDS); do \ ! ./installit -c -m 755 -o $(NEWSUSR) -g $(NEWSGRP) -s $$i \ $(DESTDIR)$(BINDIR); \ *************** *** 176,178 cp help vnews.help $(DESTDIR)$(LIBDIR) ! ./installit -m 6755 -o root -g $(NEWSGRP) -s inews \ $(DESTDIR)$(LIBDIR) --- 183,185 ----- cp help vnews.help $(DESTDIR)$(LIBDIR) ! ./installit -c -m 6755 -o root -g $(NEWSGRP) -s inews \ $(DESTDIR)$(LIBDIR) *************** *** 181,182 defs.h: defs.dist localize.sh Makefile.dst Makefile --- 188,200 ----- + nntpinstall: nntpall help vnews.help + chmod 755 ./installit + -test -d $(DESTDIR)$(BINDIR) || mkdir $(DESTDIR)$(BINDIR) + -test -d $(DESTDIR)$(LIBDIR) || mkdir $(DESTDIR)$(LIBDIR) + for i in $(COMMANDS); do \ + ./installit -m 755 -o $(NEWSUSR) -g $(NEWSGRP) -s $$i \ + $(DESTDIR)$(BINDIR); \ + done + cp help vnews.help $(DESTDIR)$(LIBDIR) + #VMS vms -v @euninstal + defs.h: defs.dist localize.sh Makefile.dst Makefile *************** *** 194,196 fullupdate: install.sh makeactive.sh ! sh install.sh $(DESTDIR)$(SPOOLDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(NEWSUSR) $(DESTDIR)$(NEWSGRP) $(DESTDIR)$(OSTYPE) chmod 6755 $(DESTDIR)$(LIBDIR)/inews --- 212,214 ----- fullupdate: install.sh makeactive.sh ! sh install.sh $(DESTDIR)$(SPOOLDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(BINDIR) $(NEWSUSR) $(NEWSGRP) $(OSTYPE) chmod 6755 $(DESTDIR)$(LIBDIR)/inews *************** *** 198,200 nfsupdate: install.sh ! sh install.sh $(DESTDIR)$(SPOOLDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(NEWSUSR) $(DESTDIR)$(NEWSGRP) $(DESTDIR)$(OSTYPE) $(DESTDIR)$(NFSSPOOLDIR) $(DESTDIR)$(NFSLIBDIR) chown root $(DESTDIR)$(LIBDIR)/inews --- 216,218 ----- nfsupdate: install.sh ! sh install.sh $(DESTDIR)$(SPOOLDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(BINDIR) $(NEWSUSR) $(NEWSGRP) $(OSTYPE) $(DESTDIR)$(NFSSPOOLDIR) $(DESTDIR)$(NFSLIBDIR) chown root $(DESTDIR)$(LIBDIR)/inews *************** *** 202,204 ! clean: --- 220,224 ----- ! nntpupdate: ! @echo "There is no update for NNTP clients as yet." ! clean: *************** *** 245,247 getdate.o: getdate.y defs.h ! @echo "expect 8 shift/reduce conflicts" yacc getdate.y --- 265,267 ----- getdate.o: getdate.y defs.h ! @echo "expect 5 shift/reduce conflicts" yacc getdate.y *************** *** 382,384 ! digest.o: digest.c Makefile $(CC) $(CFLAGS) -c digest.c --- 402,404 ----- ! digest.o: digest.c rparams.h defs.h Makefile $(CC) $(CFLAGS) -c digest.c *************** *** 384,385 $(CC) $(CFLAGS) -c digest.c --- 404,408 ----- $(CC) $(CFLAGS) -c digest.c + + elock.o: elock.c params.h defs.h Makefile + $(CC) $(CFLAGS) -c elock.c Index: batch.c Prereq: 1.20 *** old/batch.c Fri Dec 4 02:51:54 1987 --- batch.c Wed Jan 18 14:28:51 1989 *************** *** 1,2 - /* --- 1 ----- /* *************** *** 2,4 /* ! * This software is Copyright (c) 1985 by Rick Adams. * --- 1,3 ----- /* ! * This software is Copyright 1985, 1989 by Rick Adams. * *************** *** 34,36 #ifdef SCCSID ! static char *SccsId = "@(#)batch.c 1.20 11/30/87"; #endif /* SCCSID */ --- 33,35 ----- #ifdef SCCSID ! static char *SccsId = "@(#)batch.c 1.23 1/18/89"; #endif /* SCCSID */ *************** *** 62,63 long atol(); char fname[512]; --- 61,63 ----- long atol(); + int spooldirlen = strlen(SPOOLDIR); char fname[512]; *************** *** 94,95 if (argc > 2) --- 94,100 ----- + if (chdir(SPOOLDIR) < 0) { + logerror("chdir(%s): %s", workfile, sys_errlist[errno]); + exit(1); + } + if (argc > 2) *************** *** 105,107 continue; ! nfd = fopen(fname, "r"); if (nfd == NULL) { --- 110,117 ----- continue; ! /* this optimization speeds up batching significantly */ ! if (fname[0] == '/' && fname[spooldirlen-1] == '/') ! nfd = fopen(&fname[spooldirlen], "r"); ! else ! nfd = fopen(fname, "r"); ! if (nfd == NULL) { *************** *** 172,173 exit(0); } --- 182,184 ----- exit(0); + /*NOTREACHED*/ } Index: checkgroups.sh Prereq: 1.24 *** old/checkgroups.sh Wed Nov 4 14:56:19 1987 --- checkgroups.sh Sun Jan 15 19:48:29 1989 *************** *** 1,3 : check active file for missing or extra newsgroups ! : '@(#)checkgroups 1.24 11/4/87' --- 1,3 ----- : check active file for missing or extra newsgroups ! : '@(#)checkgroups 1.25 1/15/89' *************** *** 30,31 cp /dev/null /tmp/$$b sed -e "s;[ ].*;;" -e "s;\..*;;" -e "s;^!;;" /tmp/$$msg | sort -u | --- 30,32 ----- cp /dev/null /tmp/$$b + pipe='' sed -e "s;[ ].*;;" -e "s;\..*;;" -e "s;^!;;" /tmp/$$msg | sort -u | *************** *** 34,36 group=`cat /tmp/$$b` ! group="${group}|^$dist[. ]" echo "${group}" > /tmp/$$b --- 35,37 ----- group=`cat /tmp/$$b` ! group="${group}${pipe}^$dist[. ]" echo "${group}" > /tmp/$$b *************** *** 36,37 echo "${group}" > /tmp/$$b done --- 37,39 ----- echo "${group}" > /tmp/$$b + pipe='|' done *************** *** 73,75 echo "# You can remove them by executing the commands:" ! echo \ LIBDIR/rmgroup `cat /tmp/$$remove` echo "" --- 75,80 ----- echo "# You can remove them by executing the commands:" ! for i in `cat /tmp/$$remove` ! do ! echo " LIBDIR/rmgroup $i" ! done echo "" Index: compress.c Prereq: 1.14 *** old/compress.c Wed Oct 7 16:49:22 1987 --- compress.c Sun Jan 15 19:48:54 1989 *************** *** 1,3 #ifdef SCCSID ! static char *SccsId = "@(#)compress.c 1.14 9/24/87"; #endif /* SCCSID */ --- 1,3 ----- #ifdef SCCSID ! static char *SccsId = "@(#)compress.c 1.15 1/15/89"; #endif /* SCCSID */ *************** *** 438,439 if ((freopen(*fileptr, "r", stdin)) == NULL) { perror(*fileptr); continue; --- 438,440 ----- if ((freopen(*fileptr, "r", stdin)) == NULL) { + exit_stat = 1; perror(*fileptr); continue; *************** *** 446,447 *fileptr); continue; --- 447,449 ----- *fileptr); + exit_stat = 1; continue; *************** *** 456,457 *fileptr, maxbits, BITS); continue; --- 458,460 ----- *fileptr, maxbits, BITS); + exit_stat = 1; continue; *************** *** 470,471 if ((freopen(*fileptr, "r", stdin)) == NULL) { perror(*fileptr); continue; --- 473,475 ----- if ((freopen(*fileptr, "r", stdin)) == NULL) { + exit_stat = 1; perror(*fileptr); continue; *************** *** 528,529 if (freopen(ofname, "w", stdout) == NULL) { perror(ofname); --- 532,534 ----- if (freopen(ofname, "w", stdout) == NULL) { + exit_stat = 1; perror(ofname); Index: control.c Prereq: 2.57 *** old/control.c Mon Nov 23 19:13:14 1987 --- control.c Sun Jan 15 19:48:55 1989 *************** *** 1,3 /* ! * This software is Copyright (c) 1986 by Rick Adams. * --- 1,3 ----- /* ! * This software is Copyright 1986, 1989 by Rick Adams. * *************** *** 21,23 #ifdef SCCSID ! static char *SccsId = "@(#)control.c 2.57 11/19/87"; #endif /* SCCSID */ --- 21,23 ----- #ifdef SCCSID ! static char *SccsId = "@(#)control.c 2.58 1/15/89"; #endif /* SCCSID */ *************** *** 33,34 FILE *popen(), *mhopen(), *mailhdr(); --- 33,35 ----- FILE *popen(), *mhopen(), *mailhdr(); + FILE *controlmail; *************** *** 189,190 outfp = xfopen(INFILE, "a"); outpos = ftell(outfp); --- 190,198 ----- outfp = xfopen(INFILE, "a"); + #ifdef USG + /* + * When fopening to append, USG systems don't + * seek to EOF until write() is called. + */ + fseek(outfp, 0L, 2); + #endif outpos = ftell(outfp); *************** *** 318,320 if (fp == NULL) { ! logerr("Article %s unopenable as %s.", id, cp); return; --- 326,328 ----- if (fp == NULL) { ! log("Article %s unopenable as %s.", id, cp); return; *************** *** 349,352 /* local or ORGDISTRIB */ ! int can_change = (STRCMP(header.distribution, "local") == 0) || ! (STRCMP(header.distribution, ORGDISTRIB) == 0); # else /* ! ORGDISTRIB */ --- 357,361 ----- /* local or ORGDISTRIB */ ! int can_change = (STRCMP(header.distribution, "local") == 0) ! || (STRCMP(header.distribution, ORGDISTRIB) == 0) ! || !ngmatch(argv[1], NONEWGROUPS); # else /* ! ORGDISTRIB */ *************** *** 428,430 } ! (void) mclose(fd); } --- 437,440 ----- } ! fprintf(fd, "\n\n%s says:\n", header.path); ! controlmail = fd; } *************** *** 513,515 } ! (void) mclose(fd); } --- 523,526 ----- } ! fprintf(fd, "\n\n%s says:\n", header.path); ! controlmail = fd; } *************** *** 542,544 ! #ifdef MANUALLY #ifdef ORGDISTRIB --- 553,555 ----- ! #ifdef NORMGROUPS #ifdef ORGDISTRIB *************** *** 548,550 if (!STRCMP(ORGDISTRIB, header.distribution) ! || !STRCMP("local", header.distribution)) #else /* !ORGDISTRIB */ --- 559,562 ----- if (!STRCMP(ORGDISTRIB, header.distribution) ! || !STRCMP("local", header.distribution) ! || !ngmatch(argv[1], NORMGROUPS)) #else /* !ORGDISTRIB */ *************** *** 552,554 #endif /* !ORGDISTRIB */ ! #endif /* MANUALLY */ shouldremove++; --- 564,566 ----- #endif /* !ORGDISTRIB */ ! #endif /* NORMGROUPS */ shouldremove++; *************** *** 572,574 } ! (void) mclose(fd); } --- 584,587 ----- } ! fprintf(fd, "\n\n%s says:\n", header.path); ! controlmail = fd; } *************** *** 581,583 */ ! lock(); (void) sprintf(bfr, "%s/rmgroup", LIB); --- 594,596 ----- */ ! dolock(); (void) sprintf(bfr, "%s/rmgroup", LIB); *************** *** 594,596 } ! unlock(); if (status) --- 607,609 ----- } ! rmlock(); if (status) *************** *** 692,693 (void) unlink(nfilename); p = q+1; --- 705,708 ----- (void) unlink(nfilename); + if (q == NULL) + break; p = q+1; *************** *** 729,731 fprintf(f, "It has been sent.\n"); ! (void) mclose(f); } --- 744,747 ----- fprintf(f, "It has been sent.\n"); ! fprintf(f, "\n\n%s says:\n", header.path); ! controlmail = f; } *************** *** 889,891 { ! register f, r, (*hstat)(), (*istat)(), (*qstat)(); int status; --- 905,908 ----- { ! register int f, r; ! SIGNAL_TYPE hstat, istat, qstat; int status; Index: defs.dist Prereq: 2.61 *** old/defs.dist Fri Dec 4 02:51:57 1987 --- defs.dist Tue Jan 24 15:23:59 1989 *************** *** 1,3 /* ! * This software is Copyright (c) 1986 by Rick Adams. * --- 1,3 ----- /* ! * This software is Copyright 1986, 1989 by Rick Adams. * *************** *** 16,18 ! /* @(#)defs.dist 2.61 11/30/87 */ --- 16,18 ----- ! /* @(#)defs.dist 2.65 1/24/89 */ *************** *** 49,52 /* #define UUPROG "euuname" /* omit for uuname, put in LIBDIR */ ! #define MANUALLY /* Don't execute rmgroups, just notify. */ ! /* #define NONEWGROUPS /* Don't create new groups, just notify.*/ /* #define SPOOLNEWS /* Spool incoming rnews, don't process */ --- 49,52 ----- /* #define UUPROG "euuname" /* omit for uuname, put in LIBDIR */ ! #define NORMGROUPS "all" /* Don't execute rmgroups, just notify. */ ! /* #define NONEWGROUPS "all" /* Don't create new groups, just notify.*/ /* #define SPOOLNEWS /* Spool incoming rnews, don't process */ *************** *** 75,76 /* #define READDIR /* your system has readdir() in libc */ /* #define RENAMESUB /* your system has rename() in libc */ --- 75,77 ----- /* #define READDIR /* your system has readdir() in libc */ + /* #define DIRENT /* use struct dirent instead of struct direct */ /* #define RENAMESUB /* your system has rename() in libc */ *************** *** 76,77 /* #define RENAMESUB /* your system has rename() in libc */ /* #define ALWAYSALIAS /* temporary kludge for conversion */ --- 77,80 ----- /* #define RENAMESUB /* your system has rename() in libc */ + /* #define VOID_SIGNALS /* signal returns a void * instead of int * */ + /* #define SYSLOG /* If you want errors logged via 4.3bsd syslog */ /* #define ALWAYSALIAS /* temporary kludge for conversion */ *************** *** 77,78 /* #define ALWAYSALIAS /* temporary kludge for conversion */ /* #define SENDMAIL "/usr/lib/sendmail" /* command line to run "sendmail" if you have it */ --- 80,82 ----- /* #define ALWAYSALIAS /* temporary kludge for conversion */ + /* #define ALLOW_LIB_EXECS /* allow news batches to execute commands in LIBDIR */ /* #define SENDMAIL "/usr/lib/sendmail" /* command line to run "sendmail" if you have it */ *************** *** 97,98 /* of the $(LIB)/moderators file */ --- 101,105 ----- /* of the $(LIB)/moderators file */ + /* #define MINFREE 5000 /* minimum number of free blocks needed in spool*/ + /* partition before unbatching will take place */ + /* USG only */ *************** *** 110,111 #define LBUFLEN 1024 /* big buffer size */ #define SBUFLEN 32 /* small buffer size (for system names, etc) */ --- 117,119 ----- #define LBUFLEN 1024 /* big buffer size */ + #define MBUFLEN 256 /* medium buffer size */ #define SBUFLEN 32 /* small buffer size (for system names, etc) */ *************** *** 124,131 #define NGDELIM ',' /* delimit character in news group line */ - - /* for NNTP */ - #ifdef SERVER - # include "NNTPSRC/common/response_codes.h" - # define SERVER_FILE "SERVERFILE" - #endif /* SERVER */ --- 132,133 ----- #define NGDELIM ',' /* delimit character in news group line */ Index: elock.c *** old/elock.c Sun Jan 15 19:53:44 1989 --- elock.c Thu Jan 19 00:17:32 1989 *************** *** 0 --- 1,56 ----- + #ifndef lint + static char *SccsId = "@(#)elock.c 1.3 1/19/89"; + #endif /* !lint */ + + #include "params.h" + #include <errno.h> + + #ifdef BSD4_2 + # include <sys/file.h> + #endif /* BSD4_2 */ + + #ifdef LOCKF + #include <unistd.h> + #endif /* LOCKF */ + + #if defined(BSD4_2) || defined(LOCKF) + static int LockFd = -1; + #endif + + extern int errno; + + dolock() + { + /* set up exclusive locking so inews does not run while expire does */ + #if defined(BSD4_2) || defined(LOCKF) + LockFd = open(ACTIVE, 2); + # ifdef LOCKF + if (lockf(LockFd, F_LOCK, 0L) < 0) + # else /* BSD4_2 */ + if (flock(LockFd, LOCK_EX) < 0) + # endif /* BSD4_2 */ + xerror("Can't get lock on active file for %s : %s", + Progname, errmsg(errno)); + #else /* !BSD4_2 && !LOCKF */ + int i = 0; + char afline[MBUFLEN]; + sprintf(afline,"%s.lock", ACTIVE); + while (LINK(ACTIVE, afline) < 0 && errno == EEXIST) { + if (i++ > 5) { + xerror("Can't get lock on active file for %s: %s", + Progname, errmsg(errno)); + } + sleep(i*2); + } + #endif /* !BSD4_2 && !LOCKF */ + } + + rmlock() + { + #if defined(BSD4_2) || defined(LOCKF) + close(LockFd); + #else + sprintf(bfr, "%s.lock", ACTIVE); + (void) UNLINK(bfr); + #endif /* !BSD4_2 */ + } Index: expire.c Prereq: 2.57 *** old/expire.c Fri Dec 4 02:52:00 1987 --- expire.c Thu Jan 19 00:06:40 1989 *************** *** 1,3 /* ! * This software is Copyright (c) 1986 by Rick Adams. * --- 1,3 ----- /* ! * This software is Copyright 1986, 1989 by Rick Adams. * *************** *** 19,21 #ifdef SCCSID ! static char *SccsId = "@(#)expire.c 2.57 11/30/87"; #endif /* SCCSID */ --- 19,21 ----- #ifdef SCCSID ! static char *SccsId = "@(#)expire.c 2.61 1/19/89"; #endif /* SCCSID */ *************** *** 63,64 int doupdateactive = 0; /* update ACTIVE file */ char baduser[BUFLEN]; --- 63,65 ----- int doupdateactive = 0; /* update ACTIVE file */ + int dontexec = 0; /* don't exec rnews -U */ char baduser[BUFLEN]; *************** *** 65,66 extern char filename[], nbuf[]; --- 66,68 ----- extern char filename[], nbuf[]; + double atof(); *************** *** 94,96 int ngpatlen = 0; ! char afline[BUFLEN]; char grpsleft[BUFLEN]; --- 96,98 ----- int ngpatlen = 0; ! char afline[MBUFLEN]; char grpsleft[BUFLEN]; *************** *** 150,152 argc--; ! expincr = atol(argv[1]) * DAYS; } else if (isdigit(argv[1][2])) --- 152,154 ----- argc--; ! expincr = atof(argv[1]) * DAYS; } else if (isdigit(argv[1][2])) *************** *** 152,154 } else if (isdigit(argv[1][2])) ! expincr = atol(&argv[1][2]) * DAYS; break; --- 154,156 ----- } else if (isdigit(argv[1][2])) ! expincr = atof(&argv[1][2]) * DAYS; break; *************** *** 158,160 argc--; ! dropincr = atol(argv[1]) * DAYS; } else if (isdigit(argv[1][2])) --- 160,162 ----- argc--; ! dropincr = atof(argv[1]) * DAYS; } else if (isdigit(argv[1][2])) *************** *** 160,162 } else if (isdigit(argv[1][2])) ! dropincr = atol(&argv[1][2]) * DAYS; break; --- 162,164 ----- } else if (isdigit(argv[1][2])) ! dropincr = atof(&argv[1][2]) * DAYS; break; *************** *** 252,253 break; default: --- 254,258 ----- break; + case 'X': /* don't exec rnews -U */ + dontexec++; + break; default: *************** *** 310,311 #endif /* PROFILING */ #ifdef LOGDIR --- 315,320 ----- #endif /* PROFILING */ + if (dontexec) + xxit(0); + if (vfork() > 0) /* don't hold up expire while rnews is running */ + xxit(0); #ifdef LOGDIR *************** *** 331,333 DIR *ngdirp = NULL; ! static struct direct *ngdir; --- 340,342 ----- DIR *ngdirp = NULL; ! static DIRECTORY_STRUCT *ngdir; *************** *** 385,387 closedir(ngdirp); ! if (fgets(afline, BUFLEN, ohfd) == NULL) goto out; --- 394,396 ----- closedir(ngdirp); ! if (fgets(afline, MBUFLEN,ohfd) == NULL) goto out; *************** *** 418,420 #ifdef DBM ! if (fgets(afline, BUFLEN, ohfd) == NULL) break; --- 427,429 ----- #ifdef DBM ! if (fgets(afline, MBUFLEN, ohfd) == NULL) break; *************** *** 421,423 #else ! if (fgets(afline, BUFLEN, ohfd) == NULL) if (!(ohfd = nexthistfile(ohfd))) --- 430,432 ----- #else ! if (fgets(afline, MBUFLEN, ohfd) == NULL) if (!(ohfd = nexthistfile(ohfd))) *************** *** 429,430 printf("article: %s", afline); p1 = index(afline, '\t'); --- 438,441 ----- printf("article: %s", afline); + if (afline[0] != '<') + continue; p1 = index(afline, '\t'); *************** *** 440,442 (void) strcpy(recdate, p1+1); ! (void) strcat(recdate, " GMT"); rectime = cgtdate(recdate); --- 451,463 ----- (void) strcpy(recdate, p1+1); ! { ! register char * tp; ! ! tp = recdate; ! if (*tp == ' ') ! ++tp; ! if (strlen(tp) == 14 && tp[2] == '/' && ! tp[5] == '/' && tp[8] == ' ' && ! tp[11] == ':') ! (void) strcat(recdate, " GMT"); ! } rectime = cgtdate(recdate); *************** *** 597,599 tm = gmtime(&rectime); ! if (fprintf(nhfd, #ifdef USG --- 618,620 ----- tm = gmtime(&rectime); ! fprintf(nhfd, #ifdef USG *************** *** 605,609 tm->tm_mon+1, tm->tm_mday, tm->tm_year, ! tm->tm_hour, tm->tm_min, filename) ! == EOF) ! xerror("History write failed"); (void) fclose(fp); --- 626,630 ----- tm->tm_mon+1, tm->tm_mday, tm->tm_year, ! tm->tm_hour, tm->tm_min, filename); ! if(ferror(nhfd)) ! xerror("History write failed"); (void) fclose(fp); *************** *** 711,713 h.ident, recdate); ! if (fputs(afline, nhfd) == EOF) xerror("history write failed"); --- 732,735 ----- h.ident, recdate); ! fputs(afline, nhfd); ! if (ferror(nhfd)) xerror("history write failed"); *************** *** 749,751 tm = gmtime(&rectime); ! if ( fprintf(nhfd, #ifdef USG --- 771,773 ----- tm = gmtime(&rectime); ! fprintf(nhfd, #ifdef USG *************** *** 757,761 tm->tm_mon+1, tm->tm_mday, tm->tm_year, ! tm->tm_hour, tm->tm_min, mhp->mh_file) ! == EOF ) ! xerror("History write failed"); (void) fclose(fp); --- 779,783 ----- tm->tm_mon+1, tm->tm_mday, tm->tm_year, ! tm->tm_hour, tm->tm_min, mhp->mh_file); ! if (ferror(nhfd)) ! xerror("History write failed"); (void) fclose(fp); *************** *** 763,764 } (void) pclose(nhfd); --- 785,822 ----- } + /* + * lastly, see if we can fish the history of any expired + * articles out of the old history file + */ + if (verbose) + printf("Trying to extract usable expired article history\n"); + ohfd = xfopen(ARTFILE, "r"); + while (fgets(afline, MBUFLEN, ohfd) != NULL) { + if (afline[0] != '<') { + if (verbose > 4) + printf("Skip1: %s\n", afline); + continue; + } + p1 = index(afline, '\t'); + if (p1++ == NULL) { + if (verbose > 4) + printf("Skip2: %s\n", afline); + continue; + } + p1 = index(p1, '\t'); + if (p1++ == NULL) { + if (verbose > 4) + printf("Skip3: %s\n", afline); + continue; + } + if (*p1 == '\n') { + if (verbose > 4) + printf("Retain: %s", afline); + fputs(afline, nhfd); + if (ferror(nhfd)) + xerror("History write failed"); + } else { + if (verbose > 4) + printf("Skip4: %s\n", afline); + } + } (void) pclose(nhfd); *************** *** 764,765 (void) pclose(nhfd); free ((char *)multhist); --- 822,824 ----- (void) pclose(nhfd); + (void) fclose(ohfd); free ((char *)multhist); *************** *** 788,826 - #if defined(BSD4_2) || defined(LOCKF) - static int LockFd = -1; - #endif - - dolock() - { - /* set up exclusive locking so inews does not run while expire does */ - #if defined(BSD4_2) || defined(LOCKF) - LockFd = open(ACTIVE, 2); - # ifdef LOCKF - if (lockf(LockFd, F_LOCK, 0L) < 0) - # else /* BSD4_2 */ - if (flock(LockFd, LOCK_EX) < 0) - # endif /* BSD4_2 */ - xerror("Can't get lock for expire: %s", errmsg(errno)); - #else /* !BSD4_2 && !LOCKF */ - int i = 0; - sprintf(afline,"%s.lock", ACTIVE); - while (LINK(ACTIVE, afline) < 0 && errno == EEXIST) { - if (i++ > 5) { - xerror("Can't get lock for expire"); - } - sleep(i*2); - } - #endif /* !BSD4_2 && !LOCKF */ - } - - rmlock() - { - #if defined(BSD4_2) || defined(LOCKF) - close(LockFd); - #else - sprintf(bfr, "%s.lock", ACTIVE); - (void) UNLINK(bfr); - #endif /* !BSD4_2 */ - } - updateactive() --- 847,848 ----- updateactive() *************** *** 827,829 { ! register char *p1; FILE *ohfd, *nhfd; --- 849,851 ----- { ! register char *p1, *p2; FILE *ohfd, *nhfd; *************** *** 830,832 DIR *ngdirp = NULL; ! static struct direct *ngdir; --- 852,854 ----- DIR *ngdirp = NULL; ! static DIRECTORY_STRUCT *ngdir; *************** *** 839,843 long maxart, minart; ! char cansub; ! int gdsize, hassubs; ! struct stat stbuf; --- 861,864 ----- long maxart, minart; ! int lineno = 0; ! char c, cansub, groupname[BUFLEN]; *************** *** 843,845 ! if (fgets(afline, BUFLEN, ohfd) == NULL) continue; --- 864,866 ----- ! if (fgets(afline, MBUFLEN, ohfd) == NULL) continue; *************** *** 845,849 continue; ! if (sscanf(afline,"%s %ld %ld %c",nbuf,&maxart, &minart, ! &cansub) < 4) ! xerror("Active file corrupt"); if (verbose > 3) --- 866,873 ----- continue; ! lineno++; ! if (sscanf(afline,"%s %ld %ld %c", groupname, &maxart, &minart, ! &cansub) < 4) { ! xerror("Line %d in active file invalid: %s", ! lineno, afline); ! } if (verbose > 3) *************** *** 850,853 printf("looking at group %s\n", nbuf); ! if (!ngmatch(nbuf, ngpat)) { ! if (fputs(afline, nhfd) == EOF) xerror("active file write failed"); --- 874,878 ----- printf("looking at group %s\n", nbuf); ! if (!ngmatch(groupname, ngpat)) { ! fputs(afline, nhfd); ! if (ferror(nhfd)) xerror("active file write failed"); *************** *** 857,861 /* Change a group name from a.b.c to a/b/c */ ! for (p1=nbuf; *p1; p1++) ! if (*p1 == '.') ! *p1 = '/'; --- 882,892 ----- /* Change a group name from a.b.c to a/b/c */ ! p1 = groupname; ! p2 = nbuf; ! while (c = *p1++) { ! if (c == '.') ! *p2++ = '/'; ! else ! *p2++ = c; ! } ! *p2 = '\0'; *************** *** 861,864 - hassubs = stat(nbuf, &stbuf) != 0 || stbuf.st_nlink != 2; - gdsize = strlen(nbuf); if ((ngdirp = opendir(nbuf)) != NULL) { --- 892,893 ----- if ((ngdirp = opendir(nbuf)) != NULL) { *************** *** 865,877 while (ngdir = readdir(ngdirp)) { ! nbuf[gdsize] = '/'; ! (void) strcpy(&nbuf[gdsize+1], ngdir->d_name); ! /* We have to do a stat because of micro.6809 */ ! if (hassubs && (stat(nbuf, &stbuf) < 0 || ! !(stbuf.st_mode&S_IFREG)) ) ! continue; ! n = atol(ngdir->d_name); ! if (n > 0 && n < minart) ! minart = n; ! if (n > 0 && n > maxart) ! maxart = n; } --- 894,912 ----- while (ngdir = readdir(ngdirp)) { ! register char *cp = ngdir->d_name, ch; ! n = 0; ! /* check to see if directory */ ! /* articles are all digits */ ! do { ! ch = *cp++; ! if (isdigit(ch)) ! n = n * 10 + ch - '0'; ! else ! n = -1; ! } while (n >= 0 && *cp); ! if (n > 0) { ! if (n < minart) ! minart = n; ! if (n > maxart) ! maxart = n; ! } } *************** *** 879,881 } - afline[gdsize] = '\0'; if (minart > maxart) --- 914,915 ----- } if (minart > maxart) *************** *** 882,883 minart = maxart; #ifdef USG --- 916,918 ----- minart = maxart; + #ifdef USG *************** *** 886,889 maxart, minart); ! if (fprintf(nhfd,"%s %5.5ld %5.5ld %c\n", afline, maxart, ! minart, cansub) == EOF) xerror("Active file write failed"); --- 921,925 ----- maxart, minart); ! fprintf(nhfd,"%s %5.5ld %5.5ld %c\n", groupname, maxart, ! minart, cansub); ! if(ferror(nhfd)) xerror("Active file write failed"); *************** *** 893,896 maxart, minart); ! if (fprintf(nhfd,"%s %05ld %05ld %c\n", afline, maxart, ! minart, cansub) == EOF) xerror("Active file write failed"); --- 929,933 ----- maxart, minart); ! fprintf(nhfd,"%s %05ld %05ld %c\n", groupname, maxart, ! minart, cansub); ! if (ferror(nhfd)) xerror("Active file write failed"); Index: fullname.c Prereq: 1.13 *** old/fullname.c Wed Nov 4 14:57:01 1987 --- fullname.c Sun Jan 15 19:48:56 1989 *************** *** 11,12 * where the "junk -" is optional. * --- 11,13 ----- * where the "junk -" is optional. + * and the character before the '-' is a space, a digit, or a ']'. * *************** *** 16,18 #ifdef SCCSID ! static char *SccsId = "@(#)fullname.c 1.13 11/4/87"; #endif /* SCCSID */ --- 17,19 ----- #ifdef SCCSID ! static char *SccsId = "@(#)fullname.c 1.14 1/15/89"; #endif /* SCCSID */ *************** *** 127,129 { ! if (*p == '-' && (isdigit(p[-1]) || isspace(p[-1]))) { bp = buf; --- 128,130 ----- { ! if (*p == '-' && (isdigit(p[-1]) || isspace(p[-1]) || p[-1] == ']')) { bp = buf; *************** *** 143,144 } *bp = '\0'; --- 144,147 ----- } + while (bp > buf && *(bp - 1) == ' ') + --bp; *bp = '\0'; Index: funcs.c Prereq: 2.38 *** old/funcs.c Fri Dec 4 02:52:01 1987 --- funcs.c Sun Jan 15 19:48:57 1989 *************** *** 1,3 /* ! * This software is Copyright (c) 1986 by Rick Adams. * --- 1,3 ----- /* ! * This software is Copyright 1986, 1989 by Rick Adams. * *************** *** 18,20 #ifdef SCCSID ! static char *SccsId = "@(#)funcs.c 2.38 11/30/87"; #endif /* SCCSID */ --- 18,20 ----- #ifdef SCCSID ! static char *SccsId = "@(#)funcs.c 2.39 1/15/89"; #endif /* SCCSID */ *************** *** 29,30 extern char *Progname; --- 29,37 ----- + #ifdef SYSLOG + #include <sys/syslog.h> + #ifndef LOG_NEWS + LOG_NEWS is officially facility 7, please update your syslog.h + #endif + #endif + extern char *Progname; *************** *** 157,159 int status; ! int (*onhup)(), (*onint)(); --- 164,166 ----- int status; ! SIGNAL_TYPE onhup, onint; *************** *** 425,426 if (which) --- 432,445 ----- + #ifdef SYSLOG + if (which ) { + openlog(Progname, 0, LOG_NEWS); + syslog(LOG_ERR, "%s %s\t%s", rmtsys, + header.ident[0] ? header.ident : username, msg); + } else { + openlog(rmtsys, 0, LOG_NEWS); + syslog(LOG_INFO, "%s\t%s", + header.ident[0] ? header.ident : username, msg); + } + #else /* !SYSLOG */ + if (which) *************** *** 448,449 } } --- 467,470 ----- } + #endif /* !SYSLOG */ + } *************** *** 522,524 ! #ifdef MKDIRSUB /* --- 543,545 ----- ! #ifndef MKDIRSUB /* Index: funcs2.c Prereq: 1.24 *** old/funcs2.c Fri Dec 4 02:52:03 1987 --- funcs2.c Sun Jan 15 19:48:57 1989 *************** *** 1,3 /* ! * This software is Copyright (c) 1985 by Rick Adams. * --- 1,3 ----- /* ! * This software is Copyright 1985, 1989 by Rick Adams. * *************** *** 19,21 #ifdef SCCSID ! static char *SccsId = "@(#)funcs2.c 1.24 11/30/87"; #endif /* SCCSID */ --- 19,21 ----- #ifdef SCCSID ! static char *SccsId = "@(#)funcs2.c 1.25 1/15/89"; #endif /* SCCSID */ *************** *** 24,25 #ifdef SunIII --- 24,27 ----- + extern char filename[]; + #ifdef SunIII *************** *** 125,127 ! p = fldget(sp->s_name, p); if (*p++ == '\0') --- 127,129 ----- ! p = fldget(sp->s_name, sizeof(sp->s_name), p); if (*p++ == '\0') *************** *** 138,140 } ! p = fldget(sp->s_nbuf, p); lcase(sp->s_nbuf); --- 140,142 ----- } ! p = fldget(sp->s_nbuf, sizeof(sp->s_nbuf), p); lcase(sp->s_nbuf); *************** *** 143,145 ! p = fldget(sp->s_flags, p); if (*p++ == '\0') --- 145,147 ----- ! p = fldget(sp->s_flags, sizeof(sp->s_flags), p); if (*p++ == '\0') *************** *** 147,149 ! (void) fldget(sp->s_xmit, p); return TRUE; --- 149,151 ----- ! (void) fldget(sp->s_xmit, sizeof(sp->s_flags), p); return TRUE; *************** *** 152,154 char * ! fldget(q, p) register char *q, *p; --- 154,156 ----- char * ! fldget(q, len, p) register char *q, *p; *************** *** 154,155 register char *q, *p; { --- 156,158 ----- register char *q, *p; + register int len; { *************** *** 158,159 p++; *q++ = *p++; --- 161,168 ----- p++; + if (--len <= 0) { + logerr("field too long in SYSFILE: %s", p); + while (*p && *p++ != ':') + /* loop */; + break; + } *q++ = *p++; *************** *** 204,206 if (lasttime < 0) { ! logerr("Unparsable date \"%s\"", datestr); if (sscanf(datestr, "%s %s %s %s %s", junk, month, day, tod, --- 213,215 ----- if (lasttime < 0) { ! logerr("%s: Unparsable date \"%s\"", filename, datestr); if (sscanf(datestr, "%s %s %s %s %s", junk, month, day, tod, *************** *** 469,471 *p++ = '\0'; ! (void) sprintf(oidbuf, "<%s@%s.UUCP>", p, artid); if (p) --- 478,480 ----- *p++ = '\0'; ! (void) sprintf(oidbuf, "<%s@%s.uucp>", p, artid); if (p) *************** *** 478,480 (void) get_server(workspace,sizeof(workspace)); ! if (*workspace != CHAR_OK) return NULL; --- 487,489 ----- (void) get_server(workspace,sizeof(workspace)); ! if (*workspace != '2') return NULL; *************** *** 483,485 (void) get_server(workspace,sizeof(workspace)); /* get response */ ! if (*workspace != CHAR_OK) return NULL; /* old style nntp */ --- 492,494 ----- (void) get_server(workspace,sizeof(workspace)); /* get response */ ! if (*workspace != '2') return NULL; /* old style nntp */ *************** *** 497,499 (void) get_server(workspace,sizeof(workspace)); ! if (*workspace != CHAR_OK) return NULL; --- 506,508 ----- (void) get_server(workspace,sizeof(workspace)); ! if (*workspace != '2') return NULL; *************** *** 519,521 (void) get_server(workspace,sizeof(workspace)); ! if (*workspace != CHAR_OK) return NULL; --- 528,530 ----- (void) get_server(workspace,sizeof(workspace)); ! if (*workspace != '2') return NULL; *************** *** 664,666 called = 1; ! (void) dbminit(name); } --- 673,676 ----- called = 1; ! if (dbminit(name)) ! logerr("dbminit failed: %s", name); } *************** *** 721,724 FILE * ! xart_open (filename,mode) ! char *filename,*mode; { --- 731,734 ----- FILE * ! xart_open (fname,mode) ! char *fname,*mode; { *************** *** 724,726 { ! FILE *fp = art_open (filename, mode); extern int errno; --- 734,736 ----- { ! FILE *fp = art_open (fname, mode); extern int errno; *************** *** 728,730 xerror("Cannot open article %s (%s): %s\n", ! filename, mode, errmsg(errno)); return fp; --- 738,740 ----- xerror("Cannot open article %s (%s): %s\n", ! fname, mode, errmsg(errno)); return fp; *************** *** 733,736 FILE * ! art_open (filename,mode) ! char *filename,*mode; { --- 743,746 ----- FILE * ! art_open (fname,mode) ! char *fname,*mode; { *************** *** 739,741 ! if ((fp = fopen (filename, mode)) == NULL) return NULL; --- 749,751 ----- ! if ((fp = fopen (fname, mode)) == NULL) return NULL; *************** *** 749,751 /* Clean up dangling link, if we have the power. Ignore error if we don't. */ ! (void) unlink (filename); return fp; --- 759,761 ----- /* Clean up dangling link, if we have the power. Ignore error if we don't. */ ! (void) unlink (fname); return fp; *************** *** 778,779 *q = '\0'; --- 788,794 ----- *q = '\0'; + #ifdef SunIII + q = index(senderbuf, '@'); + if (q) + *q = '\0'; + #endif *************** *** 781 } --- 796,797 ----- } + Index: getdate.y Prereq: 2.17 *** old/getdate.y Fri Dec 4 02:52:05 1987 --- getdate.y Tue Jan 17 13:09:29 1989 *************** *** 1,2 ! %token ID MONTH DAY MERIDIAN NUMBER UNIT MUNIT SUNIT ZONE DAYZONE AGO %{ --- 1,2 ----- ! %token ID MONTH DAY MERIDIAN SNUMBER UNUMBER UNIT MUNIT SUNIT ZONE DAYZONE AGO %{ *************** *** 5,7 /* University of North Carolina at Chapel Hill */ ! /* @(#)getdate.y 2.17 11/30/87 */ --- 5,7 ----- /* University of North Carolina at Chapel Hill */ ! /* @(#)getdate.y 2.19 1/17/89 */ *************** *** 22,24 ! #if defined(BSD4_2) || defined (BSD4_1C) #include <sys/time.h> --- 22,24 ----- ! #if defined(BSD4_2) #include <sys/time.h> *************** *** 59,61 ! nspec: NUMBER = {if (timeflag && dateflag && !relflag) year = $1; --- 59,61 ----- ! nspec: UNUMBER = {if (timeflag && dateflag && !relflag) year = $1; *************** *** 63,65 ! tspec: NUMBER MERIDIAN = {hh = $1; mm = 0; ss = 0; merid = $2;} --- 63,65 ----- ! tspec: UNUMBER MERIDIAN = {hh = $1; mm = 0; ss = 0; merid = $2;} *************** *** 65,67 {hh = $1; mm = 0; ss = 0; merid = $2;} ! | NUMBER ':' NUMBER = {hh = $1; mm = $3; merid = 24;} --- 65,67 ----- {hh = $1; mm = 0; ss = 0; merid = $2;} ! | UNUMBER ':' UNUMBER = {hh = $1; mm = $3; merid = 24;} *************** *** 67,69 {hh = $1; mm = $3; merid = 24;} ! | NUMBER ':' NUMBER MERIDIAN = {hh = $1; mm = $3; merid = $4;} --- 67,69 ----- {hh = $1; mm = $3; merid = 24;} ! | UNUMBER ':' UNUMBER MERIDIAN = {hh = $1; mm = $3; merid = $4;} *************** *** 69,71 {hh = $1; mm = $3; merid = $4;} ! | NUMBER ':' NUMBER NUMBER = {hh = $1; mm = $3; merid = 24; --- 69,71 ----- {hh = $1; mm = $3; merid = $4;} ! | UNUMBER ':' UNUMBER SNUMBER = {hh = $1; mm = $3; merid = 24; *************** *** 72,74 daylight = STANDARD; ourzone = -($4%100 + 60*($4/100));} ! | NUMBER ':' NUMBER ':' NUMBER = {hh = $1; mm = $3; ss = $5; merid = 24;} --- 72,74 ----- daylight = STANDARD; ourzone = -($4%100 + 60*($4/100));} ! | UNUMBER ':' UNUMBER ':' UNUMBER = {hh = $1; mm = $3; ss = $5; merid = 24;} *************** *** 74,76 {hh = $1; mm = $3; ss = $5; merid = 24;} ! | NUMBER ':' NUMBER ':' NUMBER MERIDIAN = {hh = $1; mm = $3; ss = $5; merid = $6;} --- 74,76 ----- {hh = $1; mm = $3; ss = $5; merid = 24;} ! | UNUMBER ':' UNUMBER ':' UNUMBER MERIDIAN = {hh = $1; mm = $3; ss = $5; merid = $6;} *************** *** 76,78 {hh = $1; mm = $3; ss = $5; merid = $6;} ! | NUMBER ':' NUMBER ':' NUMBER NUMBER = {hh = $1; mm = $3; ss = $5; merid = 24; --- 76,78 ----- {hh = $1; mm = $3; ss = $5; merid = $6;} ! | UNUMBER ':' UNUMBER ':' UNUMBER SNUMBER = {hh = $1; mm = $3; ss = $5; merid = 24; *************** *** 89,91 {dayord = 1; dayreq = $1;} ! | NUMBER DAY = {dayord = $1; dayreq = $2;}; --- 89,91 ----- {dayord = 1; dayreq = $1;} ! | UNUMBER DAY = {dayord = $1; dayreq = $2;}; *************** *** 92,94 ! dtspec: NUMBER '/' NUMBER = {month = $1; day = $3;} --- 92,94 ----- ! dtspec: UNUMBER '/' UNUMBER = {month = $1; day = $3;} *************** *** 94,96 {month = $1; day = $3;} ! | NUMBER '/' NUMBER '/' NUMBER = {month = $1; day = $3; year = $5;} --- 94,96 ----- {month = $1; day = $3;} ! | UNUMBER '/' UNUMBER '/' UNUMBER = {month = $1; day = $3; year = $5;} *************** *** 96,98 {month = $1; day = $3; year = $5;} ! | MONTH NUMBER = {month = $1; day = $2;} --- 96,98 ----- {month = $1; day = $3; year = $5;} ! | MONTH UNUMBER = {month = $1; day = $2;} *************** *** 98,100 {month = $1; day = $2;} ! | MONTH NUMBER ',' NUMBER = {month = $1; day = $2; year = $4;} --- 98,100 ----- {month = $1; day = $2;} ! | MONTH UNUMBER ',' UNUMBER = {month = $1; day = $2; year = $4;} *************** *** 100,102 {month = $1; day = $2; year = $4;} ! | NUMBER MONTH = {month = $2; day = $1;} --- 100,102 ----- {month = $1; day = $2; year = $4;} ! | UNUMBER MONTH = {month = $2; day = $1;} *************** *** 102,104 {month = $2; day = $1;} ! | NUMBER MONTH NUMBER = {month = $2; day = $1; year = $3;}; --- 102,104 ----- {month = $2; day = $1;} ! | UNUMBER MONTH UNUMBER = {month = $2; day = $1; year = $3;}; *************** *** 106,108 ! rspec: NUMBER UNIT = {relsec += 60L * $1 * $2;} --- 106,108 ----- ! rspec: SNUMBER UNIT = {relsec += 60L * $1 * $2;} *************** *** 108,110 {relsec += 60L * $1 * $2;} ! | NUMBER MUNIT = {relmonth += $1 * $2;} --- 108,110 ----- {relsec += 60L * $1 * $2;} ! | SNUMBER MUNIT = {relmonth += $1 * $2;} *************** *** 110,112 {relmonth += $1 * $2;} ! | NUMBER SUNIT = {relsec += $1;} --- 110,112 ----- {relmonth += $1 * $2;} ! | SNUMBER SUNIT = {relsec += $1;} *************** *** 217,219 extern int yylval; ! int sign; register char c; --- 217,219 ----- extern int yylval; ! int sign = 0; register char c; *************** *** 232,234 if (!isdigit(*++lptr)) { ! /* yylval = sign; return (NUMBER); */ return yylex(); /* skip the '-' sign */ --- 232,234 ----- if (!isdigit(*++lptr)) { ! /* yylval = sign; return (UNUMBER); */ return yylex(); /* skip the '-' sign */ *************** *** 235,237 } ! } else sign = 1; yylval = 0; --- 235,237 ----- } ! } yylval = 0; *************** *** 239,241 yylval = 10*yylval + c - '0'; - yylval *= sign; lptr--; --- 239,240 ----- yylval = 10*yylval + c - '0'; lptr--; *************** *** 241,243 lptr--; ! return (NUMBER); --- 240,247 ----- lptr--; ! if (sign < 0) ! yylval = -yylval; ! if (sign != 0) ! return SNUMBER; ! else ! return UNUMBER; *************** *** 388,390 {"now", UNIT, 0}, ! {"last", NUMBER, -1}, {"this", UNIT, 0}, --- 392,394 ----- {"now", UNIT, 0}, ! {"last", UNUMBER, -1}, {"this", UNIT, 0}, *************** *** 390,404 {"this", UNIT, 0}, ! {"next", NUMBER, 2}, ! {"first", NUMBER, 1}, ! /* {"second", NUMBER, 2}, */ ! {"third", NUMBER, 3}, ! {"fourth", NUMBER, 4}, ! {"fifth", NUMBER, 5}, ! {"sixth", NUMBER, 6}, ! {"seventh", NUMBER, 7}, ! {"eigth", NUMBER, 8}, ! {"ninth", NUMBER, 9}, ! {"tenth", NUMBER, 10}, ! {"eleventh", NUMBER, 11}, ! {"twelfth", NUMBER, 12}, {"ago", AGO, 1}, --- 394,408 ----- {"this", UNIT, 0}, ! {"next", UNUMBER, 2}, ! {"first", UNUMBER, 1}, ! /* {"second", UNUMBER, 2}, */ ! {"third", UNUMBER, 3}, ! {"fourth", UNUMBER, 4}, ! {"fifth", UNUMBER, 5}, ! {"sixth", UNUMBER, 6}, ! {"seventh", UNUMBER, 7}, ! {"eighth", UNUMBER, 8}, ! {"ninth", UNUMBER, 9}, ! {"tenth", UNUMBER, 10}, ! {"eleventh", UNUMBER, 11}, ! {"twelfth", UNUMBER, 12}, {"ago", AGO, 1}, Index: header.c Prereq: 2.49 *** old/header.c Thu Oct 8 00:20:52 1987 --- header.c Sun Jan 15 19:48:58 1989 *************** *** 1,3 /* ! * This software is Copyright (c) 1986 by Rick Adams. * --- 1,3 ----- /* ! * This software is Copyright 1986, 1989 by Rick Adams. * *************** *** 19,21 #ifdef SCCSID ! static char *SccsId = "@(#)header.c 2.49 10/7/87"; #endif /* SCCSID */ --- 19,21 ----- #ifdef SCCSID ! static char *SccsId = "@(#)header.c 2.50 1/15/89"; #endif /* SCCSID */ *************** *** 85,87 /* Newsgroup List */ ! if (hfgets(hp->nbuf, BUFLEN, fp) == NULL || !nstrip(hp->nbuf)) return NULL; --- 85,87 ----- /* Newsgroup List */ ! if (hfgets(hp->nbuf, MBUFLEN, fp) == NULL || !nstrip(hp->nbuf)) return NULL; *************** *** 200,203 #endif /* OLD */ ! case MESSAGEID: ! getfield(hp->ident, sizeof(hp->ident)); break; --- 200,210 ----- #endif /* OLD */ ! case MESSAGEID: { ! register char *cp; ! getfield(hp->ident, sizeof(hp->ident)); ! cp = hp->ident; ! do { ! if (*cp && !isprint(*cp)) ! *cp = '?'; ! } while (*cp++); ! } break; *************** *** 220,223 getfield(hp->distribution, sizeof(hp->distribution)); ! if (strcmp(hp->distribution, "net") == 0 ! || strcmp(hp->distribution, "world") == 0) hp->distribution[0] = '\0'; --- 227,230 ----- getfield(hp->distribution, sizeof(hp->distribution)); ! if (STRCMP(hp->distribution, "net") == 0 ! || STRCMP(hp->distribution, "world") == 0) hp->distribution[0] = '\0'; *************** *** 223,224 hp->distribution[0] = '\0'; break; --- 230,238 ----- hp->distribution[0] = '\0'; + else if (STRCMP(hp->distribution, "local") == 0 && + hp->path[0] != '\0' && + strncmp(hp->path, LOCALPATHSYSNAME, + strlen(LOCALPATHSYSNAME)) != 0) { + hp->distribution[0] = '\0'; + xerror("Bogus local distribution rejected"); + } break; *************** *** 445,446 lastsp = 1; break; --- 459,464 ----- lastsp = 1; + break; + + case '\n': + lastsp = 1; break; Index: header.h Prereq: 2.21 *** old/header.h Thu Oct 8 00:20:56 1987 --- header.h Sun Jan 15 19:48:58 1989 *************** *** 4,6 ! /* @(#)header.h 2.21 10/7/87 */ --- 4,6 ----- ! /* @(#)header.h 2.22 1/15/89 */ *************** *** 12,14 char path[PATHLEN]; /* Path: */ ! char nbuf[LBUFLEN]; /* Newsgroups: */ char title[BUFLEN]; /* Subject: */ --- 12,14 ----- char path[PATHLEN]; /* Path: */ ! char nbuf[MBUFLEN]; /* Newsgroups: */ char title[BUFLEN]; /* Subject: */ *************** *** 16,18 char replyto[BUFLEN]; /* Reply-To: */ ! char followid[BUFLEN]; /* References: */ char subdate[DATELEN]; /* Date: (submission) */ --- 16,18 ----- char replyto[BUFLEN]; /* Reply-To: */ ! char followid[MBUFLEN]; /* References: */ char subdate[DATELEN]; /* Date: (submission) */ *************** *** 34,36 #ifdef DOXREFS ! char xref[BUFLEN]; /* Xref: */ #endif /* DOXREFS */ --- 34,36 ----- #ifdef DOXREFS ! char xref[MBUFLEN]; /* Xref: */ #endif /* DOXREFS */ Index: ifuncs.c Prereq: 2.69 *** old/ifuncs.c Fri Dec 4 02:52:09 1987 --- ifuncs.c Wed Jan 18 14:28:50 1989 *************** *** 1,3 /* ! * This software is Copyright (c) 1986 by Rick Adams. * --- 1,3 ----- /* ! * This software is Copyright 1986, 1989 by Rick Adams. * *************** *** 18,20 #ifdef SCCSID ! static char *SccsId = "@(#)ifuncs.c 2.69 12/1/87"; #endif /* SCCSID */ --- 18,20 ----- #ifdef SCCSID ! static char *SccsId = "@(#)ifuncs.c 2.72 1/18/89"; #endif /* SCCSID */ *************** *** 231,233 if (nsent) ! log(sentbuf); s_close(); --- 231,233 ----- if (nsent) ! log("%s", sentbuf); s_close(); *************** *** 251,253 register int c; ! register char *ptr; char TRANS[BUFLEN]; --- 251,253 ----- register int c; ! register char *ptr, *size_ptr; char TRANS[BUFLEN]; *************** *** 284,285 if (notify) --- 284,297 ----- + /* allow specification based on size */ + if ((size_ptr = strpbrk(sp->s_flags, "<>")) != NULL) { + struct stat stbuf; + if (fstat(fileno(ifp), &stbuf) == 0 && ( + (*size_ptr == '>' && stbuf.st_size < atol(&size_ptr[1])) + || (*size_ptr == '<' && stbuf.st_size > atol(&size_ptr[1])) + )) { + fclose(ifp); + return FALSE; + } + } + if (notify) *************** *** 337,339 } ! (void) sprintf(TRANS, "%s/trXXXXXX", SPOOL); } --- 349,351 ----- } ! (void) sprintf(TRANS, "%s/.tmp/trXXXXXX", SPOOL); } *************** *** 359,363 } ! if (sp->s_xmit[0] == '\0') ! sprintf(sp->s_xmit, "%s/%s%s", BATCHDIR, sp->s_name, ! appmsgid ? ".ihave" : ""); #ifdef LOGDIR --- 371,385 ----- } ! ! /* if filename is an absolute pathname, use it ! * if no filename given, tack system name onto BATCHDIR ! * otherwise, tack filename onto BATCHDIR ! * ! * also, tack ".ihave" onto ihave format files ! * in BATCHDIR (should this be done for all files?) ! */ ! if (sp->s_xmit[0] != '/') { ! if (sp->s_xmit[0] == '\0') ! (void) strcpy(TRANS, sp->s_name); ! else ! (void) strcpy(TRANS, sp->s_xmit); #ifdef LOGDIR *************** *** 363,366 #ifdef LOGDIR ! (void) sprintf(TRANS, "%s/%s/%s", logdir(HOME), BATCHDIR, sp->s_xmit); ! ofp = fopen(TRANS, "a"); #else /* !LOGDIR */ --- 385,387 ----- #ifdef LOGDIR ! sprintf(sp->s_xmit, "%s/%s/%s%s", logdir(HOME), #else /* !LOGDIR */ *************** *** 366,368 #else /* !LOGDIR */ ! ofp = fopen(sp->s_xmit, "a"); #endif /* !LOGDIR */ --- 387,389 ----- #else /* !LOGDIR */ ! sprintf(sp->s_xmit, "%s/%s%s", #endif /* !LOGDIR */ *************** *** 368,369 #endif /* !LOGDIR */ if (ofp == NULL) --- 389,393 ----- #endif /* !LOGDIR */ + BATCHDIR, TRANS, appmsgid ? ".ihave" : ""); + } + ofp = fopen(sp->s_xmit, "a"); if (ofp == NULL) *************** *** 370,372 xerror("Cannot append to %s", sp->s_xmit); ! fprintf(ofp, "%s", appmsgid ? hh.ident : firstbufname); #ifdef MULTICAST --- 394,397 ----- xerror("Cannot append to %s", sp->s_xmit); ! fprintf(ofp, "%s", appmsgid ? hh.ident : ! firstbufname); #ifdef MULTICAST *************** *** 716,718 extern int errno; - #ifdef VMS int fd; --- 741,742 ----- extern int errno; int fd; *************** *** 718,722 int fd; ! /* The name here is because of the peculiar properties of version numbers ! * in Eunice. We eliminate any troublesome characters also. ! */ (void) sprintf(lockname, "/tmp/%.10s.l.1", str); --- 742,748 ----- int fd; ! #ifdef VMS ! /* ! * The name here is because of the peculiar properties of version ! * numbers in Eunice. We eliminate any troublesome characters also. ! */ (void) sprintf(lockname, "/tmp/%.10s.l.1", str); *************** *** 741,744 #endif ! i = creat(tempname, 0666); ! if (i < 0) xerror("Cannot creat %s: errno %d", tempname, errno); --- 767,773 ----- #endif ! #ifndef O_EXCL ! (void) strcpy(tempname, "/tmp/LTMP.XXXXXX"); ! MKTEMP(tempname); ! fd = creat(tempname, 0666); ! if (fd < 0) xerror("Cannot creat %s: errno %d", tempname, errno); *************** *** 744,746 xerror("Cannot creat %s: errno %d", tempname, errno); - (void) close(i); while (link(tempname, lockname)) { --- 773,774 ----- xerror("Cannot creat %s: errno %d", tempname, errno); while (link(tempname, lockname)) { *************** *** 746,747 while (link(tempname, lockname)) { #endif /* !VMS */ --- 774,778 ----- while (link(tempname, lockname)) { + #else /* O_EXCL */ + while ((fd=(open(lockname, O_EXCL|O_CREAT, 0) < 0) { + #endif /* O_EXCL */ #endif /* !VMS */ *************** *** 759,761 } - #ifdef VMS (void) close(fd); --- 790,791 ----- } (void) close(fd); *************** *** 761,763 (void) close(fd); ! #endif (void) unlink(tempname); --- 791,793 ----- (void) close(fd); ! #ifndef O_EXCL (void) unlink(tempname); *************** *** 763,764 (void) unlink(tempname); } --- 793,795 ----- (void) unlink(tempname); + #endif } *************** *** 1311,1316 if ((fd = creat(tfilename, 0666)) < 0) { ! fprintf(stderr, "rnews: creat of \"%s\" failed", ! tfilename); ! perror(" "); ! exit(1); } --- 1342,1345 ----- if ((fd = creat(tfilename, 0666)) < 0) { ! xerror("rnews: creat of \"%s\" failed: %s", ! tfilename,errmsg(errno)); } *************** *** 1319,1324 if (wc != rc) { ! fprintf(stderr, "write of %d to \"%s\" returned %d", ! rc, tfilename, wc); ! perror(" "); ! exit(1); } --- 1348,1351 ----- if (wc != rc) { ! xerror("write of %d to \"%s\" returned %d: %s", ! rc, tfilename, wc, errmsg(errno)); } *************** *** 1373,1374 freopen(tfilename, "r", infp); return; /* from checkbatch as if --- 1400,1402 ----- freopen(tfilename, "r", infp); + (void) free(cp); return; /* from checkbatch as if *************** *** 1381,1386 if (wc != rc) { ! fprintf(stderr, "write of %d to pipe returned %d", ! rc, wc); ! perror("rnews: write"); ! exit(1); } --- 1409,1412 ----- if (wc != rc) { ! xerror("write of %d to pipe returned %d: %s", ! rc, wc, errmsg(errno)); } *************** *** 1420,1423 if (pipe(piped) != 0) { ! perror("checkbatch: pipe() failed"); ! exit(1); } --- 1446,1448 ----- if (pipe(piped) != 0) { ! xerror("checkbatch: pipe() failed: %s",errmsg(errno)); } *************** *** 1425,1427 while ((pid = vfork()) == -1) { ! perror("checkbatch: fork failed, waiting"); sleep(60); --- 1450,1452 ----- while ((pid = vfork()) == -1) { ! logerr("checkbatch: fork failed, waiting: %s",errmsg(errno)); sleep(60); *************** *** 1439,1442 execl(cmd, arg0, arg1, arg2, (char *) 0); ! perror("checkbatch"); ! xerror("Unable to exec %s to unpack news.", cmd); } else { /* parent process */ --- 1464,1466 ----- execl(cmd, arg0, arg1, arg2, (char *) 0); ! xerror("Unable to exec \"%s\" to unpack news: %s", cmd, errmsg(errno)); } else { /* parent process */ *************** *** 1472,1473 p++; --- 1496,1504 ----- p++; + if (strncmp(p, "inews", 5) != 0) { + #ifdef ALLOW_LIB_EXECS + log("Processing incoming batch with command \"%s\"", p); + #else /* !ALLOW_LIB_EXECS */ + xerror("Attempt to execute news batch with command \"%s\"", p); + #endif /* !ALLOW_LIB_EXECS */ + } *************** *** 1509,1511 (void) execvp(path, args); ! perror(path); xxit(2); --- 1540,1542 ----- (void) execvp(path, args); ! logerr("Unable to exec \"%s\" to unpack news: %s", path, errmsg(errno)); xxit(2); Index: patchlevel.h Prereq: 14 *** .d/patchlevel.h Fri Dec 4 02:52:37 1987 --- patchlevel.h Sun Jan 15 19:49:02 1989 *************** *** 1,2 ! #define PATCHLEVEL 14 --- 1,2 ----- ! #define PATCHLEVEL 15 *************** *** 2,3 ! #define NEWS_VERSION "B 2.11 12/1/87" --- 2,3 ----- ! #define NEWS_VERSION "B 2.11 1/14/89" --- end of patch 15 ---