nntp@tmc.edu (Stan Barber) (02/11/91)
#! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # CHANGES.diff # README.1.5.11 # xmit # xfer # inews # This archive created: Sun Feb 10 14:37:30 1991 export PATH; PATH=/bin:$PATH echo shar: extracting "'CHANGES.diff'" '(2485 characters)' if test -f 'CHANGES.diff' then echo shar: will not over-write existing file "'CHANGES.diff'" else sed 's/^ X//' << \SHAR_EOF > 'CHANGES.diff' X*** CHANGES Sat Sep 1 22:03:56 1990 X--- ../nntp/CHANGES Fri Feb 8 18:22:39 1991 X*************** X*** 2,7 X since the initial release. Individuals who either reported the bug or X inspired the bug fix are in square brackets. X X 1.5.10 X Fixes to spawn.c to allow it to work correctly with CNEWS. X [All CNEWS sites....Sorry, guys and gals!] X X--- 2,41 ----- X since the initial release. Individuals who either reported the bug or X inspired the bug fix are in square brackets. X X+ 1.5.11 X+ Fixes to spawn.c and batch.c for those system that need X+ execle() to specifically call /bin/sh to exectute a sh script. X+ [All CNEWS sites running System V.] X+ Fixes to the timeout code to make it all work the GNUS. X+ [leres@ee.lbl.gov] X+ Fixes to nntpxmit to support CNEWS batch file formats which X+ contain the name of the article file and its message id. X+ [flee@guardian.cs.psu.edu] X+ Fixes to nntpxmit to not mistake the delete character in an X+ article as an EOF indication. [pst+@ir.stanford.edu] X+ Added the $HOME environmental variable in the new environment X+ provided to a child process. [steve@avalon.dartmouth.edu] X+ Added rudimentary support to clientlib for TLI. [sob@tmc.edu] X+ Changes to inews to optionally use gethostbyname() to get canonical X+ hostname as needed. [jef@ee.lbl.gov] X+ Changed extern int timezone to extern long timezone in time.c. X+ [pk@unidoct.chemietechnik.uni-dortmund.de] X+ Reset SIGCLD before calling serve for WIN/TCP users on System V. X+ [wescott%micky%sauron%ncrcae@ncrlnk.dayton.ncr.com] X+ Changed references to "server" in clientlib.c to "nntpserver" to X+ avoid a conflict with WIN/TCP. [rdc30med@nmrdc1.nmrdc.nnmc.navy.mil] X+ Defining DBZ will take care of defining DBM. [tgt@cblpf.att.com] X+ Some minor changes to nntpxfer to remove the risk of doing an update X+ when it's not necessary. [ccc141j@monu6.cc.monash.edu.au, X+ corbin@utep-vaxa.uucp] X+ Changes to nntpxmit to correctly utilize LOG_DEBUG when LOG is X+ defined and not when it isn't. [alden@shape.mps.ohio-state.edu] X+ Change order of setuid/setgid in spawn.c and batch.c to execute X+ setgid first. [apple.com!arc!chet] X+ Provided an optional and untested way to use a dynamically X+ resizing article array in the server. This will allow large X+ numbers of articles in each group without giving nntp heartburn. X+ [leres@ee.lbl.gov] X 1.5.10 X Fixes to spawn.c to allow it to work correctly with CNEWS. X [All CNEWS sites....Sorry, guys and gals!] SHAR_EOF if test 2485 -ne "`wc -c < 'CHANGES.diff'`" then echo shar: error transmitting "'CHANGES.diff'" '(should have been 2485 characters)' fi fi # end of overwriting check echo shar: extracting "'README.1.5.11'" '(3359 characters)' if test -f 'README.1.5.11' then echo shar: will not over-write existing file "'README.1.5.11'" else sed 's/^ X//' << \SHAR_EOF > 'README.1.5.11' XWelcome to patch number 11 for NNTP 1.5. X X If you have not installed the first ten patches, you must do so X before proceeding. You can get those patches (and this one) from X anoymous ftp on bcm.tmc.edu [128.249.2.1] or by sending a message X to the archive-server@bcm.tmc.edu with the following text: X send public nntp.patch.1 X send public nntp.patch.2 X send public nntp.patch.3 X send public nntp.patch.4.shar X send public nntp.patch.5.shar X send public nntp.patch.6.shar X send public nntp.patch.7.shar X send public nntp.patch.8.pt1.shar X send public nntp.patch.8.pt2.shar X send public nntp.patch.9.pt1.shar X send public nntp.patch.9.pt2.shar X send public nntp.patch.9.pt3.shar X send public nntp.patch.10.pt1.shar X send public nntp.patch.10.pt2.shar X X If you have all ten patches installed, you are ready to install X this set of patches. These patches are packaged as four shell archives. X Be sure to unpack the shars in the root of your nntp distribution. X They are as follows: X CHANGES.diff -- This will patch the CHANGES file in the root X of the nntp distrbution to reflect changes since the release of 1.5. X To install, just type patch < CHANGES.diffs X server.pt1.diff -- This patch is the first of two diffs to be applied X to the files in the server subdirectory. X To install, change directory to the server directory and type X patch < server.pt1.diff. X server.pt2.diff -- This patch is the first of two diffs to be applied X to the files in the server subdirectory. X To install, change directory to the server directory and type X patch < server.pt2.diff. X common.diff -- This patch is for the files in the common subdirectory. X To install, change directory to the common directory and type X patch < common.diff X xfer.diff -- This is a patch for nntpxfer.c in the xfer directory. X To install, change directory to the xfer directory and type X patch < xfer.diff. X xmit.diff -- This is a patch for the files in the xmit directory. X To install, change directory to the xmit directory and type X patch < xmit.diff. X inews.diff -- This patch is for the files in the inews subdirectory. X To install, change directory to the inews directory and type X patch < inews.diff. X X SPECIAL NOTE: Two new files (timer.c and timer.h) will be created X in the server subdirectory. New versions of README and conf.h.dist X will be created in the common subdirectory. A new version of X access_file will be created in the support subdirectory. X XBug reports and enhancements welcome, XStan Barber Xnntp@tmc.edu X XP.S. This patched version of NNTP has been compiled on the following systems: X XVax 3600 running Ultrix 3.1 (BNEWS 2.11.19) XSolbourne Series 5/601 with OS/MP 4.0D (SunOS 4.0.3c compatible) (Same BNEWS) XHP 9000/825 running HP-UX A.B3.00.5B X XP.P.S. The fully patched version is available via anonymous ftp from Xlib.tmc.edu [129.106.5.1] and gazette.bcm.tmc.edu [128.249.2.2]. Look in Xthe public directory for nntp.1.5.11.tar. A compressed version is also on line. X XP.P.P.S. This is the really FINAL release of NNTP 1.5. The next release will Xbe 1.6. There will be no patch kit. NNTP 1.6 will be a full release and Xwill only be distributed in full source. X XP.P.P.P.S. Much thanks to all our beta testers: Xmolenda@s1.msi.umn.edu,tale@cs.rpi.edu,anselmo-ed@cs.yale.edu, Xleres@helios.ee.lbl.gov,vixie@decwrl.dec.com,scs@hela.iti.org, Xwisner@ims.alaska.edu,nash@parc.xerox.com SHAR_EOF if test 3359 -ne "`wc -c < 'README.1.5.11'`" then echo shar: error transmitting "'README.1.5.11'" '(should have been 3359 characters)' fi fi # end of overwriting check if test ! -d 'xmit' then echo shar: creating directory "'xmit'" mkdir 'xmit' fi echo shar: entering directory "'xmit'" cd 'xmit' echo shar: extracting "'xmit.diff'" '(35693 characters)' if test -f 'xmit.diff' then echo shar: will not over-write existing file "'xmit.diff'" else sed 's/^ X//' << \SHAR_EOF > 'xmit.diff' XIndex: Makefile X*** Makefile Sat Aug 18 17:14:40 1990 X--- ../../nntp/xmit/Makefile Sat Jan 12 01:05:39 1991 X*************** X*** 25,31 X ${CC} ${CFLAGS} -o nntpxmit ${SRVROBJ} ${LIBS} X X shlock: shlock.c X! cc ${CFLAGS} -o shlock shlock.c X X ${SRVROBJ}: ${SRVRINC} X X X--- 25,31 ----- X ${CC} ${CFLAGS} -o nntpxmit ${SRVROBJ} ${LIBS} X X shlock: shlock.c X! cc ${CFLAGS} -DNNTPSRC -o shlock shlock.c X X ${SRVROBJ}: ${SRVRINC} X XIndex: README X*** README Wed Jul 4 19:49:19 1990 X--- ../../nntp/xmit/README Mon Dec 24 16:36:18 1990 X*************** X*** 1,4 X! The program "nntpxmit" is an active trnamission client X (see the comment in nntpxmit.c for a description of the X difference between active and passive clients) written by Erik Fair X <fair@ucbvax.berkeley.edu, ...!ucbvax!fair>. A larger comment on X X--- 1,4 ----- X! The program "nntpxmit" is an active transmission client X (see the comment in nntpxmit.c for a description of the X difference between active and passive clients) written by Erik Fair X <fair@ucbvax.berkeley.edu, ...!ucbvax!fair>. A larger comment on X*************** X*** 26,33 X logging via syslog. Additionally, the "-d" option is availible X for debugging. X X! Please forward comments/suggestions for improvement/bugs to X! sob@bcm.tmc.edu. X X [My thanks extended to Erik for writing nntpxmit, shlock, X and the stats scripts. My thanks also to Mel Pleasant X X--- 26,32 ----- X logging via syslog. Additionally, the "-d" option is availible X for debugging. X X! Please forward comments/suggestions for improvement/bugs to nntp@tmc.edu. X X [My thanks extended to Erik for writing nntpxmit, shlock, X and the stats scripts. My thanks also to Mel Pleasant XIndex: get_tcp_conn.c X*** /tmp/,RCSt1a20229 Sun Feb 10 13:48:06 1991 X--- /tmp/,RCSt2a20229 Sun Feb 10 13:48:06 1991 X*************** X*** 1,3 X /* X ** Routines to open a TCP connection X ** X X--- 1,8 ----- X+ #ifndef lint X+ static char * rcsid = "$Header: get_tcp_conn.c,v 1.3 91/02/10 13:47:16 sob Exp $"; X+ #endif X+ #define USE_KEEPALIVES /* XXX should be in ../common/conf.h */ X+ X /* X ** Routines to open a TCP connection X ** X*************** X*** 316,322 X (void) close(sock); /* dump descriptor */ X errno = e_save; X } else X! return(sock); X } X return(FAIL); X } X X--- 321,338 ----- X (void) close(sock); /* dump descriptor */ X errno = e_save; X } else X! { X! #ifdef USE_KEEPALIVES X! int on = 1; X! if (setsockopt(sock,SOL_SOCKET,SO_KEEPALIVE,(char *)&on,sizeof(on)) < 0) X! { int e_save; X! e_save = errno; X! fprintf(stderr,"%s: %s [%s]: setsockopt KEEPALIVE: %s\n",Pname,host,inet_ntoa(sadr.sin_addr),errmsg(errno)); X! /* don't bother erroring out, just note it and ignore it */ X! } X! #endif X! return(sock); X! } X } X return(FAIL); X } XIndex: nntpxmit.c XPrereq: 1.3 X*** nntpxmit.c Sun Jul 8 01:18:10 1990 X--- ../../nntp/xmit/nntpxmit.c Fri Jan 25 20:56:17 1991 X*************** X*** 1,5 X #ifndef lint X! static char * rcsid = "@(#)$Header: nntpxmit.c,v 1.3 90/07/08 01:17:56 sob Exp $"; X #endif X /* nntpxmit - transmit netnews articles across the internet with nntp X ** X X--- 1,5 ----- X #ifndef lint X! static char * rcsid = "@(#)$Header: nntpxmit.c,v 1.6 91/01/25 20:55:53 sob Exp $"; X #endif X /* nntpxmit - transmit netnews articles across the internet with nntp X ** X*************** X*** 60,65 X ** nntpxmit only implements active send, for now. X ** X ** Erik E. Fair <fair@ucbarpa.berkeley.edu>, Dec 4, 1987 X */ X X #include "../common/conf.h" X X--- 60,66 ----- X ** nntpxmit only implements active send, for now. X ** X ** Erik E. Fair <fair@ucbarpa.berkeley.edu>, Dec 4, 1987 X+ ** Stan Barber <sob@bcm.tmc.edu>, Jan 1, 1989 X */ X X #include "../common/conf.h" X*************** X*** 89,95 X #else X #include <syslog.h> X #endif X! #endif SYSLOG X #include "../common/nntp.h" X #include "llist.h" X X X--- 90,96 ----- X #else X #include <syslog.h> X #endif X! #endif /* SYSLOG */ X #include "../common/nntp.h" X #include "llist.h" X X*************** X*** 94,100 X #include "llist.h" X X #define MAXFNAME BUFSIZ /* maximum filename size - big enough? */ X! #define FCLOSE(fp) (void) fclose(fp); (fp) = (FILE *)NULL X X FILE *getfp(); X char *errmsg(); X X--- 95,101 ----- X #include "llist.h" X X #define MAXFNAME BUFSIZ /* maximum filename size - big enough? */ X! #define FCLOSE(fp) if (fp) (void) fclose(fp); (fp) = (FILE *)NULL X X char *getline(); X char *getmsgid(); X*************** X*** 96,102 X #define MAXFNAME BUFSIZ /* maximum filename size - big enough? */ X #define FCLOSE(fp) (void) fclose(fp); (fp) = (FILE *)NULL X X! FILE *getfp(); X char *errmsg(); X void requeue(); X SIGRET catchsig(); X X--- 97,104 ----- X #define MAXFNAME BUFSIZ /* maximum filename size - big enough? */ X #define FCLOSE(fp) if (fp) (void) fclose(fp); (fp) = (FILE *)NULL X X! char *getline(); X! char *getmsgid(); X char *errmsg(); X void requeue(); X SIGRET catchsig(); X*************** X*** 151,156 X extern char *index(); X extern char *mktemp(); X extern char *strcpy(); X X #ifdef USG X void X X--- 153,159 ----- X extern char *index(); X extern char *mktemp(); X extern char *strcpy(); X+ extern char *strcat(); X X #ifdef USG X void X*************** X*** 160,166 X { X while(l-- > 0) *s++ = 0; X } X! #endif USG X X main(ac, av) X int ac; X X--- 163,169 ----- X { X while(l-- > 0) *s++ = 0; X } X! #endif /* USG */ X X main(ac, av) X int ac; X*************** X*** 192,199 X (void) openlog(Pname, LOG_PID); X #else X (void) openlog(Pname, LOG_PID, SYSLOG); X! #endif BSD_42 X! #endif SYSLOG X X for(i = 1; i < ac; i++) { X if (av[i][0] == '-') { X X--- 195,202 ----- X (void) openlog(Pname, LOG_PID); X #else X (void) openlog(Pname, LOG_PID, SYSLOG); X! #endif /* BSD_42 */ X! #endif /* SYSLOG */ X X for(i = 1; i < ac; i++) { X if (av[i][0] == '-') { X*************** X*** 304,310 X Host, Stats.offered, Stats.accepted, Stats.rejected, X Stats.failed); X log(L_INFO, buf); X! sprintf(buf, "%s xmit user %.1f system %.1f elapsed %.1f", X Host, (user - ouser), (sys - osys), (Tend - Tbegin)); X log(L_INFO, buf); X /* reset reference point */ X X--- 307,313 ----- X Host, Stats.offered, Stats.accepted, Stats.rejected, X Stats.failed); X log(L_INFO, buf); X! sprintf(buf, "%s xmit user %.3f system %.3f elapsed %.3f", X Host, (user - ouser), (sys - osys), (Tend - Tbegin)); X log(L_INFO, buf); X /* reset reference point */ X*************** X*** 330,336 X char *host, *file; X int transport, isQfile; X { X- register FILE *fp; X #ifdef FTRUNCATE X char *mode = "r+"; /* so we can use ftruncate() */ X #else X X--- 333,338 ----- X char *host, *file; X int transport, isQfile; X { X #ifdef FTRUNCATE X char *mode = "r+"; /* so we can use ftruncate() */ X #else X*************** X*** 335,341 X char *mode = "r+"; /* so we can use ftruncate() */ X #else X char *mode = "r"; X! #endif FTRUNCATE X X if ((Qfp = fopen(file, mode)) == (FILE *)NULL) { X char buf[BUFSIZ]; X X--- 337,344 ----- X char *mode = "r+"; /* so we can use ftruncate() */ X #else X char *mode = "r"; X! #endif /* FTRUNCATE */ X! char *msgid; X X if ((Qfp = fopen(file, mode)) == (FILE *)NULL) { X char buf[BUFSIZ]; X*************** X*** 376,385 X */ X catchsig(interrupted); X X! while((fp = getfp(Qfp, Article, sizeof(Article))) != (FILE *)NULL) { X! if (!sendarticle(host, fp)) { X! (void) fclose(fp); X! requeue(Article); X Article[0] = '\0'; X cleanup(); X goodbye(DONT_WAIT); X X--- 379,387 ----- X */ X catchsig(interrupted); X X! while ((msgid = getline(Qfp, Article, sizeof(Article))) != NULL) { X! if (!sendarticle(host, Article, msgid)) { X! requeue(Article, msgid); X Article[0] = '\0'; X cleanup(); X goodbye(DONT_WAIT); X*************** X*** 386,392 X restsig(); X return(TRUE); X } X- (void) fclose(fp); X } X X cleanup(); X X--- 388,393 ----- X restsig(); X return(TRUE); X } X } X X cleanup(); X*************** X*** 401,407 X */ X register int retcode; X X- retcode = sendarticle(host, Qfp); X FCLOSE(Qfp); X goodbye(retcode ? WAIT : DONT_WAIT); X return(retcode && Stats.accepted == 1 && Stats.failed == 0); X X--- 402,407 ----- X */ X register int retcode; X X FCLOSE(Qfp); X retcode = sendarticle(host, file, (char *) NULL); X goodbye(retcode ? WAIT : DONT_WAIT); X*************** X*** 403,408 X X retcode = sendarticle(host, Qfp); X FCLOSE(Qfp); X goodbye(retcode ? WAIT : DONT_WAIT); X return(retcode && Stats.accepted == 1 && Stats.failed == 0); X } X X--- 403,409 ----- X register int retcode; X X FCLOSE(Qfp); X+ retcode = sendarticle(host, file, (char *) NULL); X goodbye(retcode ? WAIT : DONT_WAIT); X return(retcode && Stats.accepted == 1 && Stats.failed == 0); X } X*************** X*** 417,423 X ** Watch all network I/O for errors, return FALSE if X ** the connection fails and we have to cleanup. X */ X! sendarticle(host, fp) X char *host; X FILE *fp; X { X X--- 418,424 ----- X ** Watch all network I/O for errors, return FALSE if X ** the connection fails and we have to cleanup. X */ X! sendarticle(host, file, msgid) X char *host; X char *file; X char *msgid; X*************** X*** 419,425 X */ X sendarticle(host, fp) X char *host; X! FILE *fp; X { X register int code; X char buf[BUFSIZ]; X X--- 420,427 ----- X */ X sendarticle(host, file, msgid) X char *host; X! char *file; X! char *msgid; X { X register int code; X FILE *fp = NULL; X*************** X*** 422,427 X FILE *fp; X { X register int code; X char buf[BUFSIZ]; X char *e_xfer = "%s xfer: %s"; X X X--- 424,431 ----- X char *msgid; X { X register int code; X+ FILE *fp = NULL; X+ int error; X char buf[BUFSIZ]; X char *e_xfer = "%s xfer: %s"; X X*************** X*** 425,431 X char buf[BUFSIZ]; X char *e_xfer = "%s xfer: %s"; X X! switch(code = ihave(fp)) { X case CONT_XFER: X /* X ** They want it. Give it to 'em. X X--- 429,442 ----- X char buf[BUFSIZ]; X char *e_xfer = "%s xfer: %s"; X X! errno = 0; X! if (msgid == NULL || *msgid == '\0') { X! if ((msgid = getmsgid(file, &fp)) == NULL) { X! if (fp) { (void) fclose(fp); fp = NULL; } X! return TRUE; X! } X! } X! switch(code = ihave(msgid)) { X case CONT_XFER: X /* X ** They want it. Give it to 'em. X*************** X*** 430,437 X /* X ** They want it. Give it to 'em. X */ X! if (!sendfile(fp)) { X! sprintf(buf, e_xfer, host, errmsg(errno)); X log(L_NOTICE, buf); X Stats.failed++; X return(FALSE); X X--- 441,465 ----- X /* X ** They want it. Give it to 'em. X */ X! if (!fp) { fp = fopen(file, "r"); } X! if (fp == NULL && errno != ENOENT) { X! /* Worse than "No such file or directory"? */ X! sprintf(buf, E_fopen, file, "r", errmsg(errno)); X! log(L_WARNING, buf); X! goodbye(DONT_WAIT); X! exit(EX_OSERR); X! } X! if (fp == NULL) { X! /* Hmph. The file didn't exist. */ X! error = sendcmd("."); X! } else { X! error = !sendfile(fp); X! (void) fclose(fp); X! fp = NULL; X! } X! if (error) { X! sprintf(buf, "%s xfer: sendfile: %s", X! host, errmsg(errno)); X log(L_NOTICE, buf); X Stats.failed++; X if (fp) { (void) fclose(fp); fp = NULL; } X*************** X*** 434,439 X sprintf(buf, e_xfer, host, errmsg(errno)); X log(L_NOTICE, buf); X Stats.failed++; X return(FALSE); X } X /* X X--- 462,468 ----- X host, errmsg(errno)); X log(L_NOTICE, buf); X Stats.failed++; X+ if (fp) { (void) fclose(fp); fp = NULL; } X return(FALSE); X } X /* X*************** X*** 440,445 X ** Did the article transfer OK? X ** Stay tuned to this same socket to find out! X */ X if ((code = readreply(buf, sizeof(buf))) != OK_XFERED) { X Stats.failed++; X if (code < 0) { X X--- 469,475 ----- X ** Did the article transfer OK? X ** Stay tuned to this same socket to find out! X */ X+ errno = 0; X if ((code = readreply(buf, sizeof(buf))) != OK_XFERED) { X Stats.failed++; X if (code < 0) { X*************** X*** 451,456 X X sprintf(errbuf, e_xfer, host, buf); X log(L_NOTICE, errbuf); X } X return(FALSE); X } X X--- 481,487 ----- X X sprintf(errbuf, e_xfer, host, buf); X log(L_NOTICE, errbuf); X+ if (fp) { (void) fclose(fp); fp = NULL; } X } X return(FALSE); X } X*************** X*** 454,461 X } X return(FALSE); X } X! if (ReQueue_Fails && code != ERR_XFERRJCT) { X! requeue(Article); X Article[0] = '\0'; X } X } X X--- 485,492 ----- X } X return(FALSE); X } X! if (ReQueue_Fails && code != ERR_XFERRJCT && fp != NULL) { X! requeue(Article, msgid); X Article[0] = '\0'; X } X } X*************** X*** 464,469 X /* they don't want it */ X break; X case ERR_XFERFAIL: X /* they can't do it right now, but maybe later */ X return(FALSE); X break; X X--- 495,501 ----- X /* they don't want it */ X break; X case ERR_XFERFAIL: X+ if (fp) { (void) fclose(fp); fp = NULL; } X /* they can't do it right now, but maybe later */ X return(FALSE); X break; X*************** X*** 479,484 X } else { X sprintf(buf, "%s improper response to IHAVE: %d while offering %s", host, code, Article); X log(L_WARNING, buf); X } X return(FALSE); X } X X--- 511,517 ----- X } else { X sprintf(buf, "%s improper response to IHAVE: %d while offering %s", host, code, Article); X log(L_WARNING, buf); X+ if (fp) { (void) fclose(fp); fp = NULL; } X } X return(FALSE); X } X*************** X*** 482,487 X } X return(FALSE); X } X return(TRUE); X } X X X--- 515,521 ----- X } X return(FALSE); X } X+ if (fp) { (void) fclose(fp); fp = NULL; } X return(TRUE); X } X X*************** X*** 549,556 X ** Get the message-id header field data with a minimum of fuss. X */ X char * X! getmsgid(fp) X! FILE *fp; X { X static char buf[BUFSIZ]; X static char *msgid = "message-id"; X X--- 583,591 ----- X ** Get the message-id header field data with a minimum of fuss. X */ X char * X! getmsgid(file, fpp) X! char *file; X! FILE **fpp; X { X static char buf[BUFSIZ]; X static char msgid[] = "message-id"; X*************** X*** 553,559 X FILE *fp; X { X static char buf[BUFSIZ]; X! static char *msgid = "message-id"; X register char *cp, *cp2; X X while(fgets(buf, sizeof(buf), fp) != (char *)NULL) { X X--- 588,594 ----- X FILE **fpp; X { X static char buf[BUFSIZ]; X! static char msgid[] = "message-id"; X register char *cp, *cp2; X X *fpp = fopen(file, "r"); X*************** X*** 556,562 X static char *msgid = "message-id"; X register char *cp, *cp2; X X! while(fgets(buf, sizeof(buf), fp) != (char *)NULL) { X switch(buf[0]) { X case '\n': X return((char *)NULL); /* EOH, we failed */ X X--- 591,600 ----- X static char msgid[] = "message-id"; X register char *cp, *cp2; X X! *fpp = fopen(file, "r"); X! if (*fpp == NULL) return NULL; X! X! while(fgets(buf, sizeof(buf), *fpp) != NULL) { X switch(buf[0]) { X case '\n': X (void) fclose(*fpp); X*************** X*** 559,565 X while(fgets(buf, sizeof(buf), fp) != (char *)NULL) { X switch(buf[0]) { X case '\n': X! return((char *)NULL); /* EOH, we failed */ X case 'M': X case 'm': X if ((cp = index(buf, ':')) == (char *)NULL) X X--- 597,605 ----- X while(fgets(buf, sizeof(buf), *fpp) != NULL) { X switch(buf[0]) { X case '\n': X! (void) fclose(*fpp); X! *fpp = NULL; X! return NULL; /* EOH, we failed */ X case 'M': X case 'm': X cp = index(buf, ':'); X*************** X*** 562,569 X return((char *)NULL); /* EOH, we failed */ X case 'M': X case 'm': X! if ((cp = index(buf, ':')) == (char *)NULL) X! continue; X *cp++ = '\0'; X if (strncmp(lcase(buf), msgid, sizeof(*msgid)) == 0) { X /* dump extraneous trash - umass.bitnet */ X X--- 602,609 ----- X return NULL; /* EOH, we failed */ X case 'M': X case 'm': X! cp = index(buf, ':'); X! if (cp == NULL) continue; X *cp++ = '\0'; X if (strncmp(lcase(buf), msgid, strlen(msgid)) == 0) { X /* dump extraneous trash - umass.bitnet */ X*************** X*** 565,571 X if ((cp = index(buf, ':')) == (char *)NULL) X continue; X *cp++ = '\0'; X! if (strncmp(lcase(buf), msgid, sizeof(*msgid)) == 0) { X /* dump extraneous trash - umass.bitnet */ X /* hope nobody quotes an '>' in a msgid */ X if ((cp2 = index(cp, '>')) != (char *)NULL) X X--- 605,611 ----- X cp = index(buf, ':'); X if (cp == NULL) continue; X *cp++ = '\0'; X! if (strncmp(lcase(buf), msgid, strlen(msgid)) == 0) { X /* dump extraneous trash - umass.bitnet */ X /* hope nobody quotes an '>' in a msgid */ X cp2 = index(cp, '>'); X*************** X*** 568,575 X if (strncmp(lcase(buf), msgid, sizeof(*msgid)) == 0) { X /* dump extraneous trash - umass.bitnet */ X /* hope nobody quotes an '>' in a msgid */ X! if ((cp2 = index(cp, '>')) != (char *)NULL) X! *++cp2 = '\0'; X return(sp_strip(cp)); X } X break; X X--- 608,616 ----- X if (strncmp(lcase(buf), msgid, strlen(msgid)) == 0) { X /* dump extraneous trash - umass.bitnet */ X /* hope nobody quotes an '>' in a msgid */ X! cp2 = index(cp, '>'); X! if (cp2 != NULL) *++cp2 = '\0'; X! (void) rewind(*fpp); X return(sp_strip(cp)); X } X break; X*************** X*** 575,581 X break; X } X } X! return((char *)NULL); /* EOF, we failed */ X } X X #ifdef notdef /* nobody obeys the triply damned protocol anyway! */ X X--- 616,624 ----- X break; X } X } X! (void) fclose(*fpp); X! *fpp = NULL; X! return NULL; /* EOF, failed. */ X } X X #ifdef notdef /* nobody obeys the triply damned protocol anyway! */ X*************** X*** 715,721 X } X return(FALSE); X } X! #endif notdef X X /* X ** Read the header of a netnews article, snatch the message-id therefrom, X X--- 758,764 ----- X } X return(FALSE); X } X! #endif /* notdef */ X X /* X ** Read the header of a netnews article, snatch the message-id therefrom, X*************** X*** 721,728 X ** Read the header of a netnews article, snatch the message-id therefrom, X ** and ask the remote if they have that one already. X */ X! ihave(fp) X! FILE *fp; X { X register int code; X register char *id; X X--- 764,771 ----- X ** Read the header of a netnews article, snatch the message-id therefrom, X ** and ask the remote if they have that one already. X */ X! ihave(id) X! char *id; X { X register int code; X char buf[BUFSIZ]; X*************** X*** 725,731 X FILE *fp; X { X register int code; X- register char *id; X char buf[BUFSIZ]; X X if ((id = getmsgid(fp)) == (char *)NULL || *id == '\0') { X X--- 768,773 ----- X char *id; X { X register int code; X char buf[BUFSIZ]; X X if (id == NULL || *id == '\0') { X*************** X*** 728,734 X register char *id; X char buf[BUFSIZ]; X X! if ((id = getmsgid(fp)) == (char *)NULL || *id == '\0') { X /* X ** something botched locally with the article X ** so we don't send it, but we don't break off X X--- 770,776 ----- X register int code; X char buf[BUFSIZ]; X X! if (id == NULL || *id == '\0') { X /* X ** something botched locally with the article X ** so we don't send it, but we don't break off X*************** X*** 752,758 X switch(code = converse(buf, sizeof(buf))) { X case CONT_XFER: X Stats.accepted++; X- rewind(fp); X return(code); X case ERR_GOTIT: X Stats.rejected++; X X--- 794,799 ----- X switch(code = converse(buf, sizeof(buf))) { X case CONT_XFER: X Stats.accepted++; X return(code); X case ERR_GOTIT: X Stats.rejected++; X*************** X*** 768,778 X } X X /* X! ** Given that fp points to an open file containing filenames, X! ** open and return a file pointer to the next filename in the file. X! ** Don't you love indirection? X! ** X! ** Returns a valid FILE pointer or NULL if end of file. X */ X FILE * X getfp(fp, filename, fnlen) X X--- 809,819 ----- X } X X /* X! ** Read the next line from fp into line, X! ** break it apart into filename and message-id, X! ** and return a pointer to the message-id. X! ** Returns "" if no message-id. X! ** Returns NULL at end of file. X */ X char * X getline(fp, line, len) X*************** X*** 774,784 X ** X ** Returns a valid FILE pointer or NULL if end of file. X */ X! FILE * X! getfp(fp, filename, fnlen) X! register FILE *fp; X! char *filename; X! register int fnlen; X { X register FILE *newfp = (FILE *)NULL; X register char *cp; X X--- 815,825 ----- X ** Returns "" if no message-id. X ** Returns NULL at end of file. X */ X! char * X! getline(fp, line, len) X! FILE *fp; X! char *line; X! int len; X { X register char *cp; X X*************** X*** 780,786 X char *filename; X register int fnlen; X { X- register FILE *newfp = (FILE *)NULL; X register char *cp; X char *mode = "r"; X X X--- 821,826 ----- X char *line; X int len; X { X register char *cp; X X do { X*************** X*** 782,788 X { X register FILE *newfp = (FILE *)NULL; X register char *cp; X- char *mode = "r"; X X while(newfp == (FILE *)NULL) { X if (fgets(filename, fnlen, fp) == (char *)NULL) X X--- 822,827 ----- X int len; X { X register char *cp; X X do { X if (fgets(line, len, fp) == NULL) return NULL; X*************** X*** 784,792 X register char *cp; X char *mode = "r"; X X! while(newfp == (FILE *)NULL) { X! if (fgets(filename, fnlen, fp) == (char *)NULL) X! return((FILE *)NULL); /* EOF, tell caller */ X X filename[fnlen - 1] = '\0'; /* make sure */ X X X--- 823,831 ----- X { X register char *cp; X X! do { X! if (fgets(line, len, fp) == NULL) return NULL; X! line[len - 1] = '\0'; X X cp = index(line, '\n'); X if (cp != NULL) *cp = '\0'; X*************** X*** 788,794 X if (fgets(filename, fnlen, fp) == (char *)NULL) X return((FILE *)NULL); /* EOF, tell caller */ X X! filename[fnlen - 1] = '\0'; /* make sure */ X X /* if fgets() ever forgets the '\n', we're fucked */ X if (*(cp = &filename[strlen(filename) - 1]) == '\n') X X--- 827,835 ----- X if (fgets(line, len, fp) == NULL) return NULL; X line[len - 1] = '\0'; X X! cp = index(line, '\n'); X! if (cp != NULL) *cp = '\0'; X! } while (line[0] == '\0'); X X cp = &line[0]; X while (*cp != '\0' && !isspace(*cp)) ++cp; X*************** X*** 790,818 X X filename[fnlen - 1] = '\0'; /* make sure */ X X! /* if fgets() ever forgets the '\n', we're fucked */ X! if (*(cp = &filename[strlen(filename) - 1]) == '\n') X! *cp = '\0'; X! X! if (filename[0] == '\0') X! continue; X! X! if ((newfp = fopen(filename, mode)) == (FILE *)NULL) { X! /* X! ** The only permissible error is `file non-existant' X! ** anything else indicates something is seriously X! ** wrong, and we should go away to let the shell X! ** script clean up. X! */ X! if (errno != ENOENT) { X! char buf[BUFSIZ]; X! X! sprintf(buf, E_fopen, filename, mode, errmsg(errno)); X! log(L_WARNING, buf); X! goodbye(DONT_WAIT); X! exit(EX_OSERR); X! } X! } X } X return(newfp); X } X X--- 831,842 ----- X if (cp != NULL) *cp = '\0'; X } while (line[0] == '\0'); X X! cp = &line[0]; X! while (*cp != '\0' && !isspace(*cp)) ++cp; X! if (*cp != '\0') { X! *cp++ = '\0'; X! while (*cp != '\0' && isspace(*cp)) ++cp; X! /* cp now points to the message-id, if any. */ X } X return cp; X } X*************** X*** 814,820 X } X } X } X! return(newfp); X } X X /* X X--- 838,844 ----- X while (*cp != '\0' && isspace(*cp)) ++cp; X /* cp now points to the message-id, if any. */ X } X! return cp; X } X X /* X*************** X*** 833,839 X ** Nothing to clean up after, reset stuff and X ** nuke the queue file. X */ X! requeue((char *)NULL); X if (feof(Qfp)) { X dprintf(stderr, "%s: unlink(%s)\n", Pname, Qfile); X if (unlink(Qfile) < 0) { X X--- 857,863 ----- X ** Nothing to clean up after, reset stuff and X ** nuke the queue file. X */ X! requeue((char *)NULL, (char *)NULL); X if (feof(Qfp)) { X dprintf(stderr, "%s: unlink(%s)\n", Pname, Qfile); X if (unlink(Qfile) < 0) { X*************** X*** 853,859 X ** Calling this with a NULL pointer resets the internal pointer. X */ X void X! requeue(article) X char *article; X { X static ll_t *lp = &FailedArticles; X X--- 877,884 ----- X ** Calling this with a NULL pointer resets the internal pointer. X */ X void X! requeue(article, msgid) X! char *msgid; X char *article; X { X char buf[BUFSIZ]; X*************** X*** 856,861 X requeue(article) X char *article; X { X static ll_t *lp = &FailedArticles; X X if (article == (char *)NULL) { X X--- 881,887 ----- X char *msgid; X char *article; X { X+ char buf[BUFSIZ]; X static ll_t *lp = &FailedArticles; X X if (article == (char *)NULL) { X*************** X*** 866,873 X if (*article == '\0') X return; X X! dprintf(stderr, "%s: requeue(%s)\n", Pname, article); X! if ((lp = l_alloc(lp, article, strlen(article) + 1)) == (ll_t *)NULL) { X fprintf(stderr, "%s: requeue(%s) failed, dumping fail list\n", X Pname, article); X /* X X--- 892,904 ----- X if (*article == '\0') X return; X X! (void) strcpy(buf, article); X! if (msgid != NULL && *msgid != '\0') { X! (void) strcat(strcat(buf, " "), msgid); X! } X! X! dprintf(stderr, "%s: requeue(%s)\n", Pname, buf); X! if ((lp = l_alloc(lp, buf, strlen(buf) + 1)) == (ll_t *)NULL) { X fprintf(stderr, "%s: requeue(%s) failed, dumping fail list\n", X Pname, buf); X /* X*************** X*** 869,875 X dprintf(stderr, "%s: requeue(%s)\n", Pname, article); X if ((lp = l_alloc(lp, article, strlen(article) + 1)) == (ll_t *)NULL) { X fprintf(stderr, "%s: requeue(%s) failed, dumping fail list\n", X! Pname, article); X /* X ** Wow! Did you know that this could blow the stack X ** if we recurse too deeply? I sure didn't! X X--- 900,906 ----- X dprintf(stderr, "%s: requeue(%s)\n", Pname, buf); X if ((lp = l_alloc(lp, buf, strlen(buf) + 1)) == (ll_t *)NULL) { X fprintf(stderr, "%s: requeue(%s) failed, dumping fail list\n", X! Pname, buf); X /* X ** Wow! Did you know that this could blow the stack X ** if we recurse too deeply? I sure didn't! X*************** X*** 891,897 X register FILE *tmpfp; X register int nart = 0; X char *mode = "w+"; X! char *template = "/tmp/nntpxmitXXXXXX"; X char buf[BUFSIZ]; X static char *tempfile = (char *)NULL; X X X--- 922,928 ----- X register FILE *tmpfp; X register int nart = 0; X char *mode = "w+"; X! static char template[] = "/tmp/nntpxmitXXXXXX"; X char buf[BUFSIZ]; X static char *tempfile = (char *)NULL; X X*************** X*** 897,903 X X dprintf(stderr, "%s: rewrite(%s)\n", Pname, Qfile); X X! if (tempfile == (char *)NULL) /* should only need this once */ X tempfile = mktemp(template); X X if ((tmpfp = fopen(tempfile, mode)) == (FILE *)NULL) { X X--- 928,934 ----- X X dprintf(stderr, "%s: rewrite(%s)\n", Pname, Qfile); X X! if (tempfile == (char *)NULL) /* should only need this once */ X tempfile = mktemp(template); X X if ((tmpfp = fopen(tempfile, mode)) == (FILE *)NULL) { X*************** X*** 946,952 X sprintf(buf, E_unlk, tempfile, errmsg(errno)); X log(L_WARNING, buf); X } X! requeue((char *)NULL); /* reset */ X return; X } X X X--- 977,983 ----- X sprintf(buf, E_unlk, tempfile, errmsg(errno)); X log(L_WARNING, buf); X } X! requeue((char *)NULL,(char *)NULL); /* reset */ X return; X } X X*************** X*** 962,968 X sprintf(buf, E_unlk, tempfile, errmsg(errno)); X log(L_WARNING, buf); X } X! requeue((char *)NULL); /* reset */ X return; X } X #else X X--- 993,999 ----- X sprintf(buf, E_unlk, tempfile, errmsg(errno)); X log(L_WARNING, buf); X } X! requeue((char *)NULL,(char *)NULL); /* reset */ X return; X } X #else X*************** X*** 975,981 X sprintf(buf, E_unlk, tempfile, errmsg(errno)); X log(L_WARNING, buf); X } X! requeue((char *)NULL); /* reset */ X return; X } X /* Try to get our lock back (but continue whether we do or not) */ X X--- 1006,1012 ----- X sprintf(buf, E_unlk, tempfile, errmsg(errno)); X log(L_WARNING, buf); X } X! requeue((char *)NULL,(char *)NULL); /* reset */ X return; X } X /* Try to get our lock back (but continue whether we do or not) */ X*************** X*** 980,986 X } X /* Try to get our lock back (but continue whether we do or not) */ X (void) lockfd(fileno(Qfp), Qfile, DONT_BLOCK); X! #endif FTRUNCATE X X dprintf(stderr, "%s: copying %s back to %s\n", Pname, tempfile, Qfile); X while(fgets(buf, sizeof(buf), tmpfp) != (char *)NULL) X X--- 1011,1017 ----- X } X /* Try to get our lock back (but continue whether we do or not) */ X (void) lockfd(fileno(Qfp), Qfile, DONT_BLOCK); X! #endif /* FTRUNCATE */ X X dprintf(stderr, "%s: copying %s back to %s\n", Pname, tempfile, Qfile); X while(fgets(buf, sizeof(buf), tmpfp) != (char *)NULL) X*************** X*** 997,1003 X sprintf(buf, E_unlk, tempfile, errmsg(errno)); X log(L_WARNING, buf); X } X! requeue((char *)NULL); /* reset */ X dprintf(stderr, "%s: rewrite(%s): done\n", Pname, Qfile); X return; X } X X--- 1028,1034 ----- X sprintf(buf, E_unlk, tempfile, errmsg(errno)); X log(L_WARNING, buf); X } X! requeue((char *)NULL,(char *)NULL); /* reset */ X dprintf(stderr, "%s: rewrite(%s): done\n", Pname, Qfile); X return; X } X*************** X*** 1015,1021 X X #ifndef RELSIG X catchsig(SIG_IGN); /* for System V - hope we're quick enough */ X! #endif RELSIG X sprintf(buf, "%s signal %d", Host, sig); X log(L_NOTICE, buf); X requeue(Article); X X--- 1046,1052 ----- X X #ifndef RELSIG X catchsig(SIG_IGN); /* for System V - hope we're quick enough */ X! #endif /* RELSIG */ X sprintf(buf, "%s signal %d", Host, sig); X log(L_NOTICE, buf); X requeue(Article,(char *)NULL); X*************** X*** 1018,1024 X #endif RELSIG X sprintf(buf, "%s signal %d", Host, sig); X log(L_NOTICE, buf); X! requeue(Article); X cleanup(); X if (Report_Stats) X logstats(); X X--- 1049,1055 ----- X #endif /* RELSIG */ X sprintf(buf, "%s signal %d", Host, sig); X log(L_NOTICE, buf); X! requeue(Article,(char *)NULL); X cleanup(); X if (Report_Stats) X logstats(); X*************** X*** 1073,1078 X int importance; X char *error; X { X FILE *report = (importance == L_INFO ? stdout : stderr); X fprintf(report, "%s: %s\n", Pname, error); X #ifdef SYSLOG X X--- 1104,1110 ----- X int importance; X char *error; X { X+ int skip = FALSE; X FILE *report = (importance == L_INFO ? stdout : stderr); X fprintf(report, "%s: %s\n", Pname, error); X #ifdef SYSLOG X*************** X*** 1075,1081 X { X FILE *report = (importance == L_INFO ? stdout : stderr); X fprintf(report, "%s: %s\n", Pname, error); X! #ifdef SYSLOG X switch(importance) { X #ifdef LOG X case L_DEBUG: importance = LOG_DEBUG; break; X X--- 1107,1113 ----- X int skip = FALSE; X FILE *report = (importance == L_INFO ? stdout : stderr); X fprintf(report, "%s: %s\n", Pname, error); X! #ifdef SYSLOG X switch(importance) { X #ifdef LOG X case L_DEBUG: importance = LOG_DEBUG; break; X*************** X*** 1079,1084 X switch(importance) { X #ifdef LOG X case L_DEBUG: importance = LOG_DEBUG; break; X #endif X case L_INFO: importance = LOG_INFO; break; X case L_NOTICE: importance = LOG_NOTICE; break; X X--- 1111,1118 ----- X switch(importance) { X #ifdef LOG X case L_DEBUG: importance = LOG_DEBUG; break; X+ #else X+ case L_DEBUG: skip = TRUE; break; X #endif X case L_INFO: importance = LOG_INFO; break; X case L_NOTICE: importance = LOG_NOTICE; break; X*************** X*** 1085,1092 X case L_WARNING: importance = LOG_WARNING; break; X default: importance = LOG_DEBUG; break; X } X! syslog(importance, error); X! #endif SYSLOG X } X X /* X X--- 1119,1126 ----- X case L_WARNING: importance = LOG_WARNING; break; X default: importance = LOG_DEBUG; break; X } X! if (skip == FALSE) syslog(importance, error); X! #endif /* SYSLOG */ X } X X /* X*************** X*** 1109,1115 X } X return(FALSE); X } X! #endif F_TLOCK X #else X #ifdef LOCK_EX X if (flock(fd, LOCK_EX|(non_blocking ? LOCK_NB : 0)) < 0) { X X--- 1143,1149 ----- X } X return(FALSE); X } X! #endif /* F_TLOCK */ X #else X #ifdef LOCK_EX X if (flock(fd, LOCK_EX|(non_blocking ? LOCK_NB : 0)) < 0) { X*************** X*** 1119,1125 X } X return(FALSE); X } X! #endif LOCK_EX X! #endif USG X return(TRUE); X } X X--- 1153,1159 ----- X } X return(FALSE); X } X! #endif /* LOCK_EX */ X! #endif /* USG */ X return(TRUE); X } XIndex: nntpxmit.h X*** nntpxmit.h Fri Aug 10 22:56:08 1990 X--- ../../nntp/xmit/nntpxmit.h Mon Feb 4 02:34:48 1991 X*************** X*** 11,21 X #include <sys/stat.h> X #endif MMAP X X- #ifdef SIGRET X- #undef SIGRET X- #endif X- #define SIGRET void /* Newfangled signal() returns void, old returns int */ X- X typedef SIGRET (*ifunp)(); /* pointer to function that returns */ X /* whatever signal() returns */ X X X--- 11,16 ----- X #include <sys/stat.h> X #endif MMAP X X typedef SIGRET (*ifunp)(); /* pointer to function that returns */ X /* whatever signal() returns */ X XIndex: remote.c XPrereq: 1.2 X*** remote.c Fri Aug 10 22:56:22 1990 X--- ../../nntp/xmit/remote.c Fri Feb 8 18:32:18 1991 X*************** X*** 1,5 X #ifndef lint X! static char * rcsid = "@(#)$Header: remote.c,v 1.2 90/08/10 22:56:12 sob Exp $"; X #endif X /* X ** remote communication routines for NNTP/SMTP style communication. X X--- 1,5 ----- X #ifndef lint X! static char * rcsid = "@(#)$Header: remote.c,v 1.5 91/02/08 18:32:11 sob Exp $"; X #endif X /* X ** remote communication routines for NNTP/SMTP style communication. X*************** X*** 298,304 X rmt_rd = (FILE *)NULL; X (void) fclose(rmt_wr); X rmt_wr = (FILE *)NULL; X! if (pstate != (ifunp)(-1)); X (void) signal(SIGPIPE, pstate); X } X X X--- 298,304 ----- X rmt_rd = (FILE *)NULL; X (void) fclose(rmt_wr); X rmt_wr = (FILE *)NULL; X! if (pstate != (ifunp)(-1)) X (void) signal(SIGPIPE, pstate); X } X X*************** X*** 335,341 X fp->_flag |= _IOERR; /* set stdio error */ X #endif X #ifndef ETIMEDOUT X! errno = EPIPE; /* USG doesn't have ETIMEDOUT */ X #else X errno = ETIMEDOUT; /* connection timed out */ X #endif X X--- 335,341 ----- X fp->_flag |= _IOERR; /* set stdio error */ X #endif X #ifndef ETIMEDOUT X! errno = EPIPE; /* USG doesn't have ETIMEDOUT*/ X #else X errno = ETIMEDOUT; /* connection timed out */ X #endif X*************** X*** 446,451 X while((c = fgetc(fp)) != EOF && !feof(fp)) { X #endif !MMAP X switch(c) { X case '\n': X PUTC('\r'); /* \n -> \r\n */ X PUTC(c); X X--- 446,453 ----- X while((c = fgetc(fp)) != EOF && !feof(fp)) { X #endif !MMAP X switch(c) { X+ case '\177': /* skip deletes... */ X+ break; X case '\n': X PUTC('\r'); /* \n -> \r\n */ X PUTC(c); XIndex: shlock.c XPrereq: 1.2 X*** shlock.c Wed Jul 4 20:01:52 1990 X--- ../../nntp/xmit/shlock.c Sat Jan 12 01:04:42 1991 X*************** X*** 1,5 X #ifndef lint X! static char * rcsid = "@(#)$Header: shlock.c,v 1.2 90/01/15 01:37:33 sob Exp $"; X #endif X /* X ** Program to produce reliable locks for shell scripts. X X--- 1,5 ----- X #ifndef lint X! static char * rcsid = "@(#)$Header: shlock.c,v 1.3 91/01/12 01:04:24 sob Exp $"; X #endif X /* X ** Program to produce reliable locks for shell scripts. X*************** X*** 33,38 X #include <fcntl.h> /* Needed on hpux */ X #include <sys/file.h> X #include <errno.h> X #include "../common/conf.h" X X #define LOCK_SET 0 X X--- 33,39 ----- X #include <fcntl.h> /* Needed on hpux */ X #include <sys/file.h> X #include <errno.h> X+ #ifdef NNTPSRC X #include "../common/conf.h" X #endif X X*************** X*** 34,39 X #include <sys/file.h> X #include <errno.h> X #include "../common/conf.h" X X #define LOCK_SET 0 X #define LOCK_FAIL 1 X X--- 35,41 ----- X #include <errno.h> X #ifdef NNTPSRC X #include "../common/conf.h" X+ #endif X X #define LOCK_SET 0 X #define LOCK_FAIL 1 SHAR_EOF if test 35693 -ne "`wc -c < 'xmit.diff'`" then echo shar: error transmitting "'xmit.diff'" '(should have been 35693 characters)' fi fi # end of overwriting check echo shar: done with directory "'xmit'" cd .. if test ! -d 'xfer' then echo shar: creating directory "'xfer'" mkdir 'xfer' fi echo shar: entering directory "'xfer'" cd 'xfer' echo shar: extracting "'xfer.diff'" '(4642 characters)' if test -f 'xfer.diff' then echo shar: will not over-write existing file "'xfer.diff'" else sed 's/^ X//' << \SHAR_EOF > 'xfer.diff' X*** README Wed Jul 4 19:48:10 1990 X--- ../../nntp/xfer/README Sat Feb 2 13:32:39 1991 X*************** X*** 1,6 X! This is a "passive" news transmission client. It queries X! other servers for news with NEWNEWS and gets it via the article X! command. X X This program still remains largely undocuemented and experimental. X PLEASE READ THE SOURCE for the best information. This will be more X X--- 1,5 ----- X! This is a "passive" news transmission client. It queries other servers X! for news with NEWNEWS and gets it via the ARTICLE command. X X This program still remains largely undocumented and experimental. X PLEASE READ THE SOURCE for the best information. This will be more X*************** X*** 2,8 X other servers for news with NEWNEWS and gets it via the article X command. X X! This program still remains largely undocuemented and experimental. X PLEASE READ THE SOURCE for the best information. This will be more X integrated into the NNTP distribution, but it is a slow process. X X X--- 1,7 ----- X This is a "passive" news transmission client. It queries other servers X for news with NEWNEWS and gets it via the ARTICLE command. X X! This program still remains largely undocumented and experimental. X PLEASE READ THE SOURCE for the best information. This will be more X integrated into the NNTP distribution, but it is a slow process. X XIndex: nntpxfer.c XPrereq: 1.7 X*** nntpxfer.c Sat Aug 25 16:59:00 1990 X--- ../../nntp/xfer/nntpxfer.c Sat Feb 2 13:31:49 1991 X*************** X*** 1,5 X #ifndef lint X! static char * scsid = "@(#)$Header: nntpxfer.c,v 1.7 90/08/25 16:58:52 sob Exp $"; X #endif X /* X * nntpxfer X X--- 1,5 ----- X #ifndef lint X! static char * scsid = "@(#)$Header: nntpxfer.c,v 1.9 91/02/02 13:31:37 sob Exp $"; X #endif X /* X * nntpxfer X*************** X*** 78,83 X #ifndef TIMEOUT X #define TIMEOUT (30*60) X #endif X X char *malloc(); X char *strcpy(); X X--- 78,86 ----- X #ifndef TIMEOUT X #define TIMEOUT (30*60) X #endif X+ #ifndef MAX_ARTICLES X+ #define MAX_ARTICLES 4096 X+ #endif X X char *malloc(); X char *strcpy(); X*************** X*** 104,110 X char dtname[128]; X char newsgroups[BUFSIZ]; X char lasttime[16]; X- int connected = 0; /* 1 = connected */ X int i; X int omitupdate = 0; /* 1 = don't update datetime */ X long clock; X X--- 107,112 ----- X char dtname[128]; X char newsgroups[BUFSIZ]; X char lasttime[16]; X int i; X int omitupdate = 0; /* 1 = don't update datetime */ X long clock; X*************** X*** 128,134 X X if (argc > 2) X { X! omitupdate++; X (void) strcpy(newsgroups, argv[2]); X (void) strcpy(lastdate, argv[3]); X (void) strcpy(lasttime, argv[4]); X X--- 130,136 ----- X X if (argc > 2) X { X! omitupdate=1; X (void) strcpy(newsgroups, argv[2]); X (void) strcpy(lastdate, argv[3]); X (void) strcpy(lasttime, argv[4]); X*************** X*** 303,309 X break; X if (wewant(buf)) X { X! if (newart > MAX_ARTICLES) X { X omitupdate++; X continue; X X--- 305,311 ----- X break; X if (wewant(buf)) X { X! if (newart >= MAX_ARTICLES) X { X omitupdate=1; X continue; X*************** X*** 305,311 X { X if (newart > MAX_ARTICLES) X { X! omitupdate++; X continue; X } X artlist[newart] = malloc((unsigned)(strlen(buf)+1)); X X--- 307,313 ----- X { X if (newart >= MAX_ARTICLES) X { X! omitupdate=1; X continue; X } X artlist[newart] = malloc((unsigned)(strlen(buf)+1)); X*************** X*** 367,372 X artfetch(articleid) X char *articleid; X { X int lines = 0; X char buf[BUFSIZ]; X FILE *inews; X X--- 369,375 ----- X artfetch(articleid) X char *articleid; X { X+ #ifdef DEBUG X int lines = 0; X #endif X char buf[BUFSIZ]; X*************** X*** 368,373 X char *articleid; X { X int lines = 0; X char buf[BUFSIZ]; X FILE *inews; X X X--- 371,377 ----- X { X #ifdef DEBUG X int lines = 0; X+ #endif X char buf[BUFSIZ]; X FILE *inews; X X*************** X*** 412,417 X (void) sockread(buf); X if (buf[0] == '.' && buf[1] == '\0') X break; X lines++; X (void) strcat(buf,"\n"); X (void) fputs(((buf[0] == '.') ? buf + 1 : buf), X X--- 416,422 ----- X (void) sockread(buf); X if (buf[0] == '.' && buf[1] == '\0') X break; X+ #ifdef DEBUG X lines++; X #endif X (void) strcat(buf,"\n"); X*************** X*** 413,418 X if (buf[0] == '.' && buf[1] == '\0') X break; X lines++; X (void) strcat(buf,"\n"); X (void) fputs(((buf[0] == '.') ? buf + 1 : buf), X inews); X X--- 418,424 ----- X break; X #ifdef DEBUG X lines++; X+ #endif X (void) strcat(buf,"\n"); X (void) fputs(((buf[0] == '.') ? buf + 1 : buf), X inews); SHAR_EOF if test 4642 -ne "`wc -c < 'xfer.diff'`" then echo shar: error transmitting "'xfer.diff'" '(should have been 4642 characters)' fi fi # end of overwriting check echo shar: done with directory "'xfer'" cd .. if test ! -d 'inews' then echo shar: creating directory "'inews'" mkdir 'inews' fi echo shar: entering directory "'inews'" cd 'inews' echo shar: extracting "'inews.diff'" '(2473 characters)' if test -f 'inews.diff' then echo shar: will not over-write existing file "'inews.diff'" else sed 's/^ X//' << \SHAR_EOF > 'inews.diff' XIndex: inews.c XPrereq: 1.19 X*** inews.c Fri Aug 10 22:53:40 1990 X--- ../../nntp/inews/inews.c Fri Feb 8 18:29:38 1991 X*************** X*** 1,5 X #ifndef lint X! static char *sccsid = "@(#)$Header: inews.c,v 1.19 90/08/10 22:53:27 sob Exp $"; X #endif X X /* X X--- 1,5 ----- X #ifndef lint X! static char *sccsid = "@(#)$Header: inews.c,v 1.21 91/02/08 18:29:35 sob Exp $"; X #endif X X /* X*************** X*** 41,46 X char host_name[256]; X struct passwd *passwd; X X main(argc, argv) X int argc; X char *argv[]; X X--- 41,50 ----- X char host_name[256]; X struct passwd *passwd; X X+ #ifdef REALDOMAIN X+ #include <netdb.h> X+ #endif X+ X main(argc, argv) X int argc; X char *argv[]; X*************** X*** 91,96 X X uname(host_name); X X server = getserverbyfile(SERVER_FILE); X if (server == NULL) { X fprintf(stderr, X X--- 95,109 ----- X X uname(host_name); X X+ #ifdef REALDOMAIN X+ { X+ struct hostent *hp; X+ X+ if (hp = gethostbyname(host_name)) X+ strcpy(host_name, hp->h_name); X+ } X+ #endif X+ X server = getserverbyfile(SERVER_FILE); X if (server == NULL) { X fprintf(stderr, X*************** X*** 145,151 X cp = s + strlen(s) - 1; X if (cp >= s && *cp == '\n') X *cp = '\0'; X- X if (s[0] == '.') /* Single . is eof, so put in extra one */ X (void) fputc('.', ser_wr_fp); X if (in_header && strneql(s, "From:", sizeof("From:")-1)) { X X--- 158,163 ----- X cp = s + strlen(s) - 1; X if (cp >= s && *cp == '\n') X *cp = '\0'; X if (s[0] == '.') /* Single . is eof, so put in extra one */ X (void) fputc('.', ser_wr_fp); X if (in_header && strneql(s, "From:", sizeof("From:")-1)) { X*************** X*** 176,181 X } X fprintf(ser_wr_fp, "%s\r\n", s); X } X X append_signature(); X X X--- 188,204 ----- X } X fprintf(ser_wr_fp, "%s\r\n", s); X } X+ if (in_header) { X+ /* Still in header after EOF? Hmm... */ X+ in_header = 0; X+ if (!seen_pathline) X+ gen_frompath(PATH); X+ if (!seen_fromline) X+ gen_frompath(FROM); X+ else X+ fprintf(ser_wr_fp, "Originator: %s@%s\r\n", passwd->pw_name, host_name); X+ fprintf(ser_wr_fp, "\r\n"); X+ } X X append_signature(); X X*************** X*** 310,316 X } X X if (which == FROM){ X! #ifdef DOMAIN X #ifdef HIDDENNET X fprintf(ser_wr_fp, "From: %s@%s (", X passwd->pw_name, X X--- 333,339 ----- X } X X if (which == FROM){ X! #if defined(DOMAIN) && ! defined(REALDOMAIN) X #ifdef HIDDENNET X fprintf(ser_wr_fp, "From: %s@%s (", X passwd->pw_name, SHAR_EOF if test 2473 -ne "`wc -c < 'inews.diff'`" then echo shar: error transmitting "'inews.diff'" '(should have been 2473 characters)' fi fi # end of overwriting check echo shar: done with directory "'inews'" cd .. # End of shell archive exit 0
nntp@tmc.edu (Stan Barber) (02/11/91)
#! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # common # This archive created: Sun Feb 10 14:35:59 1991 export PATH; PATH=/bin:$PATH if test ! -d 'common' then echo shar: creating directory "'common'" mkdir 'common' fi echo shar: entering directory "'common'" cd 'common' echo shar: extracting "'README'" '(20055 characters)' sed 's/^ X//' << \SHAR_EOF > 'README' X You will need to customize common/conf.h to get the server, Xsupport, and client programs running on your system. Unfortunately, X"rrn" has its own ideas of where to look for configuration information, Xso there is some duplication here. X X >>> Also, you should see README.SYSV if you are compiling this on X >>> a System V machine, as there is some extra stuff you need to do. X X >>> Also, you should see README.MTXNIU if you are compiling this X >>> on a system running MTXNIU BSD + NFS. X X >>> Also, you should see README.IRIX, if you are compiling this on the X >>> SGI IRIS. X X >>> Also, you should see README.XENIX, if you are compiling this on X >>> a machine running SCO XENIX with TCP. X X >>> Also, you should see README.HPUX, if you are compiling this under X >>> HP-UX. X X FIRST, copy conf.h.dist to conf.h and alter ONLY conf.h. X X This is sort of a walk through conf.h so you can get some idea of Xwhat parameters need to be changed. You should probably print this Xfile out (or keep it in a separate window if you're on a workstation) Xand edit conf.h as you read through it. For each #define in conf.h, Xthe default value is listed in parenthesis after its name in this Xdocument. Manual entries mentioned here are in the "doc" directory of Xthe NNTP distribution. X X First are some compile-time type options, for compiling in Xcertain code. The options should be "#undef"ed if you don't want Xthem, and "#defined" if you do. X XALONE (undefined) X X Defines whether we're a stand alone version of the server, or Xwhether we're running under inetd. Define this if you do NOT have inetd. XIf you do have inetd, keep it undef'ed. X XFASTFORK (undefined) X X If ALONE is defined, then this option tells us not to read the Xactive file when we fork, but rather for the parent daemon to re-read Xit every READINTVL (below) seconds. This should make forking off children Xa little bit faster. X XLOAD (defined as 5) X You can have nntp findout the load average on a BSD-type machine X(sun or ultrix) and if the load average is higher than LOAD, the connection Xwill be rejected. X XDYNAMIC_ART_ARRAY (undefined) X Originally, nntpd assumes a specific maximum number of articles on Xline per group. (See MAX_ARTICLES definition below.) This has proven to be Xa problem at some sites. Define this to dynamically allocate a larger article Xarray as needed. WARNING: This code did not go through beta. Use at your own Xrisk. X XBSD_42 (undefined) X X If you have a 4.2 BSD system (as opposed to a 4.3 BSD system), Xthis needs to be defined. Really it does only two things: changes Xthe log level to be compatible with 4.2, and automatically defines XDBM (below). If, somehow, you already have ndbm, then you should Xkill the lines which auto-define it. X XCMU_MACH (undefined) X Define if you are running CMU's MACH. NeXT is handled as a BSD_43 Xmachine. X XUSG (undefined) X X Compiles in code to support System V; some of these appear down Xbelow. X XTLI (undefined) X Compiles in code to support the Transport Layer Interface of System V XRelease 3 and later. [This code does not work yet, but will work in NNTP 1.6.] X X**** The following four definitions have to do with the format of the **** X**** news history file. You must select the same format for NNTP that **** X**** you chose when you built your news software. If you don't, NNTP **** X**** will NOT WORK!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! **** X XDBM (undefined) X X If you don't have the ndbm routines in your standard library (i.e., Xif you're not running 4.3 BSD), you'll have to define this; all it Xdoes is replace the ndbm calls with the earlier, unwieldy dbm calls. X X>>> If you define DBM, be sure to edit server/Makefile to have "-ldbm" X>>> on the LIBS line, i.e. X X LIBS = -ldbm X[This does not apply if you are compiling on the SGI IRIX platform.] X X XNDBM (defined) X X Define if you have the 4.3BSD ndbm routines and used them to build your Xnews software. X XDBZ (undefined) X Define this is you are using the DBZ libraries. If you DO define this, Xyou will need to make alterations to makefile to insure that things will work. XIf you built your news software using DBZ, you MUST build NNTP with DBZ. Many Xpeople have success by use the cnews library as a link library. X XUSGHIST (undefined) X X Define if you don't use dbm/ndbm for the history file, but instead Xyou use the USG-style history file format. IF YOU DO NOT DEFINE ANY OF XDBZ, DBM OR NDBM ABOVE, THIS IS THE DEFAULT. X XCNEWS (undefined) X If you're running CNEWS instead of BNEWS define this. NNTP will not Xwork with CNEWS if you don't define this. X XBATCHED_INPUT (undefined) X If this is defined, then the CNews-style batched input is used Xto collect incoming articled into a file which periodically is sent to the Xincoming news processor. X XLAI_TCP (undefined) X This should be defined if you are compiling on SCO Xenix with TCP/IP. XIt make work on other systems as well. X XEXCELAN (undefined) X This will compile in support for the EXCELAN EXOS TCP/IP routines. XIt is known to work with Unisys 5000-series computer. X XWIN_TCP (undefined) X Support for Wollongong TCP/IP for System V/386. [This code does not Xyet work. It will work in NNTP 1.6.] X XU_LONG (undefined) X Define this if your system does not know what a u_long is. X XSIGRET (defined) X This should be defined to be int or void depending on what Xsignals return on your system. SunOS 4.X, Ultrix 3.X, and IRIX return void. XMost others return int. X XGHNAME (defined) X X Defined if you want to use the 4BSD gethostname() call to Xdetermine the name of your system. This #define is only used Xby the mini-inews when posting news. Some reasons you might not Xwant to use this are: if your UUCP/news name is different than Xyour internet name; if your gethostname() currently doesn't Xreturn fully-qualified names (e.g., 4.2) but you may "upgrade" Xto 4.3 (and return fq'd names) shortly, and you'd rather not Xhave to recompile news... See UUNAME below. X XUUNAME (undefined) X X If this is defined, mini-inews will get the hostname out Xof /etc/uucpname or /local/uucpname. X X>>> If GHNAME and UUNAME are undefined, mini-inews will <<< X>>> get the host name from /usr/include/whoami.h <<< X XMMAP (undefined) X Define this if you run on a version of Unix that has the mmap() system Xcall. SunOS and Solbourne's OS/MP are two versions of Unix that do. X Xvfork (undefined) X X If you DON'T have vfork, replace this line with: X X#define vfork fork X XIf you DO have vfork, be sure that this remains undefined. X XMINFREE (4000) X This is the minimum number of kbytes or blocks (depending on what the Xsystem) that must be free on the news spool partition before nntp will allow Xan XFER command to function. X XPOSTBUFFER (1000) X NNTP will allow posting until there is less than MINFREE-POSTBUFFER Xblocks or kbytes available. This allows posting to continue while XFERs are Xstopped. X XMINFILES (MINFREE/4) X This is the minimum number of inodes that must be available on the Xnews spool partition before nntp will allow any function that will create Xmore files. If you define this, please be careful not to make it a large Xnumber. I recommend something around MINFREE/4. X XSETPROCTITLE (undefined) X This will replace the process name with information about what nntp Xis doing. This is known to work on BSD-flavored Unix, but may not work on XUSG Unix. X XIHAVE_DEBUG (undefined) X X Enables logging of each message-id as it is offered via the IHAVE Xcommand. This produces huge log files, but is useful if you suspect Xa site is repeatedly offering the same article to your site after you Xhave rejected it. X XXHDR (defined) X X Enables the XHDR command, which is an extention of the NNTP spec. XXHDR allows client programs to see header lines (e.g., subject) from Xan article or range of articles. This allows the '=' command in rn Xto be much faster, IF AND ONLY IF your server machine is fast. Since Xthis command foists off work on the server, it may be better to leave this Xundefined if your server machine is heavily loaded. X XSUBNET (defined) X X If you are running 4.3 BSD or have support for subnets on Xyour local net, this will include subnet support for the access Xfile. Basically, a routine goes out and looks at all your ethernet Xinterfaces, and figures out subnet masks from them. It then Xuses these to resolve subnets from IP addresses. X XDAMAGED_NETMASK (undefined) X X 4.3 supports subnet masks of any bit-width, but user programs Xare *very* hard pressed to deal with masks which are not a multiple Xof 8 bits wide. If you have a weird netmask, define DAMAGED_NETMASK. XThe code which uses it is in server/subnet.c. X XNETMASK (undefined) X X The code in server/subnet.c wants to use 4BSD ioctls to determine Xthe subnet masks for each network interface. However, you may be able Xto support subnets without having such ioctls (HPUX is an example of Xsuch a system; SunOS 3.3 is another). If you will be satisfied by Xhaving a compiled-in netmask, define NETMASK to be a hex constant Xdescribing your netmask (e.g., 0xffffff00). You must also define XSUBNET as well. X XDECNET (undefined) X X Compile in DECNET support into the server and clientlib. XThis works under Ultrix (and not VMS!). X XUMASK (undefined) X This should be defined if you are running CNEWS and are concerned Xthat batch files may be created that can be altered by anyone. Defining Xthis as 022 should work safely for most systems, but experiment to be Xsure. X XDOMAINMATCH (defined) X Defined to allow the use of domain specifications in the nntp access Xfile. Specifications for domains are of the form *.domain.name and can be Xused instead of individually naming hosts or networks. X XFAKESYSLOG (undefined) X X This is useful if your system doesn't support syslog, but you'd Xlike logging none the less. By defining FAKESYSLOG to be the name of Xa file, e.g., "/usr/lib/news/nntplog", you can have all nntp messages Xlogged to that file, ala syslog. If you define FAKESYSLOG, you must Xdefine LOG and SYSLOG, below. The code for the fake syslog routines Xare in ../server/fakesyslog.c, and are largely joe-code. X XFAKEAPPEND (undefined) X If your host supports the BSD fdopen() function and the O_APPEND flag Xto open(), you should define FAKEAPPEND with FAKESYSLOG so that Xmultiple copies of nntpd don't trash the log with buffered fprintf's. XNOTE: FAKEAPPEND does nothing if FAKESYSLOG is not defined. X XSYSLOG (LOG_NEWS) X X nntpd uses the syslog system to report errors, and optionally, to Xlog usage statistics. If SYSLOG is defined, errors will be Xreported via the syslog() library routine; if it is not defined, no errors Xwill be reported. X X If you just define SYSLOG, only errors will be reported. If you Xwant more information, such as statistics, you should define LOG, below. XDefining LOG will cause additional information besides errors to be Xlogged via SYSLOG. X X If you have syslog(), define SYSLOG to be the name of the facility Xunder which nntpd should log things. If you are using FAKESYSLOG Xabove, it really doesn't matter what facility name you choose; LOG_NEWS Xis fine. X XLOG (undefined) X X When LOG is defined, we log copious amounts of information via Xsyslog to a special file. One a busy system like ucbvax, this produces Xabout 100K of log information per day. Look in ../server/SYSLOG to Xget an idea of what will be logged. You can use the scripts Xprovided in ../support to produce statistics on your NNTP server if Xyou run with LOG. X XTIMEOUT (2 hours) X X If a server is idle in command mode for TIMEOUT amount of time, Xit will close the connection with an error message. This prevents Xold servers from clogging the system. Timeout should be at least two Xhours so people can go eat lunch and leave an rn on their terminal. X XXFER_TIMEOUT (30 minutes) X X This is like TIMEOUT, above, but takes effect when the server is Xreceiving news via IHAVE or POST. If at least one line is not received Xin XFER_TIMEOUT amount of time, the server aborts with an error. X XDOMAIN ("uucp") X X If domain is defined, it specifies that whatever it is defined Xas will be appended to host names; this is for posting news when Xyour hostname() doesn't return your fully-qualified domain name. XIf your hostname system call does return a fully-qualified name, Xsimply undef DOMAIN. X XHIDDENNET (undefined) X X If HIDDENNET is defined, it forces inews to interpret DOMAIN as Xa complete host name, i.e. the local host is not prepended in the From: Xheader. The Path: header is generated with only the login name, allowing Xinews on the nntp server to fill in the UUCP path. This has the effect of Xmaking all machines on a local network look, to the outside world, as a Xsingle host. X XREALDOMAIN (undefined) X Define this if you want to use gethostbyname() to get your host's Xfully qualified domain name. Useful if hostname() does not return the Xfully qualified domain name. If you define this, it will override the Xuse of HIDDENNET. X XDO_DOTDIR (defined) X If defined, mini-inews will look in the environment of the user for XDOTDIR and use $DOTDIR/.signature as the signature if it exists. If undefined Xor $DOTDIR/.signature does not exist, $HOME/.signature will be used instead. XThis is similiar to the behavior of rn. X XAUTH (defined) X X Defines whether we want to use the experimental NNTP Version 2 XAuthorization process. Read the file AUTHORIZATION in the root directory of Xthe NNTP distribution for more information. X XSERVER_FILE ("/usr/local/lib/rn/server") X X This file contains the name of the machine which runs the Xnews server. Mini-inews, rrn, and getactive all use the contents Xof this file. The idea behind this is that you don't have to have the server Xcompiled into anything, and can have the same binaries across Xmachines which have different news servers. X X You must edit this file, and add a single line which contains Xthe name of the news server for each machine which runs rrn. X X If you have multiple news servers on your network, users can Xselect which one they want to use via the NNTPSERVER environment Xvariable, which will override the contents of SERVER_FILE. Simply Xset NNTPSERVER to be the name of the machine whose news server you Xwant to use. X X If you are afraid of people abusing a particular news server Xvia NNTPSERVER, you should edit the access file for that news server Xaccordingly. Security begins at home. X X>>> rrn, mini-inews, and getactive NO LONGER have compiled in server names <<< X>>> Be sure to create the SERVER_FILE as mentioned above, or you'll lose! <<< X XPOSTER ("usenet") X X If your nntpd is run as root, nntpd will attempt to setuid() Xand setgid() to the uid and gid of whoever POSTER is defined as. XIf your nntpd isn't running as root (i.e., it might run as "usenet"), Xeither undefine this, or define it to be a user which exists but Xis not used -- the setuid will fail in any event. X XPASSFILE (/etc/nntp.sys) X This file contains the password authentication information that the Xclient uses if AUTH is defined and in use. X XACCESS_FILE ("/usr/lib/news/nntp_access") X X Specifies the location of the remote access file. See the manual entry, Xnntpd.8c, for a better explanation. A sample access file is in X../support/access_file. X XSTAT_FILE ("/usr/lib/news/mgdstats") X X NOTE: THIS IS NOT USED, BUT REMAINS FOR COMPATABILITY. X When the support program "mkgrdates" is run, it keep stats X in a file to tell whether or not to rebuild its database X the next time it is run; this is the file the stats are kept X in. Needless to say, it must be writable by whatever user-id X runs "mkgrdates". See the manual entry "mkgrdates.8c" for X more info. X XNGDATE_FILE ("/usr/lib/news/groupdates") X X NOTE: THIS IS NOT USED, BUT REMAINS FOR COMPATABILITY. X Specifies the location of the newsgroup creation date file. X See the manual entry for both nntpd.8c and mkgrdates.8c for X more info. X XACTIVE_TIMES_FILE ("/usr/lib/news/active.times") X This needs to be defined if you defined CNEWS. It is a CNEWS-maintained Xversion of the NGDATE_FILE. Since it is supported by CNEWS itself, it means Xthe NEWGROUPS will actually work. Hurrah! X XNext, we have some common files: X XACTIVE_FILE ("/usr/lib/news/active") X X Specifies the location of the "active" file. X XDISTRIBUTIONS_FILE ("/usr/lib/news/distributions") X Specifies the location of the file that defines valid distributions for Xthis site. The format of the file is usually the name of the distribution X(e.g. "tx" for the state of Texas), some spaces or a tab, and a short descrip- Xtion of the area that the distribution covers (e.g. "The State of Texas"). This Xis used by the "LIST DISTRIBUTIONS" command. X XNEWSGROUPS_FILE ("/usr/lib/news/newsgroups") X Specifies the location of the file that contains newsgroup descriptions. XThe format of the file is usually the name of the newsgroup, a tab, and a short Xdescription of the newsgroup (usually from the checkgroups control message). XThis file is used by the "LIST NEWSGROUPS" command. X XHISTORY_FILE ("/usr/lib/news/history") X X Specifies the location of the "history" file. This is used with NEWNEWS Xand ARTICLE/HEAD/BODY/STAT when given an message-id argument. X XINEWS ("/usr/lib/news/inews") X X Specifies the location of inews, for posting. Note that this is NOT the Xsame as the mini-inews in the inews directory supplied with the NNTP Xdistribution, which should only be installed on client machines. INEWS should Xbe the pathname of real, live, honest-to-God inews. Your inews may be Xin a different place, such as /usr/bin/inews. X XSPOOLDIR ("/usr/spool/news") X X This is the directory where news is stored on the server. X XRNEWS ("/usr/bin/rnews") X X Specifies the location of the rnews program which is used for dealing with Xnews received from other systems via the IHAVE command; it is often a link to Xinews. X X---- The following variables apply only if you are using C News batching. ---- XNONEWSRUN (undefined) X Define this only if you plan to use the daemon version of relaynews. X XTOOBIG (300000, unless NONEWSRUN is defined) X Under CNews-style batching, a file that is larger than this gets Xsent to be unbatched. (Size is in bytes.) X XTOOMANY (1024, unless NONEWSRUN is defined) X Under CNews-style batching, if the number of batched articles is Xbigger than this, the batch file gets unbatched. X XTOOOLD (5 minutes) X Under CNews-style batching, a file that is older than this gets Xsent to be unbatched. X XCOPYSIZE (8192) X Under CNews-style batching, the number of bytes to copy at one time. X XMAXDIGITS (25) X X XMAXSTR (1024) X XINDIR ("/usr/spool/news/in.coming") X Under CNews-style batching, the directory in which the batching takes Xplace. X XBATCH_FILE ("/usr/spool/news/in.coming/nntp.XXXXXX") X The filename template for batch files under CNews-style batching. X XNEWSRUN ("/usr/lib/newsbin/input/newsrun") X The name of the program to which batch files are fed once they are Xcreated under CNews-style unbatching. X_________________________________________________________________________ XLook carefully before modifying any of these!!!!!!!!!!!!!!!!!!!!!!!!!!!!! X------------------------------------------------------------------------- X XFCNTL (defined if SYSV is defined) X X Some systems define things like O_RDONLY, etc. in <fcntl.h>. XIf FCNTL is defined, <fcntl.h> will be included. X XFTRUNCATE (defined if dgux) X Use ftruncate() even if this is a System V like machine. X XNDIR (defined if USG is defined) X Uses the ndir compatability library, and includes <ndir.h>. X XREADINTVL (600 seconds) X X If the server is compiled with FASTFORK and ALONE, then this number Xtells how often to check if the active file has changed (and to read it in if Xit has changed since the last time). See README in the "server" directory of Xthe NNTP distribution. If you are not compiled with FASTFORK and ALONE X(hint: you're not going to), don't worry about this. X XMAX_ARTICLES (4096) X This is the maximum articles per newsgroup that nntp can handle Xif DYNAMIC_ART_ARRAY is not defined. SHAR_EOF if test 20055 -ne "`wc -c < 'README'`" then echo shar: error transmitting "'README'" '(should have been 20055 characters)' fi echo shar: extracting "'conf.h.dist'" '(11155 characters)' sed 's/^ X//' << \SHAR_EOF > 'conf.h.dist' X/* $Header: conf.h.dist,v 1.9 91/02/08 18:31:01 sob Exp $ X * Configuration information for use by NNTP server and support X * programs. Change these as appropriate for your system. X */ X X/* X * Compile time options. X */ X X X#undef ALONE /* True if we're running without inetd */ X X#ifdef ALONE X#undef FASTFORK /* True if we don't want to read active file on start*/ X#endif X X#define LOAD 5 /* Loadav above which server refuses connections */ X/* X * If you want to experiment with the dynamic allocation of the article X * array, define DYNAMIC_ART_ARRAY. X * This code came to beta too late for through testing, but it is a problem X * at some sites, so it is an option. Please report problems to "nntp@tmc.edu" X */ X#undef DYNAMIC_ART_ARRAY X X#undef BSD_42 /* 4.2 compatability code -- if this is defined, */ X /* DBM probably wants to be defined as well. */ X X#define BSD_43 /* Define if you are running on BSD 4.3 */ X X#undef CMU_MACH /* Use CMU's MACH ioctl(FIOCFSPARAM) for dfree(). */ X X#undef USG /* System V support */ X X#undef TLI /* Define this if you want to use TLI instead of */ X /* sockets */ X X#define NDBM /* Use new-style (4.3) ndbm(3x) libraries */ X X#undef DBM /* True if we want to use the old dbm(3x) libraries */ X /* IF YOU DEFINE THIS, change CFLAGS in makefile to */ X /* be -ldbm */ X X#undef DBZ /* True if we want to use dbz libraries */ X /* IF YOU DEFINE THIS, change CFLAGS in makefile to */ X /* be /usr/lib/dbz.o and install dbz.h */ X X#undef USGHIST /* Use USG style history file (no DBM) */ X /* IF YOU DO NOT DEFINE NDBM or DBM, this is DEFAULT!*/ X X#undef CNEWS /* define this if you are running C-NEWS */ X#undef BATCHED_INPUT /* define if you want to support C-NEWS style X batched input (not supported by B-NEWS,yet) */ X X/* Vendor specific implementations */ X#undef LAI_TCP /* Lachman Streams TCP/IP support (Xenix) */ X#undef EXCELAN /* Excelan EXOS 205 support */ X#undef WIN_TCP /* WIN/TCP support [does not work yet] */ X X/* Things that vary in Unix variations */ X#undef U_LONG /* Define this if your <sys/types.h> is missing */ X /* typedefs for u_long */ X#define SIGRET void /* Newfangled signal() returns void, old returns int */ X X#define GHNAME /* Define if you have gethostname() */ X#undef UUNAME /* Define to use /etc/uucpname */ X /* If neither of these are defined, */ X /* inews will use the contents of */ X /* /usr/include/whoami.h */ X X#undef MMAP /* if your OS supports mmap() */ X X/* X * If you DON'T have vfork, make this "#define vfork fork" X * vfork will speed up article transfer nntpds by about 2.5 times. X */ X X/* #define vfork fork */ X X/* Controlling disk and inode consumption */ X#define MINFREE 4000 /* NNTP will not allow an XFER if there is less */ X /* than this much diskspace (in blocks or kbytes) */ X#define POSTBUFFER 1000 /* NNTP will allow local posting until */ X /* MINFREE-POSTBUFFER blocks or kbytes are left */ X#undef MINFILES MINFREE/4 X /* NNTP will not allow an XFER if there is less */ X /* than this many inodes on the SPOOLDIR filesystem */ X#undef SETPROCTITLE /* if you want status visable via ps */ X X#undef IHAVE_DEBUG /* Copious debugging output from ihave */ X X#define XHDR /* Optional XHDR command. Defining this will */ X /* speed up '=' command in rn, but will load */ X /* the server more. If your server is heavily */ X /* loaded already, defining this may be a bad idea */ X X/* Things that vary in network implementations */ X#define SUBNET /* If you have 4.3 subnetting */ X#undef DAMAGED_NETMASK /* If your subnet mask is not a multiple of */ X /* four bits (e.g., UCSD) */ X X#undef NETMASK /* If you don't have subnet ioctls, define */ X /* this to be a hex constant of your subnet */ X /* mask, e.g., #define NETMASK 0xffffff00 */ X /* Of course, you must define SUBNET above, too. */ X#undef DECNET /* If you want decnet support */ X X/* X * If you want CNEWS batch files created that are not world writable, X * remove the comments from the UMASK line below. This does not apply X * if you are running BNEWS. At least, not yet. :-) X */ X X/* #define UMASK 022 */ X X/* X * If you have the syslog library routine, define SYSLOG to X * be the syslog facility name under which stats should be X * logged. Newer 4.3 systems might choose LOG_NEWS; X * LOG_LOCAL7 is an acceptable substitute. X * X * If you don't have support for syslog, but want a facsimile, X * define FAKESYSLOG to be the name of a file to which to log stuff, X * then define SYSLOG and LOG, too. e.g., X * X * #define FAKESYSLOG "/usr/lib/news/nntplog" X * X * If your host supports the BSD fdopen() function and the O_APPEND flag X * to open(), you should define FAKEAPPEND with FAKESYSLOG so that X * multiple copies of nntpd don't trash the log with buffered fprintf's. X * X * If you don't want any syslog-type activity, #undef SYSLOG. X * Obviously, this means that you can't define LOG, either. X */ X X#undef FAKESYSLOG "/usr/lib/news/nntplog" X#undef FAKEAPPEND X X#define SYSLOG LOG_NEWS X X#ifdef SYSLOG /* Define LOG if you want copious logging info */ X#undef LOG /* undef it if you don't */ X#endif /* but you can only have LOG if you have SYSLOG */ X X/* X * How long you want nntp servers to hang out without receiving X * commands before they close the connection with an error message. X * X * If you don't want any timeout, #undef it, i.e., X * X * #undef TIMEOUT X * X * TIMEOUT should be at least two hours, which allows users some time X * away from their terminal (e.g., at lunch) while reading news. X */ X X#define TIMEOUT (2 * 3600) X X X/* X * How long you want nntp servers to wait without receiving data X * during article transfers. You CANNOT have XFER_TIMEOUT while X * running in standalone (ALONE) mode. X * X * If you don't want any transfer timeouts, #undef it, as above. X */ X X#ifndef ALONE X# define XFER_TIMEOUT (30 * 60) X#endif ALONE X X/* X * Your domain. This is for the inews generated From: line, X * assuming that it doesn't find one in the article's head. X * Suggestions are .UUCP if you don't belong to the Internet. X * If your hostname returns the fully-qualified domain name X * as some 4.3 BSD systems do, simply undefine DOMAIN. X * If you want your network to appear to be one host, define X * HIDDENNET. X * X * e.g. #define DOMAIN "berkeley.edu" X */ X X#define DOMAIN "uucp" X#undef HIDDENNET X X/* X * Means do a gethostbyname() to get the canonical host name. X * Define this and HIDDENNET will have no effect. X */ X X#undef REALDOMAIN X X/* X * Define DO_DOTDIR if you want the mini-inews to look for X * this directory if defined in the environment. This is like rn. X * Undefine it and it will only look in the user's home directory. X */ X#define DO_DOTDIR X X/* Things that relate to authentication and access */ X/* Define AUTH to use the proposed NNTP Version 2 authentication protocol. */ X#define AUTH X/* X * A file containing the name of the host which is running X * the news server. This will have to match what rrn thinks, X * too. X */ X X#define SERVER_FILE "/usr/local/lib/rn/server" X X/* X * Person (user name) to post news as. X */ X X#define POSTER "usenet" X X/* X * Define DOMAINMATCH if you want to use domain specifications in the X * access list instead of just hostnames. See README for more information X */ X#define DOMAINMATCH X X#ifdef AUTH X/* X * the file where the nntpxmit site/userid/passwords are kept X * think (and PROTECT!) this file like L.sys, i.e., mode 600 X */ X# define PASSFILE "/etc/nntp.sys" X#endif X/* X * This file is where access information is stored X */ X#define ACCESS_FILE "/usr/lib/news/nntp_access" X/* X * These files are generated by the support programs, and are needed X * by the NNTP server. Make sure that whatever directory you X * decide these files should go is writable by whatever uid you X * have the sypport programs run under. X */ X# define STAT_FILE "/usr/lib/news/mgdstats" X# define NGDATE_FILE "/usr/lib/news/groupdates" X/* X * But if you have C News, you can define ACTIVE_TIMES_FILE instead of X * STAT_FILE and NGDATE_FILE, and you won't have to run "mkgrdates". X */ X X# define ACTIVE_TIMES_FILE "/usr/lib/news/active.times" X X/* X * Some commonly used programs and files. X */ X X#define ACTIVE_FILE "/usr/lib/news/active" X#define DISTRIBUTIONS_FILE "/usr/lib/news/distributions" X#define NEWSGROUPS_FILE "/usr/lib/news/newsgroups" X#define HISTORY_FILE "/usr/lib/news/history" X#define SPOOLDIR "/usr/spool/news" X#define INEWS "/usr/lib/news/inews" X#define RNEWS "/usr/bin/rnews" /* Link to inews? */ X X/* X * Support for C-News style batching X */ X#undef NONEWSRUN /* define this if you are using the daemon */ X /* version of relaynews */ X#ifdef NONEWSRUN X#define TOOBIG 1L X#define TOOMANY 1 X#else X#define TOOBIG 300000L /* batch > TOOBIG bytes, kick rnews */ X#define TOOMANY 1024 /* batch > TOOMANY articles, kick rnews */ X#define NEWSRUN "/usr/lib/newsbin/input/newsrun" X#endif X#define TOOOLD (5*60) /* batch > TOOOLD seconds old, kick rnews */ X#define COPYSIZE 8192 /* bytes to copy at one time */ X#define MAXDIGITS 25 /* lg(maxlongint) + epsilon */ X#define MAXSTR 1024 X#define INDIR "/usr/spool/news/in.coming" X/* You may wish to delete the pathname from the front of BATCH_FILE */ X#define BATCH_FILE "/usr/spool/news/in.coming/nntp.XXXXXX" X X/************************************************************************/ X/* We don't recommend that you make changes in anything after this line */ X/************************************************************************/ X X#ifdef DBZ /* If you use DBZ, then you need DBM as well. */ X#ifndef DBM X#define DBM X#endif /* DBM */ X#endif /* DBZ */ X X#ifdef BSD_42 /* This is a logical, warranted assumption */ X# ifndef DBM /* which will probably get me in trouble. */ X# define DBM /* Kill it if you have 4.2 *and* ndbm. */ X# endif not DBM X# ifndef sun /* not a sun */ X# ifndef ultrix /* not ultrix */ X# ifndef CMU_MACH /* not CMU's Mach */ X# ifndef NeXT /* not a NeXT */ X# ifndef READ_SUPER X# define READ_SUPER /* read super block for space() */ X# endif X# endif X# endif X# endif X# endif X#endif BSD_42 X X#ifndef USG X# ifndef BSD_42 X# ifndef CMU_MACH X# ifndef BSD_43 X# define BSD_43 X# endif X# endif X# endif X#endif X X#ifdef BSD_43 /* And now more assumptions! */ X# ifndef sun X# ifndef ultrix /* Ultrix 4.0 or greater */ X# ifndef READ_SUPER X# define READ_SUPER X# endif X# endif X# endif X# ifndef DBZ X# ifndef DBM X# ifndef NDBM X# define NDBM X# endif X# endif X# endif X#endif X X/* X * System V compatability X */ X X#ifdef USG X# define FCNTL /* If O_etc is defined in <fcntl.h> */ X#ifdef dgux X#define FTRUNCATE X#else X# define NDIR /* If you need ndir library support */ X#ifdef hpux X#define DIRSIZ_MACRO X#endif X#endif X# define index strchr X# define rindex strrchr X# ifdef U_LONG X typedef unsigned long u_long; X typedef unsigned short u_short; X# endif U_LONG X# define IPPORT_NNTP 119 X#endif USG X X X/* X * Some miscellaneous stuff you probably don't want to change. X */ X X#define MAX_ARTICLES 4096 /* Maximum number of articles/group */ X#define READINTVL 60 * 10 /* 10 minutes b/n chking active file */ X X SHAR_EOF if test 11155 -ne "`wc -c < 'conf.h.dist'`" then echo shar: error transmitting "'conf.h.dist'" '(should have been 11155 characters)' fi echo shar: extracting "'common.diff'" '(16679 characters)' if test -f 'common.diff' then echo shar: will not over-write existing file "'common.diff'" else sed 's/^ X//' << \SHAR_EOF > 'common.diff' X*** README.SYSV Wed Jul 4 18:42:16 1990 X--- ../../nntp/common/README.SYSV Mon Feb 4 02:33:48 1991 X*************** X*** 26,32 X If you have problems, send mail to sob@tmc.edu and he will help if he X can. X X! Stan Barber (update 3/11/90) X X P.S. For those of you with SVR3, we are still working on that. X X X--- 26,32 ----- X If you have problems, send mail to sob@tmc.edu and he will help if he X can. X X! Stan Barber (update 1/21/91) X X P.S. For those of you with SVR3, we are still working on that. We expect to X have it working fully in NNTP 1.6. If you have sockets, this version will X*************** X*** 28,32 X X Stan Barber (update 3/11/90) X X! P.S. For those of you with SVR3, we are still working on that. X X X--- 28,38 ----- X X Stan Barber (update 1/21/91) X X! P.S. For those of you with SVR3, we are still working on that. We expect to X! have it working fully in NNTP 1.6. If you have sockets, this version will X! most likely work, but may require some effort. A first attempt at supporting X! TLI for clients is in the clientlib.c file. It does not work as yet. People X! are encouraged to work with it and send me their fixes. X! X! X XIndex: clientlib.c XPrereq: 1.11 X*** clientlib.c Wed Jul 4 18:41:07 1990 X--- ../../nntp/common/clientlib.c Sat Jan 12 15:12:59 1991 X*************** X*** 1,5 X #ifndef lint X! static char *sccsid = "@(#)clientlib.c 1.11 (Berkeley) 10/27/89"; X #endif X X /* X X--- 1,5 ----- X #ifndef lint X! static char *rcsid = "@(#)$Header: clientlib.c,v 1.16 91/01/12 15:12:37 sob Exp $"; X #endif X X /* X*************** X*** 3,8 X #endif X X /* X * NNTP client routines. X */ X X X--- 3,22 ----- X #endif X X /* X+ * This software is Copyright 1991 by Stan Barber. X+ * X+ * Permission is hereby granted to copy, reproduce, redistribute or otherwise X+ * use this software as long as: there is no monetary profit gained X+ * specifically from the use or reproduction or this software, it is not X+ * sold, rented, traded or otherwise marketed, and this copyright notice is X+ * included prominently in any copy made. X+ * X+ * The author make no claims as to the fitness or correctness of this software X+ * for any use whatsoever, and it is provided as is. Any use of this software X+ * is at the user's own risk. X+ * X+ */ X+ /* X * NNTP client routines. X */ X X*************** X*** 12,18 X X #ifdef NNTPSRC X #include "../common/conf.h" X! #endif NNTPSRC X X #include <stdio.h> X #include <sys/types.h> X X--- 26,32 ----- X X #ifdef NNTPSRC X #include "../common/conf.h" X! #endif /* NNTPSRC */ X X #include <stdio.h> X #include <sys/types.h> X*************** X*** 16,21 X X #include <stdio.h> X #include <sys/types.h> X #include <sys/socket.h> X #include <netinet/in.h> X #ifndef EXCELAN X X--- 30,49 ----- X X #include <stdio.h> X #include <sys/types.h> X+ #include <ctype.h> X+ #ifdef TLI X+ #include <fcntl.h> X+ #include <tiuser.h> X+ #include <stropts.h> X+ #include <sys/socket.h> X+ #ifdef WIN_TCP X+ #include <sys/in.h> X+ #else X+ #include <netinet/in.h> X+ #endif X+ # define IPPORT_NNTP ((unsigned short) 119) X+ # include <netdb.h> /* All TLI implementations may not have this */ X+ #else /* !TLI */ X #include <sys/socket.h> X #include <netinet/in.h> X #ifndef EXCELAN X*************** X*** 20,26 X #include <netinet/in.h> X #ifndef EXCELAN X # include <netdb.h> X! #endif not EXCELAN X X #ifdef USG X # define index strchr X X--- 48,55 ----- X #include <netinet/in.h> X #ifndef EXCELAN X # include <netdb.h> X! #endif /* !EXCELAN */ X! #endif /* !TLI */ X X #ifdef USG X # define index strchr X*************** X*** 26,32 X # define index strchr X # define bcopy(a,b,c) memcpy(b,a,c) X # define bzero(a,b) memset(a,'\0',b) X! #endif USG X X #ifdef EXCELAN X # define IPPORT_NNTP 119 X X--- 55,61 ----- X # define index strchr X # define bcopy(a,b,c) memcpy(b,a,c) X # define bzero(a,b) memset(a,'\0',b) X! #endif /* USG */ X X #ifdef EXCELAN X # define IPPORT_NNTP ((unsigned short) 119) X*************** X*** 29,35 X #endif USG X X #ifdef EXCELAN X! # define IPPORT_NNTP 119 X #endif X X #ifdef DECNET X X--- 58,70 ----- X #endif /* USG */ X X #ifdef EXCELAN X! # define IPPORT_NNTP ((unsigned short) 119) X! #if __STDC__ X! int connect(int, struct sockaddr *); X! unsigned short htons(unsigned short); X! unsigned long rhost(char **); X! int rresvport( int ); X! int socket( int, struct sockproto *, struct sockaddr_in *, int ); X #endif X #endif X X*************** X*** 31,36 X #ifdef EXCELAN X # define IPPORT_NNTP 119 X #endif X X #ifdef DECNET X #include <netdnet/dn.h> X X--- 66,72 ----- X int rresvport( int ); X int socket( int, struct sockproto *, struct sockaddr_in *, int ); X #endif X+ #endif X X #ifdef DECNET X #include <netdnet/dn.h> X*************** X*** 35,41 X #ifdef DECNET X #include <netdnet/dn.h> X #include <netdnet/dnetdb.h> X! #endif DECNET X X #include "nntp.h" X X X--- 71,77 ----- X #ifdef DECNET X #include <netdnet/dn.h> X #include <netdnet/dnetdb.h> X! #endif /* DECNET */ X X #include "nntp.h" X X*************** X*** 143,148 X } X X sockt_wr = dup(sockt_rd); X if ((ser_wr_fp = fdopen(sockt_wr, "w")) == NULL) { X perror("server_init: fdopen #2"); X ser_rd_fp = NULL; /* from above */ X X--- 179,191 ----- X } X X sockt_wr = dup(sockt_rd); X+ #ifdef TLI X+ if (t_sync(sockt_rd) < 0){ /* Sync up new fd with TLI */ X+ t_error("server_init: t_sync"); X+ ser_rd_fp = NULL; /* from above */ X+ return (-1); X+ } X+ #endif X if ((ser_wr_fp = fdopen(sockt_wr, "w")) == NULL) { X perror("server_init: fdopen #2"); X ser_rd_fp = NULL; /* from above */ X*************** X*** 170,176 X */ X X get_tcp_socket(machine) X! char *machine; X { X int s; X struct sockaddr_in sin; X X--- 213,219 ----- X */ X X get_tcp_socket(machine) X! char *machine; /* remote host */ X { X int s; X struct sockaddr_in sin; X*************** X*** 174,179 X { X int s; X struct sockaddr_in sin; X #ifndef EXCELAN X struct servent *getservbyname(), *sp; X struct hostent *gethostbyname(), *hp; X X--- 217,295 ----- X { X int s; X struct sockaddr_in sin; X+ #ifdef TLI X+ char *t_alloc(); X+ struct t_call *callptr; X+ /* X+ * Create a TCP transport endpoint. X+ */ X+ if ((s = t_open("/dev/tcp", O_RDWR, (struct t_info*) 0)) < 0){ X+ t_error("t_open: can't t_open /dev/tcp"); X+ return(-1); X+ } X+ if(t_bind(s, (struct t_bind *)0, (struct t_bind *)0) < 0){ X+ t_error("t_bind"); X+ t_close(s); X+ return(-1); X+ } X+ bzero((char *) &sin, sizeof(sin)); X+ sin.sin_family = AF_INET; X+ sin.sin_port = htons(IPPORT_NNTP); X+ if (!isdigit(*machine) || X+ (long)(sin.sin_addr.s_addr = inet_addr(machine)) == -1){ X+ struct hostent *gethostbyname(), *hp; X+ if((hp = gethostbyname(machine)) == NULL){ X+ fprintf(stderr,"gethostbyname: %s: host unknown\n", X+ machine); X+ t_close(s); X+ return(-1); X+ } X+ bcopy(hp->h_addr, (char *) &sin.sin_addr, hp->h_length); X+ } X+ /* X+ * Allocate a t_call structure and initialize it. X+ * Let t_alloc() initialize the addr structure of the t_call structure. X+ */ X+ if ((callptr = (struct t_call *) t_alloc(s,T_CALL,T_ADDR)) == NULL){ X+ t_error("t_alloc"); X+ t_close(s); X+ return(-1); X+ } X+ X+ callptr->addr.maxlen = sizeof(sin); X+ callptr->addr.len = sizeof(sin); X+ callptr->addr.buf = (char *) &sin; X+ callptr->opt.len = 0; /* no options */ X+ callptr->udata.len = 0; /* no user data with connect */ X+ X+ /* X+ * Connect to the server. X+ */ X+ if (t_connect(s, callptr, (struct t_call *) 0) < 0) { X+ t_error("t_connect"); X+ t_close(s); X+ return(-1); X+ } X+ X+ /* X+ * Now replace the timod module with the tirdwr module so that X+ * standard read() and write() system calls can be used on the X+ * descriptor. X+ */ X+ X+ if (ioctl(s, I_POP, (char *) 0) < 0){ X+ perror("I_POP(timod)"); X+ t_close(s); X+ return(-1); X+ } X+ X+ if (ioctl(s, I_PUSH, "tirdwr") < 0){ X+ perror("I_PUSH(tirdwr)"); X+ t_close(s); X+ return(-1); X+ } X+ X+ #else /* !TLI */ X #ifndef EXCELAN X struct servent *getservbyname(), *sp; X struct hostent *gethostbyname(), *hp; X*************** X*** 180,186 X #ifdef h_addr X int x = 0; X register char **cp; X! #endif h_addr X X if ((sp = getservbyname("nntp", "tcp")) == NULL) { X fprintf(stderr, "nntp/tcp: Unknown service.\n"); X X--- 296,307 ----- X #ifdef h_addr X int x = 0; X register char **cp; X! static char *alist[1]; X! #endif /* h_addr */ X! unsigned long inet_addr(); X! static struct hostent def; X! static struct in_addr defaddr; X! static char namebuf[ 256 ]; X X if ((sp = getservbyname("nntp", "tcp")) == NULL) { X fprintf(stderr, "nntp/tcp: Unknown service.\n"); X*************** X*** 186,207 X fprintf(stderr, "nntp/tcp: Unknown service.\n"); X return (-1); X } X! X! /* X! * Name resolution doesn't quite go as far as it should. Take things X! * one stage further to allow nnn.nnn.nnn.nnn addresses if all else X! * fails. X! */ X! if( (hp = gethostbyname( machine ) ) == NULL ) { X! unsigned long inet_addr(); X! static struct hostent def; X! static struct in_addr defaddr; X! static char *alist[1]; X! static char namebuf[ 256 ]; X! defaddr.s_addr = inet_addr( machine ); X! if( defaddr.s_addr != -1 ) { X! strcpy( namebuf, machine ); X! def.h_name = namebuf; X #ifdef h_addr X def.h_addr_list = alist; X #endif X X--- 307,320 ----- X fprintf(stderr, "nntp/tcp: Unknown service.\n"); X return (-1); X } X! /* If not a raw ip address, try nameserver */ X! if (!isdigit(*machine) || X! (long)(defaddr.s_addr = inet_addr(machine)) == -1) X! hp = gethostbyname(machine); X! else { X! /* Raw ip address, fake */ X! (void) strcpy(namebuf, machine); X! def.h_name = namebuf; X #ifdef h_addr X def.h_addr_list = alist; X #endif X*************** X*** 203,209 X strcpy( namebuf, machine ); X def.h_name = namebuf; X #ifdef h_addr X! def.h_addr_list = alist; X #endif X def.h_addr = (char *)&defaddr; X def.h_length = sizeof( struct in_addr ); X X--- 316,322 ----- X (void) strcpy(namebuf, machine); X def.h_name = namebuf; X #ifdef h_addr X! def.h_addr_list = alist; X #endif X def.h_addr = (char *)&defaddr; X def.h_length = sizeof(struct in_addr); X*************** X*** 205,218 X #ifdef h_addr X def.h_addr_list = alist; X #endif X! def.h_addr = (char *)&defaddr; X! def.h_length = sizeof( struct in_addr ); X! def.h_addrtype = AF_INET; X! def.h_aliases = 0; X! hp = &def; X! } X! } X! if (hp == NULL) { X fprintf(stderr, "%s: Unknown host.\n", machine); X return (-1); X } X X--- 318,330 ----- X #ifdef h_addr X def.h_addr_list = alist; X #endif X! def.h_addr = (char *)&defaddr; X! def.h_length = sizeof(struct in_addr); X! def.h_addrtype = AF_INET; X! def.h_aliases = 0; X! hp = &def; X! } X! if (hp == NULL) { X fprintf(stderr, "%s: Unknown host.\n", machine); X return (-1); X } X*************** X*** 220,226 X bzero((char *) &sin, sizeof(sin)); X sin.sin_family = hp->h_addrtype; X sin.sin_port = sp->s_port; X! #else EXCELAN X bzero((char *) &sin, sizeof(sin)); X sin.sin_family = AF_INET; X sin.sin_port = htons(IPPORT_NNTP); X X--- 332,338 ----- X bzero((char *) &sin, sizeof(sin)); X sin.sin_family = hp->h_addrtype; X sin.sin_port = sp->s_port; X! #else /* EXCELAN */ X bzero((char *) &sin, sizeof(sin)); X sin.sin_family = AF_INET; X #endif /* EXCELAN */ X*************** X*** 223,230 X #else EXCELAN X bzero((char *) &sin, sizeof(sin)); X sin.sin_family = AF_INET; X! sin.sin_port = htons(IPPORT_NNTP); X! #endif EXCELAN X X /* X * The following is kinda gross. The name server under 4.3 X X--- 335,341 ----- X #else /* EXCELAN */ X bzero((char *) &sin, sizeof(sin)); X sin.sin_family = AF_INET; X! #endif /* EXCELAN */ X X /* X * The following is kinda gross. The name server under 4.3 X*************** X*** 263,269 X } X #else /* no name server */ X #ifdef EXCELAN X! if ((s = rresvport(SO_KEEPALIVE)) < 0) X { X /* Get the socket */ X perror("socket"); X X--- 374,380 ----- X } X #else /* no name server */ X #ifdef EXCELAN X! if ((s = socket(SOCK_STREAM,(struct sockproto *)NULL,&sin,SO_KEEPALIVE)) < 0) X { X /* Get the socket */ X perror("socket"); X*************** X*** 269,274 X perror("socket"); X return (-1); X } X /* set up addr for the connect */ X sin.sin_addr.s_addr = rhost(machine); X if (sin.sin_addr.s_addr < 0){ X X--- 380,388 ----- X perror("socket"); X return (-1); X } X+ bzero((char *) &sin, sizeof(sin)); X+ sin.sin_family = AF_INET; X+ sin.sin_port = htons(IPPORT_NNTP); X /* set up addr for the connect */ X X if ((sin.sin_addr.s_addr = rhost(&machine)) == -1) { X*************** X*** 270,277 X return (-1); X } X /* set up addr for the connect */ X! sin.sin_addr.s_addr = rhost(machine); X! if (sin.sin_addr.s_addr < 0){ X fprintf(stderr, "%s: Unknown host.\n", machine); X return (-1); X } X X--- 384,391 ----- X sin.sin_family = AF_INET; X sin.sin_port = htons(IPPORT_NNTP); X /* set up addr for the connect */ X! X! if ((sin.sin_addr.s_addr = rhost(&machine)) == -1) { X fprintf(stderr, "%s: Unknown host.\n", machine); X return (-1); X } X*************** X*** 277,283 X } X /* And then connect */ X X! if (connect(s, &sin) < 0) { X perror("connect"); X (void) close(s); X return (-1); X X--- 391,397 ----- X } X /* And then connect */ X X! if (connect(s, (struct sockaddr *)&sin) < 0) { X perror("connect"); X (void) close(s); X return (-1); X*************** X*** 282,288 X (void) close(s); X return (-1); X } X! #else not EXCELAN X if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) { X perror("socket"); X return (-1); X X--- 396,402 ----- X (void) close(s); X return (-1); X } X! #else /* not EXCELAN */ X if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) { X perror("socket"); X return (-1); X*************** X*** 297,305 X return (-1); X } X X! #endif not EXCELAN X! #endif X! X return (s); X } X X X--- 411,419 ----- X return (-1); X } X X! #endif /* !EXCELAN */ X! #endif /* !h_addr */ X! #endif /* !TLI */ X return (s); X } X X*************** X*** 385,391 X * Parameters: "response" is the response code which the X * server sent us, presumably from "server_init", X * above. X! * "server" is the news server we got the X * response code from. X * X * Returns: -1 if the error is fatal (and we should exit). X X--- 499,505 ----- X * Parameters: "response" is the response code which the X * server sent us, presumably from "server_init", X * above. X! * "nntpserver" is the news server we got the X * response code from. X * X * Returns: -1 if the error is fatal (and we should exit). X*************** X*** 394,400 X * Side effects: None. X */ X X! handle_server_response(response, server) X int response; X char *server; X { X X--- 508,514 ----- X * Side effects: None. X */ X X! handle_server_response(response, nntpserver) X int response; X char *nntpserver; X { X*************** X*** 396,402 X X handle_server_response(response, server) X int response; X! char *server; X { X switch (response) { X case OK_NOPOST: /* fall through */ X X--- 510,516 ----- X X handle_server_response(response, nntpserver) X int response; X! char *nntpserver; X { X switch (response) { X case OK_NOPOST: /* fall through */ X*************** X*** 412,418 X case ERR_ACCESS: X printf( X "This machine does not have permission to use the %s news server.\n", X! server); X return (-1); X break; X X X--- 526,532 ----- X case ERR_ACCESS: X printf( X "This machine does not have permission to use the %s news server.\n", X! nntpserver); X return (-1); X break; X X*************** X*** 418,424 X X default: X printf("Unexpected response code from %s news server: %d\n", X! server, response); X return (-1); X break; X } X X--- 532,538 ----- X X default: X printf("Unexpected response code from %s news server: %d\n", X! nntpserver, response); X return (-1); X break; X } X*** version.c Sat Sep 1 22:12:39 1990 X--- ../../nntp/common/version.c Sun Feb 10 14:19:43 1991 X*************** X*** 2,5 X * Provide the version number of this release. X */ X X! char nntp_version[] = "1.5.10 (2 September 1990)"; X X--- 2,5 ----- X * Provide the version number of this release. X */ X X! char nntp_version[] = "1.5.11 (10 February 1991)"; SHAR_EOF if test 16679 -ne "`wc -c < 'common.diff'`" then echo shar: error transmitting "'common.diff'" '(should have been 16679 characters)' fi fi # end of overwriting check echo shar: done with directory "'common'" cd .. # End of shell archive exit 0
nntp@tmc.edu (Stan Barber) (02/11/91)
#! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # server/server.pt1.diff # This archive created: Sun Feb 10 14:24:06 1991 export PATH; PATH=/bin:$PATH if test ! -d 'server' then echo shar: creating directory "'server'" mkdir 'server' fi echo shar: entering directory "'server'" cd 'server' echo shar: extracting "'server.pt1.diff'" '(55179 characters)' if test -f 'server.pt1.diff' then echo shar: will not over-write existing file "'server.pt1.diff'" else sed 's/^ X//' << \SHAR_EOF > 'server.pt1.diff' XIndex: ihave.c XPrereq: 1.17 X*** ihave.c Sat Aug 18 17:15:57 1990 X--- ../../nntp/server/ihave.c Sun Dec 23 11:50:00 1990 X*************** X*** 1,5 X #ifndef lint X! static char *sccsid = "@(#)$Header: ihave.c,v 1.17 90/08/18 17:15:17 sob Exp $"; X #endif X X #include "common.h" X X--- 1,5 ----- X #ifndef lint X! static char *sccsid = "@(#)$Header: ihave.c,v 1.18 90/12/23 11:49:59 sob Exp $"; X #endif X X #include "common.h" X*************** X*** 67,73 X } else X #ifdef BATCHED_INPUT X /* C news input hook */ X! retcode = batch_input_article(CONT_XFER, ERR_XFERFAIL, errbuf); X #else X retcode = spawn(rnews, "rnews", (char *) 0, CONT_XFER, X ERR_XFERFAIL, errbuf); X X--- 67,74 ----- X } else X #ifdef BATCHED_INPUT X /* C news input hook */ X! retcode = batch_input_article(CONT_XFER, ERR_XFERFAIL, X! errbuf, argv[1]); X #else X retcode = spawn(rnews, "rnews", (char *) 0, CONT_XFER, X ERR_XFERFAIL, errbuf, argv[1]); X*************** X*** 70,76 X retcode = batch_input_article(CONT_XFER, ERR_XFERFAIL, errbuf); X #else X retcode = spawn(rnews, "rnews", (char *) 0, CONT_XFER, X! ERR_XFERFAIL, errbuf); X #endif X X if (retcode <= 0){ X X--- 71,77 ----- X errbuf, argv[1]); X #else X retcode = spawn(rnews, "rnews", (char *) 0, CONT_XFER, X! ERR_XFERFAIL, errbuf, argv[1]); X #endif X X if (retcode <= 0){ X*************** X*** 89,94 X else X printf("%d Thanks.\r\n", OK_XFERED); X (void) fflush(stdout); X #ifdef LOG X if (retcode == 1) X ih_accepted++; X X--- 90,96 ----- X else X printf("%d Thanks.\r\n", OK_XFERED); X (void) fflush(stdout); X+ X #ifdef LOG X if (retcode == 1) X ih_accepted++; XIndex: main.c XPrereq: 1.15 X*** main.c Sat Aug 11 21:30:22 1990 X--- ../../nntp/server/main.c Sat Jan 12 10:54:24 1991 X*************** X*** 1,5 X #ifndef lint X! static char *sccsid = "@(#)$Header: main.c,v 1.15 90/08/11 21:29:53 sob Exp $"; X #endif X X /* X X--- 1,5 ----- X #ifndef lint X! static char *sccsid = "@(#)$Header: main.c,v 1.18 91/01/12 10:54:01 sob Exp $"; X #endif X X /* X*************** X*** 22,28 X struct sockaddr_in current_peer = { AF_INET, IPPORT_NNTP }; X #endif X #include <signal.h> X! #ifdef hpux X #include <varargs.h> X #endif /*hpux*/ X X X--- 22,29 ----- X struct sockaddr_in current_peer = { AF_INET, IPPORT_NNTP }; X #endif X #include <signal.h> X! /* XXX Should be #ifdef VARARGS */ X! #if defined(sun) || defined(hpux) X #include <varargs.h> X #endif X X*************** X*** 24,30 X #include <signal.h> X #ifdef hpux X #include <varargs.h> X! #endif /*hpux*/ X X #ifdef SETPROCTITLE X char **Argv = NULL; /* pointer to argument vector */ X X--- 25,31 ----- X /* XXX Should be #ifdef VARARGS */ X #if defined(sun) || defined(hpux) X #include <varargs.h> X! #endif X X #ifdef SETPROCTITLE X char **Argv = NULL; /* pointer to argument vector */ X*************** X*** 31,38 X char *LastArgv = NULL; /* end of argv */ X #endif /* SETPROCTITLE */ X X- char **myenviron; X- X main(argc,argv,envp) X char **argv, **envp; X { X X--- 32,37 ----- X char *LastArgv = NULL; /* end of argv */ X #endif /* SETPROCTITLE */ X X main(argc,argv,envp) X char **argv, **envp; X { X*************** X*** 42,47 X int sockt, client, length; X struct sockaddr_in from; X extern int reaper(); X X disassoc(); X X X--- 41,49 ----- X int sockt, client, length; X struct sockaddr_in from; X extern int reaper(); X+ #ifdef LOAD X+ register int load; X+ #endif /* LOAD */ X X disassoc(); X X*************** X*** 74,79 X (void) signal(SIGCHLD, reaper); X #endif /* USG */ X X if (listen(sockt, SOMAXCONN) < 0) { X #ifdef SYSLOG X syslog(LOG_ERR, "main: listen: %m"); X X--- 76,86 ----- X (void) signal(SIGCHLD, reaper); X #endif /* USG */ X X+ #ifdef DEBUG X+ (void) signal(SIGUSR1, debugup); X+ (void) signal(SIGUSR2, debugdown); X+ #endif X+ X if (listen(sockt, SOMAXCONN) < 0) { X #ifdef SYSLOG X syslog(LOG_ERR, "main: listen: %m"); X*************** X*** 84,105 X X #ifdef SETPROCTITLE X /* X- * Stash away a copy of the environment for use by later exec's. X- * (This leaves us free to trash the original copy.) X- */ X- { X- register int i; X- X- i = 0; X- while (envp[i++]) X- ; X- myenviron = (char **)malloc(i * sizeof(char **)); X- myenviron[--i] = 0; X- while (--i >= 0) X- myenviron[i] = X- strcpy((char *)malloc(strlen(envp[i]) + 1), envp[i]); X- } X- /* X * Save start and extent of argv for setproctitle. X */ X X X--- 91,96 ----- X X #ifdef SETPROCTITLE X /* X * Save start and extent of argv for setproctitle. X */ X X*************** X*** 111,119 X envp++; X LastArgv = envp[-1] + strlen(envp[-1]); X #endif /*SDD*/ X- #else /* SETPROCTITLE */ X- /* Just use original copy if not doing proctitle hacking */ X- myenviron = envp; X #endif /* SETPROCTITLE */ X X for (;;) { X X--- 102,107 ----- X envp++; X LastArgv = envp[-1] + strlen(envp[-1]); X #endif /*SDD*/ X #endif /* SETPROCTITLE */ X #if defined(LOAD) && defined(SETPROCTITLE) X /* If LOAD and SETPROCTITLE, display load before first accept() */ X*************** X*** 115,120 X /* Just use original copy if not doing proctitle hacking */ X myenviron = envp; X #endif /* SETPROCTITLE */ X X for (;;) { X #ifdef LOAD X X--- 103,114 ----- X LastArgv = envp[-1] + strlen(envp[-1]); X #endif /*SDD*/ X #endif /* SETPROCTITLE */ X+ #if defined(LOAD) && defined(SETPROCTITLE) X+ /* If LOAD and SETPROCTITLE, display load before first accept() */ X+ load = getla(); X+ setproctitle("%sing connections: loadav %d", X+ load > LOAD ? "reject" : "accept", load); X+ #endif /* LOAD && SETPROCTITLE */ X X for (;;) { X #ifdef LOAD X*************** X*** 118,124 X X for (;;) { X #ifdef LOAD X- register int load; X char oline[NNTP_STRLEN]; X #endif /* LOAD */ X #ifdef EXCELAN X X--- 112,117 ----- X X for (;;) { X #ifdef LOAD X char oline[NNTP_STRLEN]; X #endif /* LOAD */ X #ifdef EXCELAN X*************** X*** 156,161 X X #ifdef LOAD X if (( load = getla()) > LOAD ) { X setproctitle("rejecting connections: loadav %d", load); X sprintf( oline, "%d loadav at %d, try later\n", X ERR_GOODBYE, load ); X X--- 149,155 ----- X X #ifdef LOAD X if (( load = getla()) > LOAD ) { X+ #ifdef SETPROCTITLE X setproctitle("rejecting connections: loadav %d", load); X #endif /* SETPROCTITLE */ X sprintf( oline, "%d loadav at %d, try later\r\n", X*************** X*** 157,163 X #ifdef LOAD X if (( load = getla()) > LOAD ) { X setproctitle("rejecting connections: loadav %d", load); X! sprintf( oline, "%d loadav at %d, try later\n", X ERR_GOODBYE, load ); X write( client, oline, strlen( oline )); X #ifdef SYSLOG X X--- 151,158 ----- X if (( load = getla()) > LOAD ) { X #ifdef SETPROCTITLE X setproctitle("rejecting connections: loadav %d", load); X! #endif /* SETPROCTITLE */ X! sprintf( oline, "%d loadav at %d, try later\r\n", X ERR_GOODBYE, load ); X write( client, oline, strlen( oline )); X #ifdef SYSLOG X*************** X*** 167,172 X sleep( 5 ); X continue; X } else { X setproctitle("accepting connections: loadav %d", load); X } X #endif LOAD X X--- 162,168 ----- X sleep( 5 ); X continue; X } else { X+ #ifdef SETPROCTITLE X setproctitle("accepting connections: loadav %d", load); X #endif /* SETPROCTITLE */ X } X*************** X*** 168,173 X continue; X } else { X setproctitle("accepting connections: loadav %d", load); X } X #endif LOAD X X X--- 164,170 ----- X } else { X #ifdef SETPROCTITLE X setproctitle("accepting connections: loadav %d", load); X+ #endif /* SETPROCTITLE */ X } X #endif /* LOAD */ X X*************** X*** 169,175 X } else { X setproctitle("accepting connections: loadav %d", load); X } X! #endif LOAD X X switch (fork()) { X case -1: X X--- 166,172 ----- X setproctitle("accepting connections: loadav %d", load); X #endif /* SETPROCTITLE */ X } X! #endif /* LOAD */ X X switch (fork()) { X case -1: X*************** X*** 206,212 X default: X #ifdef EXCELAN X (void) close(sockt); X! #else /* EXCELAN */ X (void) close(client); X #endif /* EXCELAN */ X break; X X--- 203,209 ----- X default: X #ifdef EXCELAN X (void) close(sockt); X! #else /* !EXCELAN */ X (void) close(client); X #endif /* EXCELAN */ X break; X*************** X*** 220,226 X register int load; X X if (( load = getla()) > LOAD ) { X! printf("%d loadav at %d, try later\n", X ERR_GOODBYE, load ); X #ifdef SYSLOG X #ifdef BSD_42 X X--- 217,223 ----- X register int load; X X if (( load = getla()) > LOAD ) { X! printf("%d loadav at %d, try later\r\n", X ERR_GOODBYE, load ); X #ifdef SYSLOG X #ifdef BSD_42 X*************** X*** 234,240 X exit(1); X } X } X! #endif LOAD X #ifdef SETPROCTITLE X /* X * Save start and extent of argv for setproctitle. X X--- 231,237 ----- X exit(1); X } X } X! #endif /* LOAD */ X #ifdef SETPROCTITLE X /* X * Save start and extent of argv for setproctitle. X*************** X*** 250,255 X #endif /*SDD*/ X #endif /* SETPROCTITLE */ X X serve(); X X #endif /* ALONE */ X X--- 247,256 ----- X #endif /*SDD*/ X #endif /* SETPROCTITLE */ X X+ #ifdef USG X+ (void) signal(SIGCLD,SIG_DFL); X+ #endif /* USG */ X+ X serve(); X X #endif /* ALONE */ X*************** X*** 259,265 X * clobber argv so ps will show what we're doing. X * stolen from sendmail X */ X! #ifdef hpux X /*VARARGS*/ X void X setproctitle(va_alist) X X--- 260,267 ----- X * clobber argv so ps will show what we're doing. X * stolen from sendmail X */ X! #ifdef SETPROCTITLE X! #if defined(sun) || defined(hpux) X /*VARARGS*/ X void X setproctitle(va_alist) X*************** X*** 271,277 X va_list ap; X X va_start(ap); X- #ifdef SETPROCTITLE X fmt = va_arg(ap, char *); X X (void) vsprintf(buf, fmt, ap); X X--- 273,278 ----- X va_list ap; X X va_start(ap); X fmt = va_arg(ap, char *); X X (void) vsprintf(buf, fmt, ap); X*************** X*** 290,296 X while (p < LastArgv) X *p++ = ' '; X X- #endif /* SETPROCTITLE */ X va_end(ap); X } X #else X X--- 291,296 ----- X while (p < LastArgv) X *p++ = ' '; X X va_end(ap); X } X #else X*************** X*** 295,300 X } X #else X /*VARARGS1*/ X setproctitle(fmt, a, b, c) X char *fmt; X { X X--- 295,301 ----- X } X #else X /*VARARGS1*/ X+ void X setproctitle(fmt, a, b, c) X char *fmt; X { X*************** X*** 298,304 X setproctitle(fmt, a, b, c) X char *fmt; X { X- #ifdef SETPROCTITLE X register char *p; X register int i; X char buf[BUFSIZ]; X X--- 299,304 ----- X setproctitle(fmt, a, b, c) X char *fmt; X { X register char *p; X register int i; X char buf[BUFSIZ]; X*************** X*** 318,323 X p += i; X while (p < LastArgv) X *p++ = ' '; X- #endif /* SETPROCTITLE */ X } X #endif /* hpux */ X X--- 318,323 ----- X p += i; X while (p < LastArgv) X *p++ = ' '; X } X #endif /* hpux */ X #endif /* SETPROCTITLE */ X*************** X*** 321,323 X #endif /* SETPROCTITLE */ X } X #endif /* hpux */ X X--- 320,323 ----- X *p++ = ' '; X } X #endif /* hpux */ X+ #endif /* SETPROCTITLE */ XIndex: misc.c XPrereq: 1.39 X*** misc.c Sat Aug 25 17:00:10 1990 X--- ../../nntp/server/misc.c Wed Dec 12 00:00:11 1990 X*************** X*** 1,5 X #ifndef lint X! static char *sccsid = "@(#)$Header: misc.c,v 1.39 90/08/25 16:59:48 sob Exp $"; X #endif X X #include "common.h" X X--- 1,5 ----- X #ifndef lint X! static char *sccsid = "@(#)$Header: misc.c,v 1.41 90/12/12 00:00:02 sob Exp $"; X #endif X X #include "common.h" X*************** X*** 54,60 X return (NULL); X } X X! if ((statbuf.st_mode & S_IFREG) != S_IFREG) { X close_crnt(); X return (NULL); X } X X--- 54,60 ----- X return (NULL); X } X X! if ((statbuf.st_mode & S_IFMT) != S_IFREG) { X close_crnt(); X return (NULL); X } X*************** X*** 565,571 X * X * Returns: "c" if the character is not X * upper case, otherwise the lower X! * case eqivalent of "c". X * X * Side effects: None. X */ X X--- 565,571 ----- X * X * Returns: "c" if the character is not X * upper case, otherwise the lower X! * case equivalent of "c". X * X * Side effects: None. X */ XIndex: netaux.c XPrereq: 1.11 X*** /tmp/,RCSt1a20277 Sun Feb 10 13:59:52 1991 X--- /tmp/,RCSt2a20277 Sun Feb 10 13:59:52 1991 X*************** X*** 1,5 X #ifndef lint X! static char *sccsid = "@(#)netaux.c 1.11 (Berkeley) 2/25/88"; X #endif X X /* X X--- 1,5 ----- X #ifndef lint X! static char *sccsid = "@(#)$Header: netaux.c,v 1.14 91/02/10 13:59:20 sob Exp $"; X #endif X X /* X*************** X*** 61,67 X (void) dup2(0, 2); X setpgrp(); X umask(000); X! #else not USG X i = open("/dev/tty", O_RDWR); X if (i >= 0) { X ioctl(i, TIOCNOTTY, 0); X X--- 61,67 ----- X (void) dup2(0, 2); X setpgrp(); X umask(000); X! #else /* not USG */ X i = open("/dev/tty", O_RDWR); X if (i >= 0) { X ioctl(i, TIOCNOTTY, 0); X*************** X*** 77,83 X (void) dup2(0, 1); X (void) dup2(1, 2); X } X! #endif not USG X } X X X X--- 77,83 ----- X (void) dup2(0, 1); X (void) dup2(1, 2); X } X! #endif /* not USG */ X } X X X*************** X*** 91,97 X * X * Side effects: None. X * X! * Errors: Syslogd, cause aboriton. X */ X X get_socket() X X--- 91,97 ----- X * X * Side effects: None. X * X! * Errors: Syslogd, cause abortion. X */ X X get_socket() X*************** X*** 109,115 X #endif X exit(1); X } X! #endif not EXCELAN X X bzero((char *) &sin, sizeof (sin)); X sin.sin_family = AF_INET; X X--- 109,115 ----- X #endif X exit(1); X } X! #endif /* not EXCELAN */ X X bzero((char *) &sin, sizeof (sin)); X sin.sin_family = AF_INET; X*************** X*** 118,124 X sin.sin_port = sp->s_port; X X s = socket(AF_INET, SOCK_STREAM, 0); X! #else EXCELAN X sin.sin_port = htons(IPPORT_NNTP); X s = 3; /* WTF??? */ X s = socket(SOCK_STREAM, (struct sockproto *)0, &sin, X X--- 118,124 ----- X sin.sin_port = sp->s_port; X X s = socket(AF_INET, SOCK_STREAM, 0); X! #else /* EXCELAN */ X sin.sin_port = htons(IPPORT_NNTP); X s = 3; /* WTF??? */ X s = socket(SOCK_STREAM, (struct sockproto *)0, &sin, X*************** X*** 123,129 X s = 3; /* WTF??? */ X s = socket(SOCK_STREAM, (struct sockproto *)0, &sin, X (SO_KEEPALIVE|SO_ACCEPTCONN)); X! #endif EXCELAN X if (s < 0) { X #ifdef EXCELAN X sleep(5); X X--- 123,129 ----- X s = 3; /* WTF??? */ X s = socket(SOCK_STREAM, (struct sockproto *)0, &sin, X (SO_KEEPALIVE|SO_ACCEPTCONN)); X! #endif /* EXCELAN */ X if (s < 0) { X #ifdef EXCELAN X sleep(5); X*************** X*** 128,134 X #ifdef EXCELAN X sleep(5); X return (-1); X! #else not EXCELAN X #ifdef SYSLOG X syslog(LOG_ERR, "get_socket: socket: %m"); X #endif SYSLOG X X--- 128,134 ----- X #ifdef EXCELAN X sleep(5); X return (-1); X! #else /* not EXCELAN */ X #ifdef SYSLOG X syslog(LOG_ERR, "get_socket: socket: %m"); X #endif /* SYSLOG */ X*************** X*** 131,137 X #else not EXCELAN X #ifdef SYSLOG X syslog(LOG_ERR, "get_socket: socket: %m"); X! #endif SYSLOG X exit(1); X #endif not EXCELAN X } X X--- 131,137 ----- X #else /* not EXCELAN */ X #ifdef SYSLOG X syslog(LOG_ERR, "get_socket: socket: %m"); X! #endif /* SYSLOG */ X exit(1); X #endif /* not EXCELAN */ X } X*************** X*** 133,139 X syslog(LOG_ERR, "get_socket: socket: %m"); X #endif SYSLOG X exit(1); X! #endif not EXCELAN X } X #ifndef EXCELAN X #ifdef SO_REUSEADDR X X--- 133,139 ----- X syslog(LOG_ERR, "get_socket: socket: %m"); X #endif /* SYSLOG */ X exit(1); X! #endif /* not EXCELAN */ X } X #ifndef EXCELAN X #ifdef SO_REUSEADDR X*************** X*** 147,153 X #endif X exit(1); X } X! #endif not EXCELAN X X return (s); X } X X--- 147,153 ----- X #endif X exit(1); X } X! #endif /* not EXCELAN */ X X return (s); X } X*************** X*** 191,197 X { X #ifndef USG X struct itimerval new, old; X! #endif not USG X extern int read_again(); X X (void) signal(SIGALRM, read_again); X X--- 191,197 ----- X { X #ifndef USG X struct itimerval new, old; X! #endif /* not USG */ X extern int read_again(); X X (void) signal(SIGALRM, read_again); X*************** X*** 197,203 X (void) signal(SIGALRM, read_again); X #ifdef USG X alarm(READINTVL); X! #else not USG X X new.it_value.tv_sec = READINTVL; X new.it_value.tv_usec = 0; X X--- 197,203 ----- X (void) signal(SIGALRM, read_again); X #ifdef USG X alarm(READINTVL); X! #else /* not USG */ X X new.it_value.tv_sec = READINTVL; X new.it_value.tv_usec = 0; X*************** X*** 214,220 X #endif SYSLOG X exit(1); X } X! #endif not USG X } X X X X--- 214,220 ----- X #endif SYSLOG X exit(1); X } X! #endif /* not USG */ X } X X X*************** X*** 262,268 X X while (wait3(&status, WNOHANG, (struct rusage *)0) > 0) X ; X! #endif not USG X } X X #else not ALONE X X--- 262,268 ----- X X while (wait3(&status, WNOHANG, (struct rusage *)0) > 0) X ; X! #endif /* not USG */ X } X X #else /* not ALONE */ X*************** X*** 265,271 X #endif not USG X } X X! #else not ALONE X X /* Kludge for greenhill's C compiler */ X X X--- 265,271 ----- X #endif /* not USG */ X } X X! #else /* not ALONE */ X X /* Kludge for greenhill's C compiler */ X X*************** X*** 273,276 X netaux_greenkludge() X { X } X! #endif not ALONE X X--- 273,276 ----- X netaux_greenkludge() X { X } X! #endif /* not ALONE */ X XIndex: post.c XPrereq: 1.16 X*** post.c Thu Jul 5 23:47:54 1990 X--- ../../nntp/server/post.c Sun Dec 23 11:50:02 1990 X*************** X*** 1,5 X #ifndef lint X! static char *sccsid = "@(#)$Header: post.c,v 1.16 90/07/05 23:47:52 sob Exp $"; X #endif X X #include "common.h" X X--- 1,5 ----- X #ifndef lint X! static char *sccsid = "@(#)$Header: post.c,v 1.17 90/12/23 11:50:01 sob Exp $"; X #endif X X #include "common.h" X*************** X*** 51,57 X } X else retcode = X #ifdef CNEWS X! spawn(inews, "inews", "-W", CONT_POST, ERR_POSTFAIL, errbuf); X #else X spawn(inews, "inews", "-h", CONT_POST, ERR_POSTFAIL, errbuf); X #endif X X--- 51,58 ----- X } X else retcode = X #ifdef CNEWS X! spawn(inews, "inews", "-W", CONT_POST, ERR_POSTFAIL, errbuf, X! "<none>"); X #else X spawn(inews, "inews", "-h", CONT_POST, ERR_POSTFAIL, errbuf, X "<none>"); X*************** X*** 53,59 X #ifdef CNEWS X spawn(inews, "inews", "-W", CONT_POST, ERR_POSTFAIL, errbuf); X #else X! spawn(inews, "inews", "-h", CONT_POST, ERR_POSTFAIL, errbuf); X #endif X if (retcode <= 0) X printf("%d %s\r\n", ERR_POSTFAIL, errbuf); X X--- 54,61 ----- X spawn(inews, "inews", "-W", CONT_POST, ERR_POSTFAIL, errbuf, X "<none>"); X #else X! spawn(inews, "inews", "-h", CONT_POST, ERR_POSTFAIL, errbuf, X! "<none>"); X #endif X if (retcode <= 0) X printf("%d %s\r\n", ERR_POSTFAIL, errbuf); XIndex: scandir.c XPrereq: 1.3 X*** scandir.c Thu Jul 5 02:29:19 1990 X--- ../../nntp/server/scandir.c Fri Feb 8 18:22:16 1991 X*************** X*** 1,5 X #ifndef lint X! static char *sccsid = "@(#)scandir.c 1.3 (Berkeley) 6/26/87"; X #endif X X #include "common.h" X X--- 1,5 ----- X #ifndef lint X! static char *sccsid = "@(#)$Header: scandir.c,v 1.6 91/02/08 18:22:07 sob Exp $"; X #endif X X #include "common.h" X*************** X*** 9,15 X * loading the article numbers into art_array. Return X * number of articles loaded. X * X! * Paramaters: "low_msg", "high_msg" are the low X * and high messages numbers in this X * group; we ignore numbers outside this X * range. X X--- 9,15 ----- X * loading the article numbers into art_array. Return X * number of articles loaded. X * X! * Parameters: "low_msg", "high_msg" are the low X * and high messages numbers in this X * group; we ignore numbers outside this X * range. X*************** X*** 21,26 X */ X X extern int intcmp(); X X scan_dir(low_msg, high_msg) X int low_msg, high_msg; X X--- 21,27 ----- X */ X X extern int intcmp(); X+ extern char *malloc(), *realloc(); X X scan_dir(low_msg, high_msg) X int low_msg, high_msg; X*************** X*** 38,43 X X while ((dirent = readdir(dirp)) != NULL) { X artnum = atoi(dirent->d_name); X if (artnum != 0 && artnum >= low_msg && artnum <= high_msg) X art_array[num_arts++] = artnum; X } X X--- 39,76 ----- X X while ((dirent = readdir(dirp)) != NULL) { X artnum = atoi(dirent->d_name); X+ #ifdef DYNAMIC_ART_ARRAY X+ if (artnum == 0 || artnum < low_msg || artnum > high_msg) X+ continue; X+ /* Expand/allocate art_array elements as necessary */ X+ if (num_arts + 1 >= size_art_array) { X+ size_art_array += 1024; X+ if (art_array) { X+ #ifdef SYSLOG X+ syslog(LOG_INFO, X+ "increasing art_array to %d elements", X+ size_art_array); X+ #endif X+ art_array = (int *)realloc(art_array, X+ size_art_array * sizeof(*art_array)); X+ } else X+ art_array = (int *) X+ malloc(size_art_array * sizeof(*art_array)); X+ if (art_array == 0) { X+ #ifdef SYSLOG X+ syslog(LOG_ERR, X+ "scan_dir(): malloc/realloc failed"); X+ #endif X+ num_arts = 0; X+ size_art_array = 0; X+ size_art_array = 0; X+ closedir(dirp); X+ return(0); X+ } X+ } X+ art_array[num_arts] = artnum; X+ ++num_arts; X+ #else X if (artnum != 0 && artnum >= low_msg && artnum <= high_msg) X art_array[num_arts++] = artnum; X #endif X*************** X*** 40,46 X artnum = atoi(dirent->d_name); X if (artnum != 0 && artnum >= low_msg && artnum <= high_msg) X art_array[num_arts++] = artnum; X! } X X closedir(dirp); X X X--- 73,79 ----- X #else X if (artnum != 0 && artnum >= low_msg && artnum <= high_msg) X art_array[num_arts++] = artnum; X! #endif X X } X closedir(dirp); X*************** X*** 42,47 X art_array[num_arts++] = artnum; X } X X closedir(dirp); X X qsort((char *) art_array, num_arts, sizeof(int), intcmp); X X--- 75,81 ----- X art_array[num_arts++] = artnum; X #endif X X+ } X closedir(dirp); X X qsort((char *) art_array, num_arts, sizeof(int), intcmp); XIndex: serve.c XPrereq: 1.35 X*** serve.c Sat Aug 11 21:33:30 1990 X--- ../../nntp/server/serve.c Thu Jan 10 17:20:08 1991 X*************** X*** 1,5 X #ifndef lint X! static char *sccsid = "@(#)$Header: serve.c,v 1.35 90/08/11 21:33:10 sob Exp $"; X #endif X X /* X X--- 1,5 ----- X #ifndef lint X! static char *sccsid = "@(#)$Header: serve.c,v 1.37 91/01/10 17:19:52 sob Exp $"; X #endif X X /* X*************** X*** 20,32 X # endif not USG X #endif X X! #ifdef TIMEOUT X! /* Not all systems define these */ X! #ifndef FD_SETSIZE X! #define FD_SET(n, p) ((p)->fds_bits[0] |= (1<<(n))) X! #define FD_CLR(n, p) ((p)->fds_bits[0] &= ~(1<<(n))) X! #define FD_ISSET(n, p) ((p)->fds_bits[0] & (1<<(n))) X! #define FD_ZERO(p) ((p)->fds_bits[0] = 0) X #endif X #endif X X X--- 20,27 ----- X # endif not USG X #endif X X! #ifdef TIMERS X! #include "timer.h" X #endif X X extern int ahbs(), group(), help(), ihave(); X*************** X*** 28,34 X #define FD_ISSET(n, p) ((p)->fds_bits[0] & (1<<(n))) X #define FD_ZERO(p) ((p)->fds_bits[0] = 0) X #endif X- #endif X X extern int ahbs(), group(), help(), ihave(); X extern int list(), newgroups(), newnews(), nextlast(), post(); X X--- 23,28 ----- X #ifdef TIMERS X #include "timer.h" X #endif X X extern int ahbs(), group(), help(), ihave(); X extern int list(), newgroups(), newnews(), nextlast(), post(); X*************** X*** 70,75 X }; X #define NUMCMDS (sizeof(cmdtbl) / sizeof(struct cmdent)) X X #ifdef AUTH X extern int Needauth; X extern char User[]; X X--- 64,100 ----- X }; X #define NUMCMDS (sizeof(cmdtbl) / sizeof(struct cmdent)) X X+ #ifdef TIMEOUT X+ static void timeout(); X+ #endif X+ #ifdef LOGINCHECK X+ static void logincheck(); X+ static int firstlogincheck; X+ #endif X+ #ifdef BATCHED_INPUT X+ static void batchcheck(); X+ #endif X+ X+ #ifdef TIMERS X+ static struct timer timers[] = { X+ #ifdef TIMEOUT X+ { timeout, 1, TIMEOUT, 0 }, X+ #endif X+ #ifdef LOGINCHECK X+ { logincheck, 0, LOGINCHECK, 0 }, X+ #endif X+ #ifdef BATCHCHECK X+ { batchcheck, 1, BATCHCHECK, 0 }, X+ #endif X+ }; X+ #define NTIMERS (sizeof(timers) / sizeof(struct timer)) X+ #endif X+ X+ static char *stats_init(); X+ #ifdef LOG X+ static void stats_finish(); X+ #endif X+ X #ifdef AUTH X extern int Needauth; X extern char User[]; X*************** X*** 96,109 X char **argp; X char *timeptr, *cp; X int argnum, i; X- double Tstart, Tfinish; X- double user, sys; X- #ifdef USG X- time_t start, finish; X- #else /* not USG */ X- struct timeval start, finish; X- #endif /* not USG */ X- extern char *ctime(); X #ifdef POSTER X struct passwd *pp; X #endif X X--- 121,126 ----- X char **argp; X char *timeptr, *cp; X int argnum, i; X #ifdef POSTER X struct passwd *pp; X #endif X*************** X*** 107,116 X #ifdef POSTER X struct passwd *pp; X #endif X- #ifdef TIMEOUT X- struct timeval timeout; X- fd_set readfds; X- #endif X #ifdef LOG X # ifdef USG X struct tms cpu; X X--- 124,129 ----- X #ifdef POSTER X struct passwd *pp; X #endif X #ifdef LOG X grps_acsd = arts_acsd = 0; X #endif X*************** X*** 112,122 X fd_set readfds; X #endif X #ifdef LOG X- # ifdef USG X- struct tms cpu; X- # else /* not USG */ X- struct rusage me, kids; X- # endif /* not USG */ X grps_acsd = arts_acsd = 0; X #endif X X X--- 125,130 ----- X struct passwd *pp; X #endif X #ifdef LOG X grps_acsd = arts_acsd = 0; X #endif X X*************** X*** 139,144 X # endif X #endif X X #ifdef ALONE X #ifndef USG X (void) signal(SIGCHLD, SIG_IGN); X X--- 147,154 ----- X # endif X #endif X X+ timeptr = stats_init(); X+ X #ifdef ALONE X #ifndef USG X (void) signal(SIGCHLD, SIG_IGN); X*************** X*** 159,164 X if (gethostname(host, sizeof(host)) < 0) X (void) strcpy(host, "Amnesiac"); X X setproctitle("%s", hostname); X X if (!canread && !canxfer) { X X--- 169,175 ----- X if (gethostname(host, sizeof(host)) < 0) X (void) strcpy(host, "Amnesiac"); X X+ #ifdef SETPROCTITLE X setproctitle("%s", hostname); X #endif X X*************** X*** 160,165 X (void) strcpy(host, "Amnesiac"); X X setproctitle("%s", hostname); X X if (!canread && !canxfer) { X printf("%d %s NNTP server can't talk to you. Goodbye.\r\n", X X--- 171,177 ----- X X #ifdef SETPROCTITLE X setproctitle("%s", hostname); X+ #endif X X if (!canread && !canxfer) { X printf("%d %s NNTP server can't talk to you. Goodbye.\r\n", X*************** X*** 166,172 X ERR_ACCESS, host); X (void) fflush(stdout); X (void) fclose(stdout); X! #ifdef LOG X syslog(LOG_INFO, "%s refused connection", hostname); X #endif X exit(1); X X--- 178,184 ----- X ERR_ACCESS, host); X (void) fflush(stdout); X (void) fclose(stdout); X! #ifdef SYSLOG X syslog(LOG_INFO, "%s refused connection", hostname); X #endif X exit(1); X*************** X*** 172,177 X exit(1); X } X X if ( !canpost && !canread && !space(MINFREE)) { X printf("%d %s NNTP server out of space. Try later.\r\n", X ERR_GOODBYE, host); X X--- 184,195 ----- X exit(1); X } X X+ #ifdef LOGINCHECK X+ firstlogincheck = 1; X+ logincheck(); X+ firstlogincheck = 0; X+ #endif X+ X if ( !canpost && !canread && !space(MINFREE)) { X printf("%d %s NNTP server out of space. Try later.\r\n", X ERR_GOODBYE, host); X*************** X*** 176,181 X printf("%d %s NNTP server out of space. Try later.\r\n", X ERR_GOODBYE, host); X (void) fflush(stdout); X exit(1); X } X X X--- 194,202 ----- X printf("%d %s NNTP server out of space. Try later.\r\n", X ERR_GOODBYE, host); X (void) fflush(stdout); X+ #ifdef SYSLOG X+ syslog(LOG_INFO, "%s no space", hostname); X+ #endif X exit(1); X } X X*************** X*** 188,195 X if (pp != NULL) { X uid_poster = pp->pw_uid; X gid_poster = pp->pw_gid; X! putenv("USER",POSTER,1); X! putenv("LOGNAME",POSTER,1); X } else X #endif X uid_poster = gid_poster = 0; X X--- 209,215 ----- X if (pp != NULL) { X uid_poster = pp->pw_uid; X gid_poster = pp->pw_gid; X! home_poster = pp->pw_dir; X } else X #endif X uid_poster = gid_poster = 0; X*************** X*** 210,216 X printf("%d %s NNTP server unavailable. Try later.\r\n", X ERR_FAULT, host); X (void) fflush(stdout); X! #ifdef LOG X syslog(LOG_INFO, "%s no groups", hostname); X #endif X exit(1); X X--- 230,236 ----- X printf("%d %s NNTP server unavailable. Try later.\r\n", X ERR_FAULT, host); X (void) fflush(stdout); X! #ifdef SYSLOG X syslog(LOG_INFO, "%s no groups", hostname); X #endif X exit(1); X*************** X*** 219,233 X art_fp = NULL; X argp = (char **) NULL; /* for first time */ X X- #ifdef USG X- (void) time(&start); X- Tstart = (double) start; X- timeptr = ctime(&start); X- #else not USG X- (void) gettimeofday(&start, (struct timezone *)NULL); X- Tstart = (double) start.tv_sec + ((double)start.tv_usec)/1000000.0; X- timeptr = ctime(&start.tv_sec); X- #endif not USG X if ((cp = index(timeptr, '\n')) != NULL) X *cp = '\0'; X else X X--- 239,244 ----- X art_fp = NULL; X argp = (char **) NULL; /* for first time */ X X if ((cp = index(timeptr, '\n')) != NULL) X *cp = '\0'; X else X*************** X*** 247,256 X * Now get commands one at a time and execute the X * appropriate routine to deal with them. X */ X! X! #ifdef TIMEOUT X! timeout.tv_sec = TIMEOUT; X! timeout.tv_usec = 0; X #endif X for (;;) { X #ifdef TIMEOUT X X--- 258,265 ----- X * Now get commands one at a time and execute the X * appropriate routine to deal with them. X */ X! #ifdef TIMERS X! timer_init(timers, NTIMERS); X #endif X for (;;) { X #ifdef TIMERS X*************** X*** 253,283 X timeout.tv_usec = 0; X #endif X for (;;) { X! #ifdef TIMEOUT X! /* Do timeout with select() (i.e. the intelligent way) */ X! FD_ZERO(&readfds); X! FD_SET(fileno(stdin), &readfds); X! errno = 0; X! i = select(fileno(stdin) + 1, X! &readfds, (fd_set*)0, (fd_set*)0, &timeout); X! if (i < 0) { X! /* "Interrupted system call" isn't a real error */ X! if (errno == EINTR) X! continue; X! syslog(LOG_ERR, "%s read select: %m", hostname); X! break; X! } X! if (!FD_ISSET(fileno(stdin), &readfds)) { X! printf( X! "%d Timeout after %d seconds, closing connection.\r\n", X! ERR_FAULT, TIMEOUT); X! (void) fflush(stdout); X! X! #ifdef LOG X! syslog(LOG_ERR, "%s timeout", hostname); X! #endif LOG X! exit(1); X! } X #endif X if (fgets(line, sizeof(line), stdin) == NULL) X break; X X--- 262,271 ----- X timer_init(timers, NTIMERS); X #endif X for (;;) { X! #ifdef TIMERS X! /* Don't try to read input unless there is some */ X! if (!timer_sleep(timers, NTIMERS)) X! continue; X #endif X if (fgets(line, sizeof(line), stdin) == NULL) X break; X*************** X*** 286,292 X while (cp >= line && (*cp == '\n' || *cp == '\r')) X *cp-- = '\0'; X #ifdef DEBUG X! syslog(LOG_DEBUG, "<- \"%s\"", line); X #endif X X if ((argnum = parsit(line, &argp)) == 0) X X--- 274,281 ----- X while (cp >= line && (*cp == '\n' || *cp == '\r')) X *cp-- = '\0'; X #ifdef DEBUG X! if (debug) X! syslog(LOG_DEBUG, "<- \"%s\"", line); X #endif X X /* Null command */ X*************** X*** 289,294 X syslog(LOG_DEBUG, "<- \"%s\"", line); X #endif X X if ((argnum = parsit(line, &argp)) == 0) X continue; /* Null command */ X else { X X--- 278,284 ----- X syslog(LOG_DEBUG, "<- \"%s\"", line); X #endif X X+ /* Null command */ X if ((argnum = parsit(line, &argp)) == 0) X continue; X X*************** X*** 290,299 X #endif X X if ((argnum = parsit(line, &argp)) == 0) X! continue; /* Null command */ X! else { X! /* a motion to adjourn is always in order */ X! if (!strcasecmp(argp[0], "quit")) X break; X for (i = 0; i < NUMCMDS; ++i) X if (!strcasecmp(cmdtbl[i].cmd_name, argp[0])) X X--- 280,293 ----- X X /* Null command */ X if ((argnum = parsit(line, &argp)) == 0) X! continue; X! X! /* a motion to adjourn is always in order */ X! if (!strcasecmp(argp[0], "quit")) X! break; X! X! for (i = 0; i < NUMCMDS; ++i) X! if (!strcasecmp(cmdtbl[i].cmd_name, argp[0])) X break; X X if (i < NUMCMDS) { X*************** X*** 295,305 X /* a motion to adjourn is always in order */ X if (!strcasecmp(argp[0], "quit")) X break; X! for (i = 0; i < NUMCMDS; ++i) X! if (!strcasecmp(cmdtbl[i].cmd_name, argp[0])) X! break; X! if (i < NUMCMDS) X! { X #ifdef AUTH X /* authentication required? */ X if (cmdtbl[i].authreq == 1 && Needauth) X X--- 289,299 ----- X for (i = 0; i < NUMCMDS; ++i) X if (!strcasecmp(cmdtbl[i].cmd_name, argp[0])) X break; X! X! if (i < NUMCMDS) { X! #ifdef SETPROCTITLE X! setproctitle("%s %s", hostname, argp[0]); X! #endif X #ifdef AUTH X /* authentication required? */ X if (cmdtbl[i].authreq == 1 && Needauth) X*************** X*** 301,315 X if (i < NUMCMDS) X { X #ifdef AUTH X! /* authentication required? */ X! if (cmdtbl[i].authreq == 1 && Needauth) X! { X! printf("%d Authentication required for command\r\n", ERR_NOAUTH); X! (void) fflush(stdout); X! continue; X! } X! #endif AUTH X! (*cmdtbl[i].cmd_fctn)(argnum, argp); X } X else { X #ifdef LOG X X--- 295,306 ----- X setproctitle("%s %s", hostname, argp[0]); X #endif X #ifdef AUTH X! /* authentication required? */ X! if (cmdtbl[i].authreq == 1 && Needauth) X! { X! printf("%d Authentication required for command\r\n", ERR_NOAUTH); X! (void) fflush(stdout); X! continue; X } X #endif AUTH X (*cmdtbl[i].cmd_fctn)(argnum, argp); X*************** X*** 311,321 X #endif AUTH X (*cmdtbl[i].cmd_fctn)(argnum, argp); X } X! else { X! #ifdef LOG X! syslog(LOG_INFO, "%s unrecognized %s", X! hostname, X! line); X #endif X printf("%d Command unrecognized.\r\n", X ERR_COMMAND); X X--- 302,312 ----- X (void) fflush(stdout); X continue; X } X! #endif AUTH X! (*cmdtbl[i].cmd_fctn)(argnum, argp); X! } else { X! #ifdef SYSLOG X! syslog(LOG_INFO, "%s unrecognized %s", hostname, line); X #endif X printf("%d Command unrecognized.\r\n", ERR_COMMAND); X (void) fflush(stdout); X*************** X*** 317,326 X hostname, X line); X #endif X! printf("%d Command unrecognized.\r\n", X! ERR_COMMAND); X! (void) fflush(stdout); X! } X } X } X X X--- 308,315 ----- X #ifdef SYSLOG X syslog(LOG_INFO, "%s unrecognized %s", hostname, line); X #endif X! printf("%d Command unrecognized.\r\n", ERR_COMMAND); X! (void) fflush(stdout); X } X } X X*************** X*** 324,331 X } X } X X! printf("%d %s closing connection. Goodbye.\r\n", X! OK_GOODBYE, host); X X (void) fflush(stdout); X X X--- 313,319 ----- X } X } X X! printf("%d %s closing connection. Goodbye.\r\n", OK_GOODBYE, host); X X (void) fflush(stdout); X X*************** X*** 329,336 X X (void) fflush(stdout); X X! #ifdef notdef X! /* XXX why do this twice? */ X (void) fflush(stdout); X #endif X X X--- 317,354 ----- X X (void) fflush(stdout); X X! #ifdef BATCHED_INPUT X! batchcheck(); X! #endif X! X! #ifdef SYSLOG X! if (ferror(stdout)) X! syslog(LOG_ERR, "%s disconnect: %m", hostname); X! #ifdef LOG X! stats_finish(); X! #endif X! #endif X! X! #ifdef PROFILE X! profile(); X! #endif X! exit(0); X! } X! X! #ifdef TIMEOUT X! /* X! * Called after TIMEOUT seconds of idle time to shut things down. X! * XXX stats are not reported when this occurs X! */ X! static void X! timeout() X! { X! X! printf("%d Timeout after %d seconds, closing connection.\r\n", X! ERR_FAULT, TIMEOUT); X! #ifdef SYSLOG X! syslog(LOG_NOTICE, "%s timeout", hostname); X! #endif X (void) fflush(stdout); X #ifdef BATCHED_INPUT X batchcheck(); X*************** X*** 332,337 X #ifdef notdef X /* XXX why do this twice? */ X (void) fflush(stdout); X #endif X X #ifdef BATCHED_INPUT X X--- 350,357 ----- X syslog(LOG_NOTICE, "%s timeout", hostname); X #endif X (void) fflush(stdout); X+ #ifdef BATCHED_INPUT X+ batchcheck(); X #endif X #ifdef LOG X stats_finish(); X*************** X*** 333,338 X /* XXX why do this twice? */ X (void) fflush(stdout); X #endif X X #ifdef BATCHED_INPUT X { X X--- 353,367 ----- X #ifdef BATCHED_INPUT X batchcheck(); X #endif X+ #ifdef LOG X+ stats_finish(); X+ #endif X+ #ifdef PROFILE X+ profile(); X+ #endif X+ exit(1); X+ } X+ #endif X X #ifdef LOGINCHECK X /* X*************** X*** 334,339 X (void) fflush(stdout); X #endif X X #ifdef BATCHED_INPUT X { X char errbuf[2 * NNTP_STRLEN]; X X--- 363,390 ----- X } X #endif X X+ #ifdef LOGINCHECK X+ /* X+ * Called ever LOGINCHECK seconds to see if logins have been disabled. X+ * If so, shut down. X+ * XXX stats are not reported when this occurs X+ */ X+ static void X+ logincheck() X+ { X+ char host[MAXHOSTNAMELEN]; X+ X+ if (access(NOLOGIN, F_OK) < 0) X+ return; X+ if (gethostname(host, sizeof(host)) < 0) X+ (void) strcpy(host, "Amnesiac"); X+ printf("%d Logins are disabled on NNTP server %s. Try again later.\r\n", X+ ERR_ACCESS, host); X+ (void) fflush(stdout); X+ #ifdef SYSLOG X+ syslog(LOG_INFO, "%s logins disabled%s", X+ hostname, firstlogincheck ? "" : " (kicked out)"); X+ #endif X #ifdef BATCHED_INPUT X batchcheck(); X #endif X*************** X*** 335,342 X #endif X X #ifdef BATCHED_INPUT X! { X! char errbuf[2 * NNTP_STRLEN]; X X enqpartbatch(CONT_XFER, ERR_XFERFAIL, errbuf); X } X X--- 386,402 ----- X hostname, firstlogincheck ? "" : " (kicked out)"); X #endif X #ifdef BATCHED_INPUT X! batchcheck(); X! #endif X! #ifdef LOG X! stats_finish(); X! #endif X! #ifdef PROFILE X! profile(); X! #endif X! exit(1); X! } X! #endif X X #ifdef BATCHED_INPUT X /* X*************** X*** 338,345 X { X char errbuf[2 * NNTP_STRLEN]; X X! enqpartbatch(CONT_XFER, ERR_XFERFAIL, errbuf); X! } X #endif X X X X--- 398,415 ----- X } X #endif X X! #ifdef BATCHED_INPUT X! /* X! * Called after BATCHCHECK seconds of idle time and at the end X! * of a session to see if a batch needs to be launched. X! */ X! static void X! batchcheck() X! { X! char errbuf[2 * NNTP_STRLEN]; X! X! enqpartbatch(CONT_XFER, ERR_XFERFAIL, errbuf); X! } X #endif X X /* X*************** X*** 342,347 X } X #endif X X X #ifdef LOG X if (ferror(stdout)) X X--- 412,427 ----- X } X #endif X X+ /* X+ * Stats stuff X+ */ X+ static double Tstart, Tfinish; X+ static double user, sys; X+ #ifdef USG X+ static time_t start, finish; X+ #else /* not USG */ X+ static struct timeval start, finish; X+ #endif /* not USG */ X X static char * X stats_init() X*************** X*** 343,348 X #endif X X X #ifdef LOG X if (ferror(stdout)) X syslog(LOG_ERR, "%s disconnect: %m", hostname); X X--- 423,444 ----- X static struct timeval start, finish; X #endif /* not USG */ X X+ static char * X+ stats_init() X+ { X+ extern char *ctime(); X+ X+ #ifdef USG X+ (void) time(&start); X+ Tstart = (double) start; X+ return(ctime(&start)); X+ #else /* not USG */ X+ (void) gettimeofday(&start, (struct timezone *)NULL); X+ Tstart = (double) start.tv_sec + ((double)start.tv_usec)/1000000.0; X+ return(ctime(&start.tv_sec)); X+ #endif /* not USG */ X+ } X+ X #ifdef LOG X static void X stats_finish() X*************** X*** 344,351 X X X #ifdef LOG X! if (ferror(stdout)) X! syslog(LOG_ERR, "%s disconnect: %m", hostname); X X #ifdef USG X (void) time(&finish); X X--- 440,454 ----- X } X X #ifdef LOG X! static void X! stats_finish() X! { X! char buf[NNTP_STRLEN]; X! # ifdef USG X! struct tms cpu; X! # else /* not USG */ X! struct rusage me, kids; X! # endif /* not USG */ X X #ifdef USG X (void) time(&finish); X*************** X*** 353,359 X X #ifndef HZ X #define HZ 60.0 /* typical system clock ticks - param.h */ X! #endif not HZ X X (void) times(&cpu); X user = (double)(cpu.tms_utime + cpu.tms_cutime) / HZ; X X--- 456,462 ----- X X #ifndef HZ X #define HZ 60.0 /* typical system clock ticks - param.h */ X! #endif /* not HZ */ X X (void) times(&cpu); X user = (double)(cpu.tms_utime + cpu.tms_cutime) / HZ; X*************** X*** 358,364 X (void) times(&cpu); X user = (double)(cpu.tms_utime + cpu.tms_cutime) / HZ; X sys = (double)(cpu.tms_stime + cpu.tms_cstime) / HZ; X! #else not USG X (void) gettimeofday(&finish, (struct timezone *)NULL); X Tfinish = (double) finish.tv_sec + ((double)finish.tv_usec)/1000000.0; X X X--- 461,467 ----- X (void) times(&cpu); X user = (double)(cpu.tms_utime + cpu.tms_cutime) / HZ; X sys = (double)(cpu.tms_stime + cpu.tms_cstime) / HZ; X! #else /* not USG */ X (void) gettimeofday(&finish, (struct timezone *)NULL); X Tfinish = (double) finish.tv_sec + ((double)finish.tv_usec)/1000000.0; X X*************** X*** 369,375 X kids.ru_utime.tv_sec + kids.ru_utime.tv_usec/1000000.0; X sys = (double) me.ru_stime.tv_sec + me.ru_stime.tv_usec/1000000.0 + X kids.ru_stime.tv_sec + kids.ru_stime.tv_usec/1000000.0; X! #endif not USG X if (grps_acsd) X syslog(LOG_INFO, "%s exit %d articles %d groups", X hostname, arts_acsd, grps_acsd); X X--- 472,478 ----- X kids.ru_utime.tv_sec + kids.ru_utime.tv_usec/1000000.0; X sys = (double) me.ru_stime.tv_sec + me.ru_stime.tv_usec/1000000.0 + X kids.ru_stime.tv_sec + kids.ru_stime.tv_usec/1000000.0; X! #endif /* not USG */ X if (grps_acsd) X syslog(LOG_INFO, "%s exit %d articles %d groups", X hostname, arts_acsd, grps_acsd); X*************** X*** 383,389 X ih_accepted, X ih_rejected, X ih_failed); X! (void) sprintf(line, "user %.3f system %.3f elapsed %.3f", X user, sys, Tfinish - Tstart); X syslog(LOG_INFO, "%s times %s", hostname, line); X #endif LOG X X--- 486,492 ----- X ih_accepted, X ih_rejected, X ih_failed); X! (void) sprintf(buf, "user %.3f system %.3f elapsed %.3f", X user, sys, Tfinish - Tstart); X syslog(LOG_INFO, "%s times %s", hostname, buf); X } X*************** X*** 385,395 X ih_failed); X (void) sprintf(line, "user %.3f system %.3f elapsed %.3f", X user, sys, Tfinish - Tstart); X! syslog(LOG_INFO, "%s times %s", hostname, line); X! #endif LOG X! X! #ifdef PROFILE X! profile(); X! #endif X! exit(0); X } X X--- 488,493 ----- X ih_failed); X (void) sprintf(buf, "user %.3f system %.3f elapsed %.3f", X user, sys, Tfinish - Tstart); X! syslog(LOG_INFO, "%s times %s", hostname, buf); X } X #endif LOG X*************** X*** 393,395 X #endif X exit(0); X } X X--- 490,493 ----- X user, sys, Tfinish - Tstart); X syslog(LOG_INFO, "%s times %s", hostname, buf); X } X+ #endif LOG XIndex: spawn.c XPrereq: 1.15 X*** spawn.c Sat Aug 18 17:17:03 1990 X--- ../../nntp/server/spawn.c Fri Feb 8 18:30:43 1991 X*************** X*** 1,5 X #ifndef lint X! static char *sccsid = "@(#)$Header: spawn.c,v 1.15 90/08/18 17:16:47 sob Exp $"; X #endif X X #include "common.h" X X--- 1,5 ----- X #ifndef lint X! static char *sccsid = "@(#)$Header: spawn.c,v 1.22 91/02/08 18:30:30 sob Exp $"; X #endif X X #include "common.h" X*************** X*** 13,21 X static int old_xfer_lines; X #endif X X- /* imports */ X- extern char **myenviron; X- X static char tempfile[256]; X static char badfile[256]; X X X--- 13,18 ----- X static int old_xfer_lines; X #endif X X static char tempfile[256]; X #ifndef CNEWS X static char badfile[256]; X*************** X*** 17,22 X extern char **myenviron; X X static char tempfile[256]; X static char badfile[256]; X X /* X X--- 14,20 ----- X #endif X X static char tempfile[256]; X+ #ifndef CNEWS X static char badfile[256]; X #endif X X*************** X*** 18,23 X X static char tempfile[256]; X static char badfile[256]; X X /* X * spawn -- create a child process with the input from the client X X--- 16,22 ----- X static char tempfile[256]; X #ifndef CNEWS X static char badfile[256]; X+ #endif X X /* X * spawn -- create a child process with the input from the client X*************** X*** 40,46 X * Can time out if XFER_TIMEOUT is defined. X */ X X! spawn(path, name, flag, cont_code, err_code, errbuf) X char *path; X char *name; X char *flag; X X--- 39,45 ----- X * Can time out if XFER_TIMEOUT is defined. X */ X X! spawn(path, name, flag, cont_code, err_code, errbuf, msg_id) X char *path; X char *name; X char *flag; X*************** X*** 47,52 X int cont_code; X int err_code; X char *errbuf; X { X char line[NNTP_STRLEN]; X register char *cp; X X--- 46,52 ----- X int cont_code; X int err_code; X char *errbuf; X+ char *msg_id; X { X char line[NNTP_STRLEN]; X register char *cp; X*************** X*** 53,59 X int i, fd; X int fds[2]; X int pid, npid; X! int exit_status; X #ifdef XFER_TIMEOUT X int xfer_timeout(); X #endif X X--- 53,65 ----- X int i, fd; X int fds[2]; X int pid, npid; X! int exit_status = 1; X! #ifdef POSTER X! char *envp[4], user[sizeof(POSTER) + 5], logname[sizeof(POSTER) + 8]; X! char *home; X! #else X! char *envp[1]; X! #endif X #ifdef XFER_TIMEOUT X int xfer_timeout(); X #endif X*************** X*** 127,134 X (void) unlink(tempfile); X #ifdef SYSLOG X # ifdef LOG X! syslog(LOG_ERR, "%s spawn: EOF before period on line by itself", X! hostname); X # else X syslog(LOG_ERR, "spawn: EOF before period on line by itself"); X # endif X X--- 133,141 ----- X (void) unlink(tempfile); X #ifdef SYSLOG X # ifdef LOG X! syslog(LOG_ERR, X! "%s spawn: EOF before period on line by itself %s", X! hostname, msg_id); X # else X syslog(LOG_ERR, X "spawn: EOF before period on line by itself %s", msg_id); X*************** X*** 130,136 X syslog(LOG_ERR, "%s spawn: EOF before period on line by itself", X hostname); X # else X! syslog(LOG_ERR, "spawn: EOF before period on line by itself"); X # endif X #endif X return (0); X X--- 137,144 ----- X "%s spawn: EOF before period on line by itself %s", X hostname, msg_id); X # else X! syslog(LOG_ERR, X! "spawn: EOF before period on line by itself %s", msg_id); X # endif X #endif X return (0); X*************** X*** 157,162 X * whatever), open "tempfile" for input, thus making X * it stdin, and then execle the inews. We think. X */ X X pid = vfork(); X if (pid == 0) { /* We're in child */ X X--- 165,179 ----- X * whatever), open "tempfile" for input, thus making X * it stdin, and then execle the inews. We think. X */ X+ #ifdef SYSLOG X+ /* X+ * Close in such a way that syslog() will know to reopen. X+ * We must do this before the vfork() otherwise the parent X+ * will think the syslog fd is closed and open a new one, X+ * eventually using up all the available file descriptors. X+ */ X+ closelog(); X+ #endif X X pid = vfork(); X if (pid == 0) { /* We're in child */ X*************** X*** 164,170 X #ifndef USG X if (getuid() == 0) initgroups(POSTER,gid_poster); X #endif X- (void) setuid(uid_poster); X (void) setgid(gid_poster); X #endif X X X--- 181,186 ----- X #ifndef USG X if (getuid() == 0) initgroups(POSTER,gid_poster); X #endif X (void) setgid(gid_poster); X (void) setuid(uid_poster); X #endif X*************** X*** 166,171 X #endif X (void) setuid(uid_poster); X (void) setgid(gid_poster); X #endif X X /* Set up stdout and stderr for child */ X X--- 182,188 ----- X if (getuid() == 0) initgroups(POSTER,gid_poster); X #endif X (void) setgid(gid_poster); X+ (void) setuid(uid_poster); X #endif X X /* Set up stdout and stderr for child */ X*************** X*** 176,185 X } X (void) dup2(1, 2); X X- #ifdef SYSLOG X- /* Close in such a way that syslog() will know to reopen */ X- closelog(); X- #endif X for (i = 3; i < 10; ++i) /* XXX but getdtablesize is too big */ X (void) close(i); X X X--- 193,198 ----- X } X (void) dup2(1, 2); X X for (i = 3; i < 10; ++i) /* XXX but getdtablesize is too big */ X (void) close(i); X X*************** X*** 189,195 X (void) close(fd); X } X X! execle(path, name, flag, (char *) NULL, myenviron); X fprintf(stderr, "spawn: execle(%s)", path); X perror(path); X #ifdef SYSLOG X X--- 202,227 ----- X (void) close(fd); X } X X! /* Empty environment keeps cnews inews from telling lies */ X! #ifdef POSTER X! sprintf(user, "USER=%s", POSTER); X! sprintf(logname, "LOGNAME=%s", POSTER); X! if ((home = (char *)malloc(strlen(home_poster)+5)) != NULL) X! sprintf(home, "HOME=%s", home_poster); X! envp[0] = user; X! envp[1] = logname; X! envp[2] = home; X! envp[3] = 0; X! #else X! envp[0] = 0; X! #endif X! X! #ifdef USG X! /* execle() fails if name is a shell procedure */ X! execle("/bin/sh", "sh", path, flag, (char *)NULL, envp); X! #else X! execle(path, name, flag, (char *) NULL, envp); X! #endif X fprintf(stderr, "spawn: execle(%s)", path); X perror(path); X #ifdef SYSLOG X*************** X*** 231,237 X (void) strcat(errbuf, line); X } X #ifdef SYSLOG X! syslog(LOG_ERR, "%s: %s", path, line); X #endif X } X } X X--- 263,269 ----- X (void) strcat(errbuf, line); X } X #ifdef SYSLOG X! syslog(LOG_INFO, "%s: %s", path, line); X #endif X } X } X*************** X*** 308,310 X } X X #endif XFER_TIMEOUT X X--- 340,343 ----- X } X X #endif XFER_TIMEOUT X+ XIndex: subnet.c XPrereq: 1.6 X*** subnet.c Thu Jul 5 02:29:20 1990 X--- ../../nntp/server/subnet.c Wed Dec 12 02:21:48 1990 X*************** X*** 1,5 X #ifndef lint X! static char *sccsid = "@(#)subnet.c 1.6 (Berkeley) 8/27/89"; X #endif X X #include "../common/conf.h" X X--- 1,5 ----- X #ifndef lint X! static char *sccsid = "@(#)$Header: subnet.c,v 1.8 90/12/12 02:21:38 sob Exp $"; X #endif X X #include "../common/conf.h" X*************** X*** 66,72 X X /* X * Table (eventually, once we malloc) of X! * internet interface subnet informaiton. X */ X static struct in_if *in_ifsni; X X X--- 66,72 ----- X X /* X * Table (eventually, once we malloc) of X! * internet interface subnet information. X */ X static struct in_if *in_ifsni; X X*************** X*** 144,150 X s_in = (struct sockaddr_in *) &ifr->ifr_addr; X in_ifsni[j].i_subnetmask = ntohl(s_in->sin_addr.s_addr); X /* X! * The following should "never happen". But under SunOs X * 3.4, along with the rest of their broken networking code, X * SIOCGIFNETMASK can get a netmask which is 0. There X * really isn't anything that "right" that we can do X X--- 144,150 ----- X s_in = (struct sockaddr_in *) &ifr->ifr_addr; X in_ifsni[j].i_subnetmask = ntohl(s_in->sin_addr.s_addr); X /* X! * The following should "never happen". But under SunOS X * 3.4, along with the rest of their broken networking code, X * SIOCGIFNETMASK can get a netmask which is 0. There X * really isn't anything that "right" that we can do X*************** X*** 231,237 X X /* X * Return the number of bits required to X! * shift right a mask into a getnetent-able entitity. X */ X X bsr(mask) X X--- 231,237 ----- X X /* X * Return the number of bits required to X! * shift right a mask into a getnetent-able entity. X */ X X bsr(mask) X*************** X*** 239,245 X { X register int count = 0; X X! if (mask == 0) /* "never happen", except with SunOs 3.4 */ X return (0); X X while ((mask & 1) == 0) { X X--- 239,245 ----- X { X register int count = 0; X X! if (mask == 0) /* "never happen", except with SunOS 3.4 */ X return (0); X X while ((mask & 1) == 0) { XIndex: time.c XPrereq: 1.11 X*** time.c Thu Jul 5 02:29:20 1990 X--- ../../nntp/server/time.c Sun Jan 13 03:27:23 1991 X*************** X*** 1,5 X #ifndef lint X! static char *sccsid = "@(#)$Header: time.c,v 1.11 90/01/15 01:05:05 sob Exp $"; X #endif X X /* X X--- 1,5 ----- X #ifndef lint X! static char *sccsid = "@(#)$Header: time.c,v 1.13 91/01/13 03:27:14 sob Exp $"; X #endif X X /* X*************** X*** 7,17 X * These may actually be useful in their own right. X */ X X! #include "../common/conf.h" X! X! #include <stdio.h> X! #include <sys/types.h> X! #include <ctype.h> X #ifdef USG X #include <time.h> X #else not USG X X--- 7,13 ----- X * These may actually be useful in their own right. X */ X X! #include "common.h" X #ifdef USG X #include <time.h> X #else not USG X*************** X*** 15,21 X #ifdef USG X #include <time.h> X #else not USG X- #include <strings.h> X #include <sys/time.h> X #endif not USG X X X--- 11,16 ----- X #ifdef USG X #include <time.h> X #else not USG X #include <sys/time.h> X #endif not USG X X*************** X*** 58,65 X (void) strcpy(date, date_ascii); X date_str = date; X X! #ifdef debug X! printf("date_str = %s\n", date_str); X #endif X rhs = date_str + len - 1; X lhs = date_str; X X--- 53,61 ----- X (void) strcpy(date, date_ascii); X date_str = date; X X! #ifdef DEBUG X! if (debug > 1) X! syslog(LOG_DEBUG, "(1) date_str = \"%s\"", date_str); X #endif X rhs = date_str + len - 1; X lhs = date_str; X*************** X*** 73,80 X } X X lhs = date_str; X! #ifdef debug X! printf("date_str = %s\n", date_str); X #endif X X secs = twodigtoi(lhs); X X--- 69,77 ----- X } X X lhs = date_str; X! #ifdef DEBUG X! if (debug > 1) X! syslog(LOG_DEBUG, "(2) date_str = \"%s\"", date_str); X #endif X X secs = twodigtoi(lhs); X*************** X*** 168,174 X { X #ifdef USG X #if !defined(dgux) && !defined(M_XENIX) X! extern int timezone; X #endif X tzset(); X date += timezone; X X--- 165,171 ----- X { X #ifdef USG X #if !defined(dgux) && !defined(M_XENIX) X! extern long timezone; X #endif X tzset(); X date += timezone; X*************** X*** 172,178 X #endif X tzset(); X date += timezone; X! #else not USG X struct timeval tv; X struct timezone tz; X X X--- 169,175 ----- X #endif X tzset(); X date += timezone; X! #else /* not USG */ X struct timeval tv; X struct timezone tz; X X*************** X*** 178,184 X X (void) gettimeofday(&tv, &tz); X date += (long) tz.tz_minuteswest * 60; X! #endif not USG X X /* now fix up local daylight time */ X if (localtime((time_t *)&date)->tm_isdst) X X--- 175,181 ----- X X (void) gettimeofday(&tv, &tz); X date += (long) tz.tz_minuteswest * 60; X! #endif /* not USG */ X X /* now fix up local daylight time */ X if (localtime((time_t *)&date)->tm_isdst) X*************** X*** 203,209 X { X #ifdef USG X #if !defined(dgux) && !defined(M_XENIX) X! extern int timezone; X #endif X tzset(); X date -= timezone; X X--- 200,206 ----- X { X #ifdef USG X #if !defined(dgux) && !defined(M_XENIX) X! extern long timezone; X #endif X tzset(); X date -= timezone; X*************** X*** 207,213 X #endif X tzset(); X date -= timezone; X! #else not USG X struct timeval tv; X struct timezone tz; X X X--- 204,210 ----- X #endif X tzset(); X date -= timezone; X! #else /* not USG */ X struct timeval tv; X struct timezone tz; X X*************** X*** 213,219 X X (void) gettimeofday(&tv, &tz); X date -= (long) tz.tz_minuteswest * 60; X! #endif not USG X X /* now fix up local daylight time */ X if (localtime((time_t *)&date)->tm_isdst) X X--- 210,216 ----- X X (void) gettimeofday(&tv, &tz); X date -= (long) tz.tz_minuteswest * 60; X! #endif /* not USG */ X X /* now fix up local daylight time */ X if (localtime((time_t *)&date)->tm_isdst) XIndex: xhdr.c XPrereq: 1.10 X*** xhdr.c Thu Jul 5 02:29:22 1990 X--- ../../nntp/server/xhdr.c Tue Dec 11 23:59:56 1990 X*************** X*** 1,5 X #ifndef lint X! static char *sccsid = "@(#)$Header: xhdr.c,v 1.10 90/03/09 22:26:05 sob Exp $"; X #endif X X #include "common.h" X X--- 1,5 ----- X #ifndef lint X! static char *sccsid = "@(#)$Header: xhdr.c,v 1.11 90/12/11 23:59:53 sob Exp $"; X #endif X X #include "common.h" X*************** X*** 23,29 X * XHDR subject 5589 retrieve subject of art 5589 only X * XHDR subject <123@ucbvax> retrieve subject of art <123@ucbvax> X * X! * This command is an extention, and not included in RFC 977. X */ X X xhdr(argc, argv) X X--- 23,29 ----- X * XHDR subject 5589 retrieve subject of art 5589 only X * XHDR subject <123@ucbvax> retrieve subject of art <123@ucbvax> X * X! * This command is an extension, and not included in RFC 977. X */ X X xhdr(argc, argv) SHAR_EOF if test 55179 -ne "`wc -c < 'server.pt1.diff'`" then echo shar: error transmitting "'server.pt1.diff'" '(should have been 55179 characters)' fi fi # end of overwriting check echo shar: done with directory "'server'" cd .. # End of shell archive exit 0
nntp@tmc.edu (Stan Barber) (02/11/91)
#! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # support # server # This archive created: Sun Feb 10 14:30:48 1991 export PATH; PATH=/bin:$PATH if test ! -d 'support' then echo shar: creating directory "'support'" mkdir 'support' fi echo shar: entering directory "'support'" cd 'support' echo shar: extracting "'access_file'" '(799 characters)' sed 's/^ X//' << \SHAR_EOF > 'access_file' X# X# Sample NNTP access file. X# Note that "default" must be the first entry in the X# table. Order is important. Put the most restictive X# entried just behind "default" X# X# If you defined SUBNET when you compiled the server, X# this file can have subnets as well as class A, B, C X# networks, hosts, and domains. X# X# host/net read/xfer/no post/no X# X# by default, let anyone transfer news, but not read or post Xdefault xfer no X# bugs, a notorious undergraduate machine, is not allowed X# to read or post news at all. Xbugs.berkeley.edu no no X# ic can read and post news, but users on ic cannot read X# articles in the group ucb.postgres or any of its decendents X# (e.g., ucb.postgres.core) Xic read post !ucb.postgres X# hosts on the Berkeley campus can read and post news X*.berkeley.edu read post SHAR_EOF if test 799 -ne "`wc -c < 'access_file'`" then echo shar: error transmitting "'access_file'" '(should have been 799 characters)' fi echo shar: done with directory "'support'" cd .. if test ! -d 'server' then echo shar: creating directory "'server'" mkdir 'server' fi echo shar: entering directory "'server'" cd 'server' echo shar: extracting "'server.pt2.diff'" '(28993 characters)' if test -f 'server.pt2.diff' then echo shar: will not over-write existing file "'server.pt2.diff'" else sed 's/^ X//' << \SHAR_EOF > 'server.pt2.diff' XIndex: Makefile XPrereq: 1.2 X*** Makefile Thu Jul 5 02:29:07 1990 X--- ../../nntp/server/Makefile Sat Dec 22 10:16:13 1990 X*************** X*** 1,4 X! # $Header: Makefile,v 1.2 90/07/05 02:22:37 sob Exp $ X # Makefile for NNTP server X # X X X--- 1,4 ----- X! # $Header: Makefile,v 1.3 90/12/22 10:16:02 sob Exp $ X # Makefile for NNTP server X # X X*************** X*** 6,12 X ahbs.o globals.o group.o help.o ihave.o list.o misc.o netaux.o \ X newgroups.o newnews.o nextlast.o ngmatch.o post.o parsit.o scandir.o \ X slave.o spawn.o strcasecmp.o subnet.o time.o xhdr.o fakesyslog.o \ X! batch.o putenv.o auth.o ../common/version.o X X SRVRSRC = main.c serve.c access.c access_inet.c access_dnet.c active.c \ X ahbs.c globals.c group.c help.c ihave.c list.c misc.c netaux.c \ X X--- 6,12 ----- X ahbs.o globals.o group.o help.o ihave.o list.o misc.o netaux.o \ X newgroups.o newnews.o nextlast.o ngmatch.o post.o parsit.o scandir.o \ X slave.o spawn.o strcasecmp.o subnet.o time.o xhdr.o fakesyslog.o \ X! batch.o auth.o timer.o ../common/version.o X X SRVRSRC = main.c serve.c access.c access_inet.c access_dnet.c active.c \ X ahbs.c globals.c group.c help.c ihave.c list.c misc.c netaux.c \ X*************** X*** 12,18 X ahbs.c globals.c group.c help.c ihave.c list.c misc.c netaux.c \ X newgroups.c newnews.c nextlast.c ngmatch.c post.c parsit.c scandir.c \ X slave.c spawn.c strcasecmp.c subnet.c time.c xhdr.c fakesyslog.c \ X! batch.c putenv.c auth.c ../common/version.c X X SRVRINC = common.h ../common/conf.h ../common/nntp.h X X X--- 12,18 ----- X ahbs.c globals.c group.c help.c ihave.c list.c misc.c netaux.c \ X newgroups.c newnews.c nextlast.c ngmatch.c post.c parsit.c scandir.c \ X slave.c spawn.c strcasecmp.c subnet.c time.c xhdr.c fakesyslog.c \ X! batch.c auth.c timer.c ../common/version.c X X SRVRINC = common.h ../common/conf.h ../common/nntp.h timer.h X X*************** X*** 14,20 X slave.c spawn.c strcasecmp.c subnet.c time.c xhdr.c fakesyslog.c \ X batch.c putenv.c auth.c ../common/version.c X X! SRVRINC = common.h ../common/conf.h ../common/nntp.h X X SRCS = ${SRVRSRC} X X X--- 14,20 ----- X slave.c spawn.c strcasecmp.c subnet.c time.c xhdr.c fakesyslog.c \ X batch.c auth.c timer.c ../common/version.c X X! SRVRINC = common.h ../common/conf.h ../common/nntp.h timer.h X X SRCS = ${SRVRSRC} X X*************** X*** 52,58 X sccs prt -y *.[ch] > /dev/null X X tags: ${SRVRSRC} ${SRVRINC} X! ctags ${SRVRSRC} ${SRVRINC} X X # Dependencies X X X--- 52,58 ----- X sccs prt -y *.[ch] > /dev/null X X tags: ${SRVRSRC} ${SRVRINC} X! ctags -wt ${SRVRSRC} ${SRVRINC} X X # Dependencies X X*** README Thu Jul 5 02:29:07 1990 X--- ../../nntp/server/README Sun Oct 28 10:40:20 1990 X*************** X*** 48,54 X yellow pages. X X Don't forget to kill -HUP your inetd (or kill it and restart X! it if you are on SunOS). X X If you're NOT using inetd, X X X--- 48,54 ----- X yellow pages. X X Don't forget to kill -HUP your inetd (or kill it and restart X! it if you are on SunOS prior to version 4.1). X X If you're NOT using inetd, X X*** batch.c Sat Aug 25 16:59:48 1990 X--- ../../nntp/server/batch.c Sun Jan 13 03:27:43 1991 X*************** X*** 1,5 X #ifndef lint X! static char *rcsid = "@(#)Header: batch.c,v 1.5 90/08/02 13:32:10 sob Exp $"; X #endif X /* X * Batch subroutine for Cnews. X X--- 1,5 ----- X #ifndef lint X! static char *rcsid = "@(#)$Header: batch.c,v 1.15 91/01/13 03:27:26 sob Exp $"; X #endif X /* X * Batch subroutine for Cnews. X*************** X*** 30,37 X /* imports */ X extern time_t time(); X extern char *malloc(), *mktemp(), *index(), *rindex(); X- extern char **myenviron; X- X /* forwards */ X static char *strsave(); X static int xfer_timeout(); X X--- 30,35 ----- X /* imports */ X extern time_t time(); X extern char *malloc(), *mktemp(), *index(), *rindex(); X /* forwards */ X static char *strsave(); X #ifdef XFER_TIMEOUT X*************** X*** 34,39 X X /* forwards */ X static char *strsave(); X static int xfer_timeout(); X static int cpstdin(); X static int appbatch(); X X--- 32,38 ----- X extern char *malloc(), *mktemp(), *index(), *rindex(); X /* forwards */ X static char *strsave(); X+ #ifdef XFER_TIMEOUT X static int xfer_timeout(); X #endif X static int cpstdin(); X*************** X*** 35,40 X /* forwards */ X static char *strsave(); X static int xfer_timeout(); X static int cpstdin(); X static int appbatch(); X static int enqueue(); X X--- 34,40 ----- X static char *strsave(); X #ifdef XFER_TIMEOUT X static int xfer_timeout(); X+ #endif X static int cpstdin(); X static int appbatch(); X static int enqueue(); X*************** X*** 47,52 X static char *endart = art; /* points just past end of article */ X static int incore = YES; X X static struct batch_file { X char *name; X FILE *file; X X--- 47,57 ----- X static char *endart = art; /* points just past end of article */ X static int incore = YES; X X+ #ifdef NONEWSRUN X+ static int uniq = 0; /* unique counter for this process */ X+ static int in_batchdir = NO; X+ X+ #endif /* NONEWSRUN */ X static struct batch_file { X char *name; X FILE *file; X*************** X*** 53,58 X char isopen; X time_t start; /* time of creation */ X off_t size; /* current size */ X } btch = { NULL, NULL, NO, 0, 0 }; X X /* X X--- 58,64 ----- X char isopen; X time_t start; /* time of creation */ X off_t size; /* current size */ X+ int arts; /* number of articles */ X } btch = { NULL, NULL, NO, 0, 0 }; X X /* X*************** X*** 68,74 X * Can time out if XFER_TIMEOUT is defined. X */ X int X! batch_input_article(cont_code, err_code, errbuf) X int cont_code, err_code; X char *errbuf; X { X X--- 74,80 ----- X * Can time out if XFER_TIMEOUT is defined. X */ X int X! batch_input_article(cont_code, err_code, errbuf, msg_id) X int cont_code, err_code; X char *errbuf; X char *msg_id; X*************** X*** 71,76 X batch_input_article(cont_code, err_code, errbuf) X int cont_code, err_code; X char *errbuf; X { X int status = 1; /* okay status */ X X X--- 77,83 ----- X batch_input_article(cont_code, err_code, errbuf, msg_id) X int cont_code, err_code; X char *errbuf; X+ char *msg_id; X { X int status = 1; /* okay status */ X X*************** X*** 79,84 X signal(SIGQUIT, SIG_IGN); X signal(SIGHUP, SIG_IGN); X X if (btch.name == NULL) { X /* BATCH_FILE may trigger unprivileged() */ X btch.name = mktemp(strsave(BATCH_FILE)); X X--- 86,102 ----- X signal(SIGQUIT, SIG_IGN); X signal(SIGHUP, SIG_IGN); X X+ #ifdef NONEWSRUN X+ /* This really should be done in main.c so that we don't have to X+ check each time we get a new article - sigh */ X+ X+ if (!in_batchdir) X+ if (chdir(INDIR) < 0) X+ syslog(LOG_ERR, "chdir(%s) failed", INDIR); X+ else X+ in_batchdir = YES; X+ X+ #endif /* NONEWSRUN */ X if (btch.name == NULL) { X /* BATCH_FILE may trigger unprivileged() */ X btch.name = mktemp(strsave(BATCH_FILE)); X*************** X*** 89,95 X #ifdef UMASK X (void) umask(UMASK); X #endif X! if (!cpstdin(cont_code, err_code, errbuf)) /* may create tempfile */ X return 0; X #ifdef POSTER X if (tempfile[0]) X X--- 107,114 ----- X #ifdef UMASK X (void) umask(UMASK); X #endif X! /* may create tempfile */ X! if (!cpstdin(cont_code, err_code, errbuf, msg_id)) X return 0; X #ifdef POSTER X if (tempfile[0]) X*************** X*** 96,101 X (void) chown(tempfile, uid_poster, gid_poster); X #endif X status = appbatch(); X if (tempfile[0] != '\0') X (void) unlink(tempfile); X if (status == 1 && oktorunbatch()) X X--- 115,121 ----- X (void) chown(tempfile, uid_poster, gid_poster); X #endif X status = appbatch(); X+ btch.arts++; X if (tempfile[0] != '\0') X (void) unlink(tempfile); X if (status == 1 && oktorunbatch()) X*************** X*** 111,118 X if (!btch.isopen || fstat(fileno(btch.file), &stbuf) < 0) X return NO; X btch.size = stbuf.st_size; X! return btch.size > TOOBIG || X! btch.size > 0 && time((time_t *)NULL) - btch.start > TOOOLD; X } X X /* X X--- 131,138 ----- X if (!btch.isopen || fstat(fileno(btch.file), &stbuf) < 0) X return NO; X btch.size = stbuf.st_size; X! return(btch.arts >= TOOMANY || btch.size > TOOBIG || X! btch.size > 0 && time((time_t *)NULL) - btch.start > TOOOLD); X } X X /* X*************** X*** 121,127 X */ X /* ARGSUSED errbuf */ X static int /* boolean: got article ok? */ X! cpstdin(cont_code, err_code, errbuf) X int cont_code, err_code; X char *errbuf; X { X X--- 141,147 ----- X */ X /* ARGSUSED errbuf */ X static int /* boolean: got article ok? */ X! cpstdin(cont_code, err_code, errbuf, msg_id) X int cont_code, err_code; X char *errbuf, *msg_id; X { X*************** X*** 123,129 X static int /* boolean: got article ok? */ X cpstdin(cont_code, err_code, errbuf) X int cont_code, err_code; X! char *errbuf; X { X register FILE *tfp = NULL; X register char *cp, *realline; X X--- 143,149 ----- X static int /* boolean: got article ok? */ X cpstdin(cont_code, err_code, errbuf, msg_id) X int cont_code, err_code; X! char *errbuf, *msg_id; X { X register FILE *tfp = NULL; X register char *cp, *realline; X*************** X*** 206,213 X (void) unlink(tempfile); X #ifdef SYSLOG X #ifdef LOG X! syslog(LOG_ERR, "%s spawn: EOF before period on line by itself", X! hostname); X #else X syslog(LOG_ERR, "spawn: EOF before period on line by itself"); X #endif X X--- 226,234 ----- X (void) unlink(tempfile); X #ifdef SYSLOG X #ifdef LOG X! syslog(LOG_ERR, X! "%s cpstdin: EOF before period on line by itself %s", X! hostname, msg_id); X #else X syslog(LOG_ERR, X "cpstdin: EOF before period on line by itself %s", msg_id); X*************** X*** 209,215 X syslog(LOG_ERR, "%s spawn: EOF before period on line by itself", X hostname); X #else X! syslog(LOG_ERR, "spawn: EOF before period on line by itself"); X #endif X #endif X return 0; X X--- 230,237 ----- X "%s cpstdin: EOF before period on line by itself %s", X hostname, msg_id); X #else X! syslog(LOG_ERR, X! "cpstdin: EOF before period on line by itself %s", msg_id); X #endif X #endif X return 0; X*************** X*** 259,265 X btch.file = fopen(btch.name, "a"); X if (btch.file == NULL) { X #ifdef SYSLOG X! syslog(LOG_ERR,"appbatch(): %s: %m", btch.name); X #endif X return 0; X } X X--- 281,287 ----- X btch.file = fopen(btch.name, "a"); X if (btch.file == NULL) { X #ifdef SYSLOG X! syslog(LOG_ERR,"appbatch: fopen: %s: %m", btch.name); X #endif X return 0; X } X*************** X*** 264,270 X return 0; X } X btch.isopen = YES; X- btch.size = 0; X btch.start = time(&btch.start); X } X X X--- 286,291 ----- X return 0; X } X btch.isopen = YES; X btch.start = time(&btch.start); X btch.size = 0; X btch.arts = 0; X*************** X*** 266,271 X btch.isopen = YES; X btch.size = 0; X btch.start = time(&btch.start); X } X X /* find article size and write the article */ X X--- 287,294 ----- X } X btch.isopen = YES; X btch.start = time(&btch.start); X+ btch.size = 0; X+ btch.arts = 0; X } X X /* find article size and write the article */ X*************** X*** 278,284 X if (fstat(fileno(tfp), &stbuf) >= 0) X size = stbuf.st_size; X } X! (void) fprintf(btch.file, "#! rnews %ld\n", size); X X /* copy the article to the batch file */ X if (incore) X X--- 301,307 ----- X if (fstat(fileno(tfp), &stbuf) >= 0) X size = stbuf.st_size; X } X! (void) fprintf(btch.file, "#! rnews %ld %s\n", size, hostname); X X /* copy the article to the batch file */ X if (incore) X*************** X*** 287,293 X while ((bytes = fread(artbuf, 1, sizeof artbuf, tfp)) > 0) X if (fwrite(artbuf, 1, bytes, btch.file) != bytes) { X #ifdef SYSLOG X! syslog(LOG_ERR,"can't write %s", btch.name); X #endif X status = 0; /* hmm, #! count is off */ X break; X X--- 310,318 ----- X while ((bytes = fread(artbuf, 1, sizeof artbuf, tfp)) > 0) X if (fwrite(artbuf, 1, bytes, btch.file) != bytes) { X #ifdef SYSLOG X! syslog(LOG_ERR, X! "enqueue: fwrite can't write %s", X! btch.name); X #endif X status = 0; /* hmm, #! count is off */ X break; X*************** X*** 296,302 X } X if (fflush(btch.file) == EOF) { X #ifdef SYSLOG X! syslog(LOG_ERR,"can't write %s", btch.name); X #endif X status = 0; X } X X--- 321,327 ----- X } X if (fflush(btch.file) == EOF) { X #ifdef SYSLOG X! syslog(LOG_ERR, "enqueue: fflush: %s", btch.name); X #endif X status = 0; X } X*************** X*** 338,343 X int pid, wpid, status, fd, exitstat; X char permname[MAXDIGITS], *number = permname, *newsrun; X struct stat stbuf; X X (void) fclose(btch.file); X btch.file = NULL; X X--- 363,374 ----- X int pid, wpid, status, fd, exitstat; X char permname[MAXDIGITS], *number = permname, *newsrun; X struct stat stbuf; X+ #ifdef POSTER X+ char *envp[4], user[sizeof(POSTER) + 5], logname[sizeof(POSTER) + 8]; X+ char *home; X+ #else X+ char *envp[1]; X+ #endif X X if (fclose(btch.file) != 0) { X #ifdef SYSLOG X*************** X*** 339,345 X char permname[MAXDIGITS], *number = permname, *newsrun; X struct stat stbuf; X X! (void) fclose(btch.file); X btch.file = NULL; X btch.isopen = NO; X btch.start = 0; X X--- 370,380 ----- X char *envp[1]; X #endif X X! if (fclose(btch.file) != 0) { X! #ifdef SYSLOG X! syslog(LOG_ERR, "enqueue: fclose: %m"); X! #endif X! } X btch.file = NULL; X btch.isopen = NO; X btch.start = 0; X*************** X*** 344,349 X btch.isopen = NO; X btch.start = 0; X btch.size = 0; X X (void) fflush(stdout); X (void) fflush(stderr); X X--- 379,385 ----- X btch.isopen = NO; X btch.start = 0; X btch.size = 0; X+ btch.arts = 0; X X (void) fflush(stdout); X (void) fflush(stderr); X*************** X*** 347,352 X X (void) fflush(stdout); X (void) fflush(stderr); X pid = fork(); X if (pid == -1) { X #ifdef SYSLOG X X--- 383,389 ----- X X (void) fflush(stdout); X (void) fflush(stderr); X+ #ifndef NONEWSRUN X pid = fork(); X if (pid == -1) { X #ifdef SYSLOG X*************** X*** 350,356 X pid = fork(); X if (pid == -1) { X #ifdef SYSLOG X! syslog(LOG_ERR,"can't fork"); X #endif X return 0; X } else if (pid != 0) { /* parent */ X X--- 387,393 ----- X pid = fork(); X if (pid == -1) { X #ifdef SYSLOG X! syslog(LOG_ERR, "enqueue: fork: %m"); X #endif X return 0; X } else if (pid != 0) { /* parent */ X*************** X*** 365,370 X #endif X return exitstat != 0? -1 :1; X } X #ifdef POSTER X #ifndef USG X if (getuid() == 0) initgroups(POSTER,gid_poster); X X--- 402,408 ----- X #endif X return exitstat != 0? -1 :1; X } X+ #endif /* NONEWSRUN */ X #ifdef POSTER X #ifndef USG X if (getuid() == 0) initgroups(POSTER,gid_poster); X*************** X*** 369,375 X #ifndef USG X if (getuid() == 0) initgroups(POSTER,gid_poster); X #endif X- (void) setuid(uid_poster); X (void) setgid(gid_poster); X #endif X X X--- 407,412 ----- X #ifndef USG X if (getuid() == 0) initgroups(POSTER,gid_poster); X #endif X (void) setgid(gid_poster); X (void) setuid(uid_poster); X #endif X*************** X*** 371,376 X #endif X (void) setuid(uid_poster); X (void) setgid(gid_poster); X #endif X X /* child: must exit */ X X--- 408,414 ----- X if (getuid() == 0) initgroups(POSTER,gid_poster); X #endif X (void) setgid(gid_poster); X+ (void) setuid(uid_poster); X #endif X #ifndef NONEWSRUN X /* child: must exit */ X*************** X*** 372,378 X (void) setuid(uid_poster); X (void) setgid(gid_poster); X #endif X! X /* child: must exit */ X #ifdef SYSLOG X /* Close in such a way that syslog() will know to reopen */ X X--- 410,416 ----- X (void) setgid(gid_poster); X (void) setuid(uid_poster); X #endif X! #ifndef NONEWSRUN X /* child: must exit */ X #ifdef SYSLOG X /* Close in such a way that syslog() will know to reopen */ X*************** X*** 382,388 X (void) close(fd); X if (chdir(INDIR) < 0) { X #ifdef SYSLOG X! syslog(LOG_ERR, "chdir(%s) failed", INDIR); X #else X ; X #endif X X--- 420,426 ----- X (void) close(fd); X if (chdir(INDIR) < 0) { X #ifdef SYSLOG X! syslog(LOG_ERR, "enqueue: chdir(%s): %m", INDIR); X #else X ; X #endif X*************** X*** 390,395 X X /* rename btch.name to a number so newsrun will see it */ X sprintf(number, "%ld", (long)time(&now)); X while (link(btch.name, permname) < 0) { X if (stat(btch.name, &stbuf) < 0) X break; X X--- 428,436 ----- X X /* rename btch.name to a number so newsrun will see it */ X sprintf(number, "%ld", (long)time(&now)); X+ #else X+ sprintf(number, "%d.%d", getpid(), uniq++); X+ #endif /* NONEWSRUN */ X while (link(btch.name, permname) < 0) { X if (stat(btch.name, &stbuf) < 0) X break; X*************** X*** 394,399 X if (stat(btch.name, &stbuf) < 0) X break; X sleep(2); X sprintf(number, "%ld", (long)time(&now)); X } X if (unlink(btch.name) < 0) X X--- 435,441 ----- X if (stat(btch.name, &stbuf) < 0) X break; X sleep(2); X+ #ifndef NONEWSRUN X sprintf(number, "%ld", (long)time(&now)); X #else X sprintf(number, "%d.%d", getpid(), uniq++); X*************** X*** 395,400 X break; X sleep(2); X sprintf(number, "%ld", (long)time(&now)); X } X if (unlink(btch.name) < 0) X #ifdef SYSLOG X X--- 437,445 ----- X sleep(2); X #ifndef NONEWSRUN X sprintf(number, "%ld", (long)time(&now)); X+ #else X+ sprintf(number, "%d.%d", getpid(), uniq++); X+ #endif /* NONEWSRUN */ X } X if (unlink(btch.name) < 0) { X #ifdef SYSLOG X*************** X*** 396,402 X sleep(2); X sprintf(number, "%ld", (long)time(&now)); X } X! if (unlink(btch.name) < 0) X #ifdef SYSLOG X syslog(LOG_ERR, "cannot find %s", btch.name); X #else X X--- 441,447 ----- X sprintf(number, "%d.%d", getpid(), uniq++); X #endif /* NONEWSRUN */ X } X! if (unlink(btch.name) < 0) { X #ifdef SYSLOG X syslog(LOG_ERR, "enqueue: cannot unlink %s: %m", btch.name); X #endif X*************** X*** 398,406 X } X if (unlink(btch.name) < 0) X #ifdef SYSLOG X! syslog(LOG_ERR, "cannot find %s", btch.name); X! #else X! ; X #endif X X signal(SIGINT, SIG_IGN); X X--- 443,449 ----- X } X if (unlink(btch.name) < 0) { X #ifdef SYSLOG X! syslog(LOG_ERR, "enqueue: cannot unlink %s: %m", btch.name); X #endif X } X #ifndef NONEWSRUN X*************** X*** 402,407 X #else X ; X #endif X X signal(SIGINT, SIG_IGN); X signal(SIGQUIT, SIG_IGN); X X--- 445,452 ----- X #ifdef SYSLOG X syslog(LOG_ERR, "enqueue: cannot unlink %s: %m", btch.name); X #endif X+ } X+ #ifndef NONEWSRUN X X signal(SIGINT, SIG_IGN); X signal(SIGQUIT, SIG_IGN); X*************** X*** 411,417 X newsrun = strsave(NEWSRUN); X if (newsrun == NULL) X newsrun = "/usr/lib/newsbin/input/newsrun"; X! execle(newsrun, newsrun, (char *)NULL, myenviron); X #ifdef SYSLOG X syslog(LOG_ERR, "enqueue: execle(%s): %m", newsrun); X #endif X X--- 456,481 ----- X newsrun = strsave(NEWSRUN); X if (newsrun == NULL) X newsrun = "/usr/lib/newsbin/input/newsrun"; X! X! /* Empty environment keeps cnews inews from telling lies */ X! #ifdef POSTER X! sprintf(user, "USER=%s", POSTER); X! sprintf(logname, "LOGNAME=%s", POSTER); X! if ((home = (char *)malloc(strlen(home_poster)+5)) != NULL) X! sprintf(home, "HOME=%s", home_poster); X! envp[0] = user; X! envp[1] = logname; X! envp[2] = home; X! envp[3] = 0; X! #else X! envp[0] = 0; X! #endif X! #ifdef USG X! /* execle() fails because newsrun is a shell procedure */ X! execle("/bin/sh", "sh", newsrun, (char *)NULL, envp); X! #else X! execle(newsrun, newsrun, (char *)NULL, envp); X! #endif X #ifdef SYSLOG X syslog(LOG_ERR, "enqueue: execle(%s): %m", newsrun); X #endif X*************** X*** 417,422 X #endif X exit(1); X /* NOTREACHED */ X } X static char * X strsave(s) X X--- 481,489 ----- X #endif X exit(1); X /* NOTREACHED */ X+ #else X+ return(1); X+ #endif /* NONEWSRUN */ X } X X static char * X*************** X*** 418,423 X exit(1); X /* NOTREACHED */ X } X static char * X strsave(s) X register char *s; X X--- 485,491 ----- X return(1); X #endif /* NONEWSRUN */ X } X+ X static char * X strsave(s) X register char *s; XIndex: common.h XPrereq: 1.33 X*** common.h Sat Aug 25 17:00:35 1990 X--- ../../nntp/server/common.h Sat Feb 2 15:55:37 1991 X*************** X*** 1,7 X /* X * Common declarations, includes, and other goodies. X * X! * @(#)$Header: common.h,v 1.33 90/08/25 17:00:11 sob Exp $ X */ X X X X--- 1,7 ----- X /* X * Common declarations, includes, and other goodies. X * X! * @(#)$Header: common.h,v 1.38 91/02/02 15:55:21 sob Exp $ X */ X X X*************** X*** 5,10 X */ X X X #include <stdio.h> X #include <sys/types.h> X #include <sys/stat.h> X X--- 5,11 ----- X */ X X X+ #include "../common/conf.h" X #include <stdio.h> X #ifndef BSD_42 X #include <sys/types.h> X*************** X*** 6,11 X X X #include <stdio.h> X #include <sys/types.h> X #include <sys/stat.h> X #include <errno.h> X X--- 7,13 ----- X X #include "../common/conf.h" X #include <stdio.h> X+ #ifndef BSD_42 X #include <sys/types.h> X #endif /* BSD_42 */ X #include <sys/param.h> X*************** X*** 7,12 X X #include <stdio.h> X #include <sys/types.h> X #include <sys/stat.h> X #include <errno.h> X #include <ctype.h> X X--- 9,16 ----- X #include <stdio.h> X #ifndef BSD_42 X #include <sys/types.h> X+ #endif /* BSD_42 */ X+ #include <sys/param.h> X #include <sys/stat.h> X #include <errno.h> X #include <ctype.h> X*************** X*** 12,18 X #include <ctype.h> X #include <pwd.h> X #include <sys/file.h> X- #include <sys/param.h> X #ifdef BSD2_10 X #include <short_names.h> X #endif BSD2_10 X X--- 16,21 ----- X #include <ctype.h> X #include <pwd.h> X #include <sys/file.h> X #ifdef BSD2_10 X #include <short_names.h> X #endif /* BSD2_10 */ X*************** X*** 15,21 X #include <sys/param.h> X #ifdef BSD2_10 X #include <short_names.h> X! #endif BSD2_10 X X #include "../common/nntp.h" X #include "../common/conf.h" X X--- 18,24 ----- X #include <sys/file.h> X #ifdef BSD2_10 X #include <short_names.h> X! #endif /* BSD2_10 */ X X #include "../common/nntp.h" X X*************** X*** 18,24 X #endif BSD2_10 X X #include "../common/nntp.h" X- #include "../common/conf.h" X X #ifdef SYSLOG X # ifdef FAKESYSLOG X X--- 21,26 ----- X #endif /* BSD2_10 */ X X #include "../common/nntp.h" X X #ifdef SYSLOG X # ifdef FAKESYSLOG X*************** X*** 32,38 X extern struct passwd *getpwent(), *getpwuid(), *getpwnam(); X #define iolen_t unsigned X # include <string.h> X! #else not USG X # include <strings.h> X # include <sys/wait.h> X #define iolen_t int X X--- 34,40 ----- X extern struct passwd *getpwent(), *getpwuid(), *getpwnam(); X #define iolen_t unsigned X # include <string.h> X! #else /* not USG */ X # include <strings.h> X # include <sys/wait.h> X #define iolen_t int X*************** X*** 36,42 X # include <strings.h> X # include <sys/wait.h> X #define iolen_t int X! #endif not USG X X #ifdef NDIR X #ifdef M_XENIX X X--- 38,44 ----- X # include <strings.h> X # include <sys/wait.h> X #define iolen_t int X! #endif /* not USG */ X X #ifdef NDIR X #ifdef M_XENIX X*************** X*** 44,50 X #else X # include <ndir.h> X #endif X! #else not NDIR X # include <sys/dir.h> X #endif not NDIR X X X--- 46,52 ----- X #else X # include <ndir.h> X #endif X! #else /* not NDIR */ X # include <sys/dir.h> X #endif /* not NDIR */ X X*************** X*** 46,52 X #endif X #else not NDIR X # include <sys/dir.h> X! #endif not NDIR X X #ifdef FCNTL X # include <fcntl.h> X X--- 48,54 ----- X #endif X #else /* not NDIR */ X # include <sys/dir.h> X! #endif /* not NDIR */ X X #ifdef FCNTL X # include <fcntl.h> X*************** X*** 50,56 X X #ifdef FCNTL X # include <fcntl.h> X! #endif FCNTL X X #ifdef ultrix X extern char * index(); X X--- 52,58 ----- X X #ifdef FCNTL X # include <fcntl.h> X! #endif /* FCNTL */ X X #ifdef ultrix X extern char * index(); X*************** X*** 71,76 X # undef NULL X # define NULL 0 X # endif /* DBZ */ X #endif /* DBM */ X X #ifdef NDBM X X--- 73,82 ----- X # undef NULL X # define NULL 0 X # endif /* DBZ */ X+ #else X+ # ifdef NDBM X+ # include <ndbm.h> X+ # endif /* NDBM */ X #endif /* DBM */ X X #ifdef TIMEOUT X*************** X*** 73,80 X # endif /* DBZ */ X #endif /* DBM */ X X! #ifdef NDBM X! # include <ndbm.h> X #endif X /* X * Some generic maximums. X X--- 79,87 ----- X # endif /* NDBM */ X #endif /* DBM */ X X! #ifdef TIMEOUT X! #ifndef TIMERS X! #define TIMERS X #endif X #endif X X*************** X*** 76,81 X #ifdef NDBM X # include <ndbm.h> X #endif X /* X * Some generic maximums. X */ X X--- 83,102 ----- X #ifndef TIMERS X #define TIMERS X #endif X+ #endif X+ X+ #ifdef LOGINCHECK X+ #ifndef TIMERS X+ #define TIMERS X+ #endif X+ #endif X+ X+ #ifdef BATCHCHECK X+ #ifndef TIMERS X+ #define TIMERS X+ #endif X+ #endif X+ X /* X * Some generic maximums. X */ X*************** X*** 82,88 X X #ifndef MAXPATHLEN X #define MAXPATHLEN 1024 X! #endif not MAXPATHLEN X X #ifndef MAXHOSTNAMELEN X #define MAXHOSTNAMELEN 256 X X--- 103,109 ----- X X #ifndef MAXPATHLEN X #define MAXPATHLEN 1024 X! #endif X X #ifndef MAXHOSTNAMELEN X #define MAXHOSTNAMELEN 256 X*************** X*** 86,92 X X #ifndef MAXHOSTNAMELEN X #define MAXHOSTNAMELEN 256 X! #endif not MAXHOSTNAMELEN X X #ifndef MINFREE X #define MINFREE 0 X X--- 107,113 ----- X X #ifndef MAXHOSTNAMELEN X #define MAXHOSTNAMELEN 256 X! #endif X X #ifndef MINFREE X #define MINFREE 0 X*************** X*** 126,131 X extern char *gethistent(); X extern int restreql(); X extern int s1strneql(); /* for ngmatch */ X X extern char spooldir[]; X extern char activefile[]; X X--- 147,158 ----- X extern char *gethistent(); X extern int restreql(); X extern int s1strneql(); /* for ngmatch */ X+ #ifdef DEBUG X+ void debugup(), debugdown(); X+ #endif X+ #ifdef SETPROCTITLE X+ void setproctitle(); X+ #endif X X extern char spooldir[]; X extern char activefile[]; X*************** X*** 143,148 X extern char *homedir; X extern int ingroup; X extern int maxgroups; X extern int art_array[]; X extern int art_ptr; X extern FILE *art_fp; X X--- 170,179 ----- X extern char *homedir; X extern int ingroup; X extern int maxgroups; X+ #ifdef DYNAMIC_ART_ARRAY X+ extern int *art_array; X+ extern unsigned int size_art_array; X+ #else X extern int art_array[]; X #endif X extern int art_ptr; X*************** X*** 144,149 X extern int ingroup; X extern int maxgroups; X extern int art_array[]; X extern int art_ptr; X extern FILE *art_fp; X extern int num_arts; X X--- 175,181 ----- X extern unsigned int size_art_array; X #else X extern int art_array[]; X+ #endif X extern int art_ptr; X extern FILE *art_fp; X extern int num_arts; X*************** X*** 148,153 X extern FILE *art_fp; X extern int num_arts; X extern int uid_poster, gid_poster; X extern int canread, canpost, canxfer; X extern char **ngpermlist; X extern int ngpermcount; X X--- 180,186 ----- X extern FILE *art_fp; X extern int num_arts; X extern int uid_poster, gid_poster; X+ extern char *home_poster; X extern int canread, canpost, canxfer; X extern char **ngpermlist; X extern int ngpermcount; X*************** X*** 155,160 X extern char nntp_version[]; X X extern char hostname[]; X X #ifdef LOG X extern int grps_acsd, arts_acsd; X X--- 188,194 ----- X extern char nntp_version[]; X X extern char hostname[]; X+ extern int debug; X X #ifdef LOG X extern int grps_acsd, arts_acsd; XIndex: globals.c XPrereq: 1.7 X*** globals.c Thu Jul 5 23:09:18 1990 X--- ../../nntp/server/globals.c Sat Feb 2 15:55:43 1991 X*************** X*** 1,5 X #ifndef lint X! static char *sccsid = "@(#)$Header: globals.c,v 1.7 90/07/05 23:09:11 sob Exp $"; X #endif X X /* X X--- 1,5 ----- X #ifndef lint X! static char *sccsid = "@(#)$Header: globals.c,v 1.10 91/02/02 15:55:37 sob Exp $"; X #endif X X /* X*************** X*** 36,41 X int ingroup = 0; X int art_ptr; X int num_arts; X int art_array[MAX_ARTICLES]; X FILE *art_fp; X int uid_poster, gid_poster; X X--- 36,45 ----- X int ingroup = 0; X int art_ptr; X int num_arts; X+ #ifdef DYNAMIC_ART_ARRAY X+ int *art_array = 0; /* dynamic array */ X+ unsigned int size_art_array = 0; /* current size of art_array */ X+ #else X int art_array[MAX_ARTICLES]; X #endif X FILE *art_fp; X*************** X*** 37,42 X int art_ptr; X int num_arts; X int art_array[MAX_ARTICLES]; X FILE *art_fp; X int uid_poster, gid_poster; X int canpost, canread, canxfer; X X--- 41,47 ----- X unsigned int size_art_array = 0; /* current size of art_array */ X #else X int art_array[MAX_ARTICLES]; X+ #endif X FILE *art_fp; X int uid_poster, gid_poster; X char *home_poster; X*************** X*** 39,44 X int art_array[MAX_ARTICLES]; X FILE *art_fp; X int uid_poster, gid_poster; X int canpost, canread, canxfer; X char **ngpermlist; X int ngpermcount; X X--- 44,50 ----- X #endif X FILE *art_fp; X int uid_poster, gid_poster; X+ char *home_poster; X int canpost, canread, canxfer; X char **ngpermlist; X int ngpermcount; X*************** X*** 43,48 X char **ngpermlist; X int ngpermcount; X char hostname[256]; X X #ifdef AUTH X int Needauth; /* 1 if we need to do authorization */ X X--- 49,55 ----- X char **ngpermlist; X int ngpermcount; X char hostname[256]; X+ int debug; X X #ifdef AUTH X int Needauth; /* 1 if we need to do authorization */ SHAR_EOF if test 28993 -ne "`wc -c < 'server.pt2.diff'`" then echo shar: error transmitting "'server.pt2.diff'" '(should have been 28993 characters)' fi fi # end of overwriting check echo shar: extracting "'timer.c'" '(3900 characters)' if test -f 'timer.c' then echo shar: will not over-write existing file "'timer.c'" else sed 's/^ X//' << \SHAR_EOF > 'timer.c' X/* X * Machinery to run routines off timers. X */ X#include "common.h" X X#ifdef TIMERS X#ifndef lint Xstatic char rcsid[] = X "@(#) $Header: timer.c,v 1.2 90/12/27 22:16:27 sob Exp $ (NNTP with TIMERS)"; X#endif X#else X#ifndef lint Xstatic char rcsid[] = X "@(#) $Header: timer.c,v 1.2 90/12/27 22:16:27 sob Exp $ (NNTP without TIMERS)"; X#endif X#endif X X#ifdef TIMERS X#include <sys/time.h> X#include "timer.h" X#ifndef USG X#ifndef FD_SETSIZE X/* Forward compatability */ X#define FD_SET(n, p) ((p)->fds_bits[0] |= (1<<(n))) X#define FD_CLR(n, p) ((p)->fds_bits[0] &= ~(1<<(n))) X#define FD_ISSET(n, p) ((p)->fds_bits[0] & (1<<(n))) X#define FD_ZERO(p) ((p)->fds_bits[0] = 0) X#endif X#endif X/* non-portable */ X#define BUFFERED_DATA(f) ((f)->_cnt > 0) X Xstatic long lastsecs; X X/* X * Should be called before first call to timer_sleep() X */ Xvoid Xtimer_init(timers, ntimer) X register struct timer *timers; X register int ntimer; X{ X register int i; X register struct timer *tp; X X#ifdef SYSLOG X if (ntimer <= 0) X syslog(LOG_ERR, X "timer_init(): configuration error, %d timers\n", ntimer); X#endif X X /* Reset all timers */ X for (i = ntimer, tp = timers; i > 0; --i, ++tp) X tp->left = tp->seconds; X X /* Start clock */ X lastsecs = time((long *)0); X} X X/* X * Sleep until input or next timer needs to be run and then run any X * expired timers. Returns true if input is available to be read. X */ Xint Xtimer_sleep(timers, ntimer) X register struct timer *timers; X register int ntimer; X{ X register int i, n; X register struct timer *tp; X register long secs; X#ifdef USG X long timeout; X long readfds; X#else X register struct timeval *timeoutp; X struct timeval timeout; X fd_set readfds; X#endif X X /* No need to do the select if there are characters in the buffer */ X if (BUFFERED_DATA(stdin)) X return(1); X X /* Length of next timeout is minimum of all "timers" */ X#ifdef USG X timeout = -1; X for (i = ntimer, tp = timers; i > 0; --i, ++tp) X if (tp->left >= 0 && X (tp->left < timeout || timeout < 0)) X timeout = tp->left; X X /* If active timeouts (this can easily happen), block until input */ X if (timeout < 0) X timeout = 0; X#ifdef EXCELAN X readfds = 1<<(fileno(stdin)); X timeout = timeout * 1000; /* timeout needs to be in milliseconds */ X#endif /* EXCELAN */ X#else X timeout.tv_sec = -1; X timeout.tv_usec = 0; X for (i = ntimer, tp = timers; i > 0; --i, ++tp) X if (tp->left >= 0 && X (tp->left < timeout.tv_sec || timeout.tv_sec < 0)) X timeout.tv_sec = tp->left; X X /* If active timeouts (this can easily happen), block until input */ X if (timeout.tv_sec < 0) X timeoutp = 0; X else X timeoutp = &timeout; X X /* Do select */ X FD_ZERO(&readfds); X FD_SET(fileno(stdin), &readfds); X#endif /* !USG */ X errno = 0; X#ifdef EXCELAN X n = select(fileno(stdin) + 1, &readfds, (long*)0, timeout); X#else X n = select(fileno(stdin) + 1, X &readfds, (fd_set*)0, (fd_set*)0, timeoutp); X#endif X /* "Interrupted system call" isn't a real error */ X if (n < 0 && errno != EINTR) { X#ifdef SYSLOG X syslog(LOG_ERR, "%s read select: %m", hostname); X#endif X exit(1); X } X X /* Calculate off seconds since last time */ X secs = time((long *)0) - lastsecs; X if (secs < 0) X secs = 0; X X /* Subtract time from "timers" that have time remaining */ X for (i = ntimer, tp = timers; i > 0; --i, ++tp) X if (tp->left > 0 && (tp->left -= secs) < 0) X tp->left = 0; X X /* Update lastsecs */ X lastsecs += secs; X X /* If we have input, reset clock on guys that like it that way */ X if (n > 0) X for (i = ntimer, tp = timers; i > 0; --i, ++tp) X if (tp->resetoninput) X tp->left = tp->seconds; X X /* Process "timers" that have timed out */ X for (i = ntimer, tp = timers; i > 0; --i, ++tp) { X if (tp->left == 0) { X (tp->subr)(); X /* resetoninput guys only get "reset on input" */ X if (tp->resetoninput) X tp->left = -1; X else X tp->left = tp->seconds; X } X } X X /* Indicate no input */ X if (n <= 0) X return(0); X return(1); X X} X#endif SHAR_EOF if test 3900 -ne "`wc -c < 'timer.c'`" then echo shar: error transmitting "'timer.c'" '(should have been 3900 characters)' fi fi # end of overwriting check echo shar: extracting "'timer.h'" '(325 characters)' if test -f 'timer.h' then echo shar: will not over-write existing file "'timer.h'" else sed 's/^ X//' << \SHAR_EOF > 'timer.h' X/* @(#) $Header: timer.h,v 1.2 90/12/12 00:52:56 sob Exp $ */ X Xstruct timer { X void (*subr)(); /* routine to invoke at timeout */ X int resetoninput; /* if true, reset timer on input */ X long seconds; /* seconds until a timeout */ X long left; /* seconds left until next timeout */ X}; X Xvoid timer_init(); Xint timer_sleep(); SHAR_EOF if test 325 -ne "`wc -c < 'timer.h'`" then echo shar: error transmitting "'timer.h'" '(should have been 325 characters)' fi fi # end of overwriting check echo shar: done with directory "'server'" cd .. # End of shell archive exit 0