1*25707Sbloom /* uucp.h 5.10 86/01/06 */ 213632Ssam 318624Sralph #include <stdio.h> 413632Ssam 513632Ssam /* 613632Ssam * Determine local uucp name of this machine. 713632Ssam * Define one of the following: 813632Ssam * 913632Ssam * For UCB 4.1A and later systems, you will have the gethostname(2) call. 1013632Ssam * If this call exists, define GETHOSTNAME. 1113632Ssam * 1213632Ssam * For USG 3.0 and later systems, you will have the uname(2) call. 1313632Ssam * If this call exists, define UNAME. 1413632Ssam * 1513632Ssam * Some systems have a line of the form '#define sysname "myuucpname",' 1613632Ssam * in the file /usr/include/whoami.h, to identify their machine. 1713632Ssam * If your site does that, define WHOAMI. 1813632Ssam * 1913632Ssam * If your site has <whoami.h>, but you do not want to read 2013632Ssam * that file every time uucp runs, you can compile sysname into uucp. 2113632Ssam * This is faster and more reliable, but binaries do not port. 2213632Ssam * If you want to do that, define CCWHOAMI. 2313632Ssam * 2413632Ssam * Some systems put the local uucp name in a single-line file 2513632Ssam * named /etc/uucpname or /local/uucpname. 2613632Ssam * If your site does that, define UUNAME. 2713632Ssam * 2813632Ssam * Systems running 3Com's UNET will have the getmyhname() call. 2913632Ssam * If you want to, define GETMYHNAME. 3013632Ssam * 3117842Sralph * You should also define MYNAME to be your uucp name. 3213632Ssam * 3313632Ssam * For each of the above that are defined, uucp checks them in order. 3413632Ssam * It stops on the first method that returns a non null name. 3513632Ssam * If everything fails, it uses "unknown" for the system name. 3613632Ssam */ 3723681Sbloom #define GETHOSTNAME /**/ 3823681Sbloom /* #define UNAME /**/ 3923681Sbloom /* #define WHOAMI /**/ 4023681Sbloom /* #define CCWHOAMI /**/ 4123681Sbloom /* #define UUNAME /**/ 4223681Sbloom /* #define GETMYHNAME /**/ 4313632Ssam /* If the above fails ... */ 4423681Sbloom #define MYNAME "erehwon" 4513632Ssam 4613632Ssam /* 4713632Ssam * If you have it, include <sysexits.h> to use exit 4813632Ssam * codes that will be understood by sendmail. 4913632Ssam * Otherwise, define EX_NOHOST, EX_CANTCREAT, and EX_NOINPUT. 5013632Ssam */ 5113632Ssam #include <sysexits.h> 5223681Sbloom /*#define EX_NOINPUT 66 /**/ 5323681Sbloom /*#define EX_NOHOST 68 /**/ 5423681Sbloom /*#define EX_CANTCREAT 73 /**/ 5513632Ssam 5613632Ssam /* 5713632Ssam * Define the various kinds of connections to include. 5813632Ssam * The complete list is in the condevs array in condevs.c 5913632Ssam */ 6025269Sbloom #define BSDTCP /* 4.2bsd or 2.9bsd TCP/IP */ 6125269Sbloom /* #define DATAKIT /* ATT's datakit */ 6217872Sralph #define DF02 /* Dec's DF02/DF03 */ 6318624Sralph #define DF112 /* Dec's DF112 */ 6425269Sbloom #define DN11 /* "standard" DEC dialer */ 6517872Sralph #define HAYES /* Hayes' Smartmodem */ 6625269Sbloom /* #define MICOM /* Micom Mux port */ 6725269Sbloom #define NOVATION /* Novation modem */ 6825269Sbloom #define PAD /* X.25 PAD */ 6918624Sralph #define PENRIL /* PENRIL Dialer */ 7025269Sbloom /* #define PNET /* Purdue network */ 7125269Sbloom #define RVMACS /* Racal-Vadic MACS 820 dialer, 831 adaptor */ 7225269Sbloom /* #define SYTEK /* Sytek Local Area Net */ 7325269Sbloom /* #define UNETTCP /* 3Com's UNET */ 7417872Sralph #define VA212 /* Racal-Vadic 212 */ 7517872Sralph #define VA811S /* Racal-Vadic 811S dialer, 831 adaptor */ 7617842Sralph #define VA820 /* Racal-Vadic 820 dialer, 831 adaptor */ 7725269Sbloom #define VADIC /* Racal-Vadic 345x */ 7825269Sbloom #define VENTEL /* Ventel Dialer */ 7917872Sralph #define VMACS /* Racal-Vadic MACS 811 dialer, 831 adaptor */ 8013632Ssam 8117842Sralph #if defined(UNETTCP) || defined(BSDTCP) 8217842Sralph #define TCPIP 8317842Sralph #endif 8417842Sralph 8513632Ssam /* 86*25707Sbloom * We need a timer to write slowly to certain modems. 87*25707Sbloom * and for generating breaks. 88*25707Sbloom * 8923728Sbloom * define INTERVALTIMER to use 4.[23] bsd interval timer. 9013632Ssam * define FASTTIMER if you have the nap() system call. 9113632Ssam * define FTIME if you have the ftime() system call. 9213632Ssam * define BUSYLOOP if you must do a busy loop. 9313632Ssam * Look at uucpdelay() in condevs.c for details. 9413632Ssam */ 9523681Sbloom #define INTERVALTIMER 9625269Sbloom /*#define FASTTIMER /**/ 9725269Sbloom /*#define FTIME /**/ 9825269Sbloom /*#define BUSYLOOP /**/ 9913632Ssam 10013632Ssam /* 10113632Ssam * If your site is using "ndir.h" to retrofit the Berkeley 10213632Ssam * directory reading routines, define NDIR. 10313632Ssam * You will probably also have to set LIBNDIR in Makefile. 10413632Ssam * Otherwise, <dir.h> is assumed to have the Berkeley directory definitions. 10513632Ssam */ 10623681Sbloom /*#define NDIR /**/ 10713632Ssam 10813632Ssam /* 10923681Sbloom * If yours is a BTL system III, IV, V or so-on site, define USG. 11013632Ssam */ 11123681Sbloom /*#define USG /**/ 11213632Ssam 11317842Sralph /* 11423728Sbloom * If you are running 4.3bsd, define BSD4_3 and BSD4_2 11523728Sbloom * If you are just running 4.2bsd, define BSD4_2 11617842Sralph */ 11723728Sbloom #define BSD4_3 /**/ 11823681Sbloom #define BSD4_2 /**/ 11917842Sralph 12017842Sralph /* 12123681Sbloom * If you are running 2.9bsd, define BSD2_9 12223681Sbloom */ 12323681Sbloom /*#define BSD2_9 /**/ 12423681Sbloom 12523681Sbloom /* 12617842Sralph * If you are using /etc/inetd with 4.2bsd, define BSDINETD 12717842Sralph */ 12823681Sbloom #define BSDINETD /**/ 12917842Sralph 13023728Sbloom /* 13123728Sbloom * If you are running 4.3bsd, you are running the inetd 13223728Sbloom */ 13323728Sbloom 13423728Sbloom #if defined(BSD4_3) && !defined(BSDINETD) 13523728Sbloom #define BSDINETD 13623728Sbloom #endif BSD4_3 && !BSDINETD 13723728Sbloom 13817842Sralph /*#define VMSDTR /* Turn on modem control on vms(works DTR) for 13917842Sralph develcon and gandalf ports to gain access */ 14018624Sralph /* 14118624Sralph * If you want to use the same modem for dialing in and out define 14218624Sralph * DIALINOUT to be the localtion of the acucntrl program 14318624Sralph */ 14423681Sbloom /* #define DIALINOUT "/usr/lib/uucp/acucntrl" /**/ 14517842Sralph 14623681Sbloom /* 14723681Sbloom * If you want all ACU lines to be DIALINOUT, define ALLACUINOUT 14823681Sbloom */ 14923681Sbloom /* #define ALLACUINOUT /**/ 15013632Ssam 15113632Ssam /* define the value of WFMASK - for umask call - used for all uucp work files */ 15213632Ssam #define WFMASK 0137 15313632Ssam 15417842Sralph /* define UUSTAT if you need "uustat" command */ 15523681Sbloom /* #define UUSTAT /**/ 15617842Sralph 15723681Sbloom /* define UUSUB if you need "uusub" command */ 15817842Sralph /* #define UUSUB /**/ 15917842Sralph 16013632Ssam /* define the value of LOGMASK - for LOGFILE, SYSLOG, ERRLOG */ 16123681Sbloom #define LOGMASK 0133 16213632Ssam 16313632Ssam /* All files are given at least the following at the final destination */ 16413632Ssam /* It is also the default mode, so '666' is recommended */ 16513632Ssam /* and 444 is minimal (minimally useful, maximally annoying) */ 16613632Ssam #define BASEMODE 0666 16713632Ssam 16817842Sralph /* 16917842Sralph * Define NOSTRANGERS if you don't want to accept transactions from 17017842Sralph * sites that are not in your L.sys file (see cico.c) 17117842Sralph */ 17223681Sbloom #define NOSTRANGERS /**/ 17317842Sralph /* 17417842Sralph * Traditionally LCK (lock) files have been kept in /usr/spool/uucp. 17517842Sralph * If you want that define LOCKDIR to be ".". 17625269Sbloom * If you want the locks kept in a subdirectory, define LOCKDIR as "LCK". 17717842Sralph * Good news about LCK. subdirectory: the directory can be mode 777 so 17817842Sralph * unprivileged programs can share the uucp locking system, 17917842Sralph * and the subdirectory keeps down clutter in the main directory. 18017842Sralph * The BAD news: you have to change 'tip' and another programs that 18117842Sralph * know where the LCK files are kept, and you have to change your /etc/rc 18217842Sralph * if your rc cleans out the lock files (as it should). 18317842Sralph */ 18425269Sbloom /*#define LOCKDIR "LCK" /**/ 18523681Sbloom #define LOCKDIR "." /**/ 18613632Ssam 18725269Sbloom /* 18817842Sralph * If you want uucp and uux to copy the data files by default, 18917842Sralph * don't define DONTCOPY (This is the way older 4bsd uucps worked) 19017842Sralph * If you want uucp and uux to use the original files instead of 19117842Sralph * copies, define DONTCOPY (This is the way System III and V work) 19217842Sralph */ 19323681Sbloom #define DONTCOPY /**/ 19417842Sralph 19517842Sralph /* 19618624Sralph * Very few (that I know of) systems use the sequence checking feature. 19717842Sralph * If you are not going to use it (hint: you are not), 19817842Sralph * do not define GNXSEQ. This saves precious room on PDP11s. 19917842Sralph */ 20023681Sbloom /*#define GNXSEQ /* comment this out to save space */ 20117842Sralph 20218624Sralph /* 20318624Sralph * If you want the logfile stored in a file for each site instead 20418624Sralph * of one file 20518624Sralph * define LOGBYSITE as the directory to put the files in 20618624Sralph */ 20723681Sbloom /*#define LOGBYSITE "/usr/spool/uucp/LOG" /**/ 20818624Sralph 20913632Ssam #define XQTDIR "/usr/spool/uucp/XTMP" 21013632Ssam #define SQFILE "/usr/lib/uucp/SQFILE" 21113632Ssam #define SQTMP "/usr/lib/uucp/SQTMP" 21213632Ssam #define SLCKTIME 5400 /* system/device timeout (LCK.. files) */ 21313632Ssam #define SEQFILE "/usr/lib/uucp/SEQF" 21413632Ssam #define SYSFILE "/usr/lib/uucp/L.sys" 21513632Ssam #define DEVFILE "/usr/lib/uucp/L-devices" 21613632Ssam #define DIALFILE "/usr/lib/uucp/L-dialcodes" 21713632Ssam #define USERFILE "/usr/lib/uucp/USERFILE" 21813632Ssam #define CMDFILE "/usr/lib/uucp/L.cmds" 21918624Sralph #define ALIASFILE "/usr/lib/uucp/L.aliases" 22013632Ssam 22113632Ssam #define SPOOL "/usr/spool/uucp" 22225269Sbloom #define SQLOCK "SQ" 22313632Ssam #define SYSLOG "/usr/spool/uucp/SYSLOG" 22413632Ssam #define PUBDIR "/usr/spool/uucppublic" 22513632Ssam 22625269Sbloom #define SEQLOCK "SEQL" 22713632Ssam #define CMDPRE 'C' 22813632Ssam #define DATAPRE 'D' 22913632Ssam #define XQTPRE 'X' 23013632Ssam 23123681Sbloom #define LOGFILE "/usr/spool/uucp/LOGFILE" 23223681Sbloom #define ERRLOG "/usr/spool/uucp/ERRLOG" 23323681Sbloom #define CMDSDIR "/usr/spool/uucp/C." 23423681Sbloom #define DATADIR "/usr/spool/uucp/D." 23523681Sbloom #define XEQTDIR "/usr/spool/uucp/X." 23613632Ssam 23713632Ssam #define RMTDEBUG "AUDIT" 23817842Sralph #define CORRUPT "CORRUPT" 23913632Ssam #define SQTIME 60 24013632Ssam #define TRYCALLS 2 /* number of tries to dial call */ 24113632Ssam 24217842Sralph #define LLEN 50 24317842Sralph #define MAXRQST 250 24417842Sralph 24513632Ssam #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s); else 24613632Ssam 24717842Sralph #define ASSERT(e, s1, s2, i1) if (!(e)) {assert(s1, s2, i1);cleanup(FAIL);}else 24813632Ssam 24925269Sbloom #define delock(dev) rmlock(dev) 25025269Sbloom #define mlock(dev) ulockf(dev, SLCKTIME) 25125269Sbloom 25223681Sbloom #define SAME 0 25323681Sbloom #define ANYREAD 0004 25423681Sbloom #define ANYWRITE 02 25523681Sbloom #define FAIL -1 25623681Sbloom #define SUCCESS 0 25723681Sbloom #define CNULL (char *) 0 25823681Sbloom #define STBNULL (struct sgttyb *) 0 25923681Sbloom #define MASTER 1 26023681Sbloom #define SLAVE 0 26123681Sbloom #define MAXFULLNAME 255 26223681Sbloom #define MAXMSGTIME 45 26323681Sbloom #define NAMESIZE 255 26423681Sbloom #define MAXBASENAME 14 26523681Sbloom #define SYSNSIZE (MAXBASENAME-1-1-1-4) 26623681Sbloom #define EOTMSG "\04\n\04\n" 26723681Sbloom #define CALLBACK 1 26823681Sbloom #define ONEDAY 86400L 26913632Ssam 27013632Ssam /* commands */ 27113632Ssam #define SHELL "/bin/sh" 27217842Sralph #define MAIL "/usr/lib/sendmail" 27313632Ssam #define UUCICO "/usr/lib/uucp/uucico" 27413632Ssam #define UUXQT "/usr/lib/uucp/uuxqt" 27513632Ssam #define UUCP "uucp" 27613632Ssam 27713632Ssam /* call connect fail stuff */ 27813632Ssam #define CF_SYSTEM -1 27913632Ssam #define CF_TIME -2 28013632Ssam #define CF_LOCK -3 28113632Ssam #define CF_NODEV -4 28213632Ssam #define CF_DIAL -5 28313632Ssam #define CF_LOGIN -6 28413632Ssam 28523681Sbloom #define F_NAME 0 28623681Sbloom #define F_TIME 1 28723681Sbloom #define F_LINE 2 28823681Sbloom #define F_CLASS 3 /* an optional prefix and the speed */ 28923681Sbloom #define F_PHONE 4 29023681Sbloom #define F_LOGIN 5 29113632Ssam 29223681Sbloom #define MAXPH 60 /* maximum length of a phone number */ 29313632Ssam 29413632Ssam /* This structure tells how to get to a device */ 29513632Ssam struct condev { 29613632Ssam char *CU_meth; /* method, such as 'ACU' or 'DIR' */ 29713632Ssam char *CU_brand; /* brand, such as 'Hayes' or 'Vadic' */ 29813632Ssam int (*CU_gen)(); /* what to call to search for brands */ 29913632Ssam int (*CU_open)(); /* what to call to open brand */ 30013632Ssam int (*CU_clos)(); /* what to call to close brand */ 30113632Ssam }; 30213632Ssam 30313632Ssam /* This structure tells about a device */ 30413632Ssam struct Devices { 30517842Sralph #define D_type D_arg[0] 30617842Sralph #define D_line D_arg[1] 30717842Sralph #define D_calldev D_arg[2] 30817842Sralph #define D_class D_arg[3] 30917842Sralph #define D_brand D_arg[4] 31017842Sralph #define D_CHAT 5 31117842Sralph int D_numargs; 31217842Sralph int D_speed; 31317842Sralph char *D_arg[20]; 31417842Sralph char D_argbfr[100]; 31513632Ssam }; 31613632Ssam 31713632Ssam /* system status stuff */ 31813632Ssam #define SS_OK 0 31913632Ssam #define SS_NODEVICE 1 32013632Ssam #define SS_CALLBACK 2 32113632Ssam #define SS_INPROGRESS 3 32223681Sbloom #define SS_FAIL 4 32313632Ssam #define SS_BADSEQ 5 32417842Sralph #define SS_WRONGTIME 6 32513632Ssam 32613632Ssam /* fail/retry parameters */ 32723681Sbloom #define RETRYTIME 600 32823681Sbloom #define MAXRECALLS 25 32913632Ssam 33013632Ssam /* stuff for command execution */ 33113632Ssam #define X_RQDFILE 'F' 33213632Ssam #define X_STDIN 'I' 33313632Ssam #define X_STDOUT 'O' 33413632Ssam #define X_CMD 'C' 33513632Ssam #define X_USER 'U' 33613632Ssam #define X_SENDFILE 'S' 33713632Ssam #define X_NONOTI 'N' 33817842Sralph #define X_RETURNTO 'R' 33913632Ssam #define X_NONZERO 'Z' 34025269Sbloom #define X_LOCK "XQT" 34123681Sbloom #define X_LOCKTIME 3600L 34213632Ssam 34323681Sbloom #define WKDSIZE 100 /* size of work dir name */ 34413632Ssam 34518624Sralph #include <sys/types.h> 34618624Sralph #ifndef USG 34718624Sralph #include <sys/timeb.h> 34818624Sralph #else USG 34918624Sralph struct timeb 35018624Sralph { 35118624Sralph time_t time; 35218624Sralph unsigned short millitm; 35318624Sralph short timezone; 35418624Sralph short dstflag; 35518624Sralph }; 35623681Sbloom #define rindex strrchr 35723681Sbloom #define index strchr 35818624Sralph #endif USG 35918624Sralph 36018624Sralph extern struct timeb Now; 36118624Sralph 36213632Ssam extern int Ifn, Ofn; 36318624Sralph extern char *Rmtname; 36413632Ssam extern char User[]; 36513632Ssam extern char Loginuser[]; 36613632Ssam extern char *Spool; 36713632Ssam extern char Myname[]; 36817842Sralph extern char Myfullname[]; 36913632Ssam extern int Debug; 37013632Ssam extern int Bspeed; 37113632Ssam extern char Wrkdir[]; 37223681Sbloom extern time_t Retrytime; 37317842Sralph extern short Usrf; 37417842Sralph extern int IsTcpIp; 37513632Ssam extern char Progname[]; 37613632Ssam extern int (*CU_end)(); 37713632Ssam extern struct condev condevs[]; 37817842Sralph extern char NOLOGIN[]; 37913632Ssam 38017842Sralph extern char DLocal[], DLocalX[], *subfile(), *subdir(); 38113632Ssam 38213632Ssam /* Commonly called routines which return non-int value */ 38313632Ssam extern char *ttyname(), *strcpy(), *strcat(), *index(), *rindex(), 38417842Sralph *fgets(), *calloc(), *malloc(), *fdig(), *ttyname(), 38523681Sbloom *cfgets(), *getwd(), *strpbrk(), *strncpy(); 38613632Ssam extern long lseek(); 38713992Sgray extern FILE *rpopen(); 38823681Sbloom extern time_t time(); 38917842Sralph 39017842Sralph extern char _FAILED[], CANTOPEN[], DEVNULL[]; 39123681Sbloom 39223681Sbloom #ifdef lint 39323681Sbloom /* This horrible gross kludge is the only way I know to 39423681Sbloom * convince lint that signal(SIGINT,SIG_IGN) is legal. It hates SIG_IGN. 39523681Sbloom */ 39623681Sbloom #ifdef SIG_IGN 39723681Sbloom #undef SIG_IGN 39823681Sbloom #endif /* SIG_IGN */ 39923681Sbloom #define SIG_IGN main 40023681Sbloom extern int main(); 40123681Sbloom #ifdef DEBUG 40223681Sbloom #undef DEBUG 40323681Sbloom #endif DEBUG 40423681Sbloom #define DEBUG(a,b,c) 40523681Sbloom #endif /* lint */ 406