1: /* uucp.h 5.11.6 1997/10/2 */ 2: 3: #include <stdio.h> 4: #include <paths.h> 5: #include <stdlib.h> 6: #include <string.h> 7: #include <sys/time.h> 8: #include <unistd.h> 9: 10: /* 11: * Determine local uucp name of this machine. 12: * Define one of the following: 13: * 14: * For UCB 4.1A and later systems, you will have the gethostname(2) call. 15: * If this call exists, define GETHOSTNAME. 16: * 17: * For USG 3.0 and later systems, you will have the uname(2) call. 18: * If this call exists, define UNAME. 19: * 20: * Some systems have a line of the form '#define sysname "myuucpname",' 21: * in the file /usr/include/whoami.h, to identify their machine. 22: * If your site does that, define WHOAMI. 23: * 24: * If your site has <whoami.h>, but you do not want to read 25: * that file every time uucp runs, you can compile sysname into uucp. 26: * This is faster and more reliable, but binaries do not port. 27: * If you want to do that, define CCWHOAMI. 28: * 29: * Some systems put the local uucp name in a single-line file 30: * named /etc/uucpname or /local/uucpname. 31: * If your site does that, define UUNAME. 32: * 33: * Systems running 3Com's UNET will have the getmyhname() call. 34: * If you want to, define GETMYHNAME. 35: * 36: * You should also define MYNAME to be your uucp name. 37: * 38: * For each of the above that are defined, uucp checks them in order. 39: * It stops on the first method that returns a non null name. 40: * If everything fails, it uses "unknown" for the system name. 41: */ 42: #define GETHOSTNAME /**/ 43: /* #define UNAME /**/ 44: /* #define WHOAMI /**/ 45: /* #define CCWHOAMI /**/ 46: /* #define UUNAME /**/ 47: /* #define GETMYHNAME /**/ 48: /* If the above fails ... */ 49: #define MYNAME "wlonex" 50: 51: /* 52: * If you have it, include <sysexits.h> to use exit 53: * codes that will be understood by sendmail. 54: * Otherwise, define EX_NOHOST, EX_CANTCREAT, and EX_NOINPUT. 55: */ 56: #include <sysexits.h> 57: /*#define EX_NOINPUT 66 /**/ 58: /*#define EX_NOHOST 68 /**/ 59: /*#define EX_CANTCREAT 73 /**/ 60: 61: /* 62: * Define the various kinds of connections to include. 63: * The complete list is in the condevs array in condevs.c 64: */ 65: /* #define ATT2224 /* AT&T 2224 */ 66: #define BSDTCP /* 4.2bsd or 2.9bsd TCP/IP */ 67: /* #define CDS224 /* Concord Data Systems 2400 */ 68: /* #define DATAKIT /* ATT's datakit */ 69: /* #define DF02 /* Dec's DF02/DF03 */ 70: /* #define DF112 /* Dec's DF112 */ 71: /* #define DN11 /* "standard" DEC dialer */ 72: #define HAYES /* Hayes' Smartmodem */ 73: /* #define HAYES2400 /* Hayes' 2400 baud Smartmodem */ 74: /* #define MICOM /* Micom Mux port */ 75: /* #define NOVATION /* Novation modem */ 76: /* #define PAD /* X.25 PAD */ 77: /* #define PENRIL /* PENRIL Dialer */ 78: /* #define PNET /* Purdue network */ 79: /* #define RVMACS /* Racal-Vadic MACS 820 dialer, 831 adaptor */ 80: /* #define SYTEK /* Sytek Local Area Net */ 81: /* #define UNETTCP /* 3Com's UNET */ 82: /* #define USR2400 /* USRobotics Courier 2400 */ 83: /* #define VA212 /* Racal-Vadic 212 */ 84: /* #define VA811S /* Racal-Vadic 811S dialer, 831 adaptor */ 85: /* #define VA820 /* Racal-Vadic 820 dialer, 831 adaptor */ 86: /* #define VADIC /* Racal-Vadic 345x */ 87: /* #define VENTEL /* Ventel Dialer */ 88: /* #define VMACS /* Racal-Vadic MACS 811 dialer, 831 adaptor */ 89: 90: #if defined(USR2400) && !defined(HAYES) 91: #define HAYES 92: #endif USR2400 && !HAYES 93: 94: #if defined(UNETTCP) || defined(BSDTCP) 95: #define TCPIP 96: #endif 97: 98: /* 99: * We need a timer to write slowly to certain modems. 100: * and for generating breaks. 101: * 102: * define INTERVALTIMER to use 4.[23] bsd interval timer. 103: * define FASTTIMER if you have the nap() system call. 104: * define FTIME if you have the ftime() system call. 105: * define BUSYLOOP if you must do a busy loop. 106: * Look at uucpdelay() in condevs.c for details. 107: */ 108: #define INTERVALTIMER /**/ 109: /*#define FASTTIMER /**/ 110: /*#define FTIME /**/ 111: /*#define BUSYLOOP /**/ 112: 113: /* 114: * If your site is using "ndir.h" to retrofit the Berkeley 115: * directory reading routines, define NDIR. 116: * You will probably also have to set LIBNDIR in Makefile. 117: * Otherwise, <dir.h> is assumed to have the Berkeley directory definitions. 118: */ 119: /*#define NDIR /**/ 120: 121: /* 122: * If yours is a BTL system III, IV, V or so-on site, define USG. 123: */ 124: /*#define USG /**/ 125: 126: /* 127: * If you are running 4.3bsd, define BSD4_3 and BSD4_2 128: * If you are just running 4.2bsd, define BSD4_2 129: * If you are running 2.11bsd, define BSD4_3 and BSD4_2 130: * If you are running the BRL version of 4.2BSD define BRL4_2, NOT BSD4_3 131: */ 132: #define BSD4_3 /**/ 133: #define BSD4_2 /**/ 134: /*#define BRL4_2 /**/ 135: 136: #if defined(BRL4_2) && !defined(BSD4_2) 137: #define BSD4_2 138: #undef BSD4_3 139: #endif BRL4_2 140: 141: /* 142: * If you are running 2.9bsd define BSD2_9 143: */ 144: /*#define BSD2_9 /**/ 145: 146: /* 147: * If you are using 'inetd' with 4.2bsd, define BSDINETD 148: */ 149: /* #define BSDINETD /**/ 150: 151: /* 152: * If you are running 4.3bsd, 2.11bsd or BRL 4.2, you are running 'inetd' 153: */ 154: 155: #if (defined(BSD4_3) || defined(BRL4_2)) && !defined(BSDINETD) 156: #define BSDINETD 157: #endif (BSD4_3 ||BRL4_2) && !BSDINETD 158: 159: /*#define VMSDTR /* Turn on modem control on vms(works DTR) for 160: develcon and gandalf ports to gain access */ 161: /* 162: * If you want to use the same modem for dialing in and out define 163: * DIALINOUT to be the localtion of the acucntrl program 164: */ 165: /* #define DIALINOUT "/usr/libexec/acucntrl" /**/ 166: 167: /* 168: * If you want all ACU lines to be DIALINOUT, define ALLACUINOUT 169: */ 170: /* #define ALLACUINOUT /**/ 171: 172: /* define the value of WFMASK - for umask call - used for all uucp work files */ 173: #define WFMASK 0137 174: 175: /* define the value of LOGMASK - for LOGFILE, SYSLOG, ERRLOG */ 176: #define LOGMASK 0133 177: 178: /* All files are given at least the following at the final destination */ 179: /* It is also the default mode, so '666' is recommended */ 180: /* and 444 is minimal (minimally useful, maximally annoying) */ 181: #define BASEMODE 0666 182: 183: /* 184: * Define NOSTRANGERS if you don't want to accept transactions from 185: * sites that are not in your L.sys file (see cico.c) 186: */ 187: #define NOSTRANGERS /**/ 188: 189: /* 190: * Traditionally LCK (lock) files have been kept in /usr/spool/uucp. 191: * If you want that define LOCKDIR to be ".". 192: * If you want the locks kept in a subdirectory, define LOCKDIR as "LCK". 193: * Good news about LCK. subdirectory: the directory can be mode 777 so 194: * unprivileged programs can share the uucp locking system, 195: * and the subdirectory keeps down clutter in the main directory. 196: * The BAD news: you have to change 'tip' and another programs that 197: * know where the LCK files are kept, and you have to change your /etc/rc 198: * if your rc cleans out the lock files (as it should). 199: */ 200: /*#define LOCKDIR "LCK" /**/ 201: #define LOCKDIR "." /**/ 202: 203: /* 204: * If you want uucp and uux to copy the data files by default, 205: * don't define DONTCOPY (This is the way older 4bsd uucps worked) 206: * If you want uucp and uux to use the original files instead of 207: * copies, define DONTCOPY (This is the way System III and V work) 208: */ 209: #define DONTCOPY /**/ 210: 211: /* 212: * Very few (that I know of) systems use the sequence checking feature. 213: * If you are not going to use it (hint: you are not), 214: * do not define GNXSEQ. This saves precious room on PDP11s. 215: */ 216: /*#define GNXSEQ /* comment this out to save space */ 217: 218: /* 219: * If you want the logfile stored in a file for each site instead 220: * of one file 221: * define LOGBYSITE as the directory to put the files in 222: */ 223: /*#define LOGBYSITE "/usr/spool/uucp/LOG" /**/ 224: 225: #define XQTDIR "/usr/spool/uucp/XTMP" 226: #define SQFILE "/etc/uucp/SQFILE" 227: #define SQTMP "/etc/uucp/SQTMP" 228: #define SLCKTIME 5400 /* system/device timeout (LCK.. files) */ 229: #define SEQFILE "/etc/uucp/SEQF" 230: #define SYSFILE "/etc/uucp/L.sys" 231: #define DEVFILE "/etc/uucp/L-devices" 232: #define DIALFILE "/etc/uucp/L-dialcodes" 233: #define USERFILE "/etc/uucp/USERFILE" 234: #define CMDFILE "/etc/uucp/L.cmds" 235: #define ALIASFILE "/etc/uucp/L.aliases" 236: 237: #define SPOOL "/usr/spool/uucp" 238: #define SYSLOG "/usr/spool/uucp/SYSLOG" 239: #define PUBDIR "/usr/spool/uucppublic" 240: 241: #define SQLOCK "SQ" 242: #define SEQLOCK "SEQL" 243: #define CMDPRE 'C' 244: #define DATAPRE 'D' 245: #define XQTPRE 'X' 246: 247: #define LOGFILE "/usr/spool/uucp/LOGFILE" 248: #define ERRLOG "/usr/spool/uucp/ERRLOG" 249: #define CMDSDIR "/usr/spool/uucp/C." 250: #define DATADIR "/usr/spool/uucp/D." 251: #define XEQTDIR "/usr/spool/uucp/X." 252: 253: #define RMTDEBUG "AUDIT" 254: #define CORRUPT "CORRUPT" 255: #define SQTIME 60 256: #define TRYCALLS 2 /* number of tries to dial call */ 257: 258: #define LLEN 50 259: #define MAXRQST 250 260: 261: #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s); else 262: 263: #define ASSERT(e, s1, s2, i1) if (!(e)) {assert(s1, s2, i1);cleanup(FAIL);}else 264: 265: #define delock(dev) rmlock(dev) 266: #define mlock(dev) ulockf(dev, SLCKTIME) 267: 268: #define SAME 0 269: #define ANYREAD 0004 270: #define ANYWRITE 02 271: #define FAIL -1 272: #define SUCCESS 0 273: #define CNULL (char *) 0 274: #define STBNULL (struct sgttyb *) 0 275: #define MASTER 1 276: #define SLAVE 0 277: #define MAXFULLNAME 255 278: #define MAXMSGTIME 45 279: #define NAMESIZE 255 280: #define MAXBASENAME 14 281: #define SYSNSIZE (MAXBASENAME-1-1-1-4) 282: #define EOTMSG "\04\n\04\n" 283: #define CALLBACK 1 284: #define ONEDAY 86400L 285: 286: /* commands */ 287: #define SHELL "/bin/sh" 288: #define UUCICO "/usr/sbin/uucico" 289: #define UUXQT "/usr/libexec/uuxqt" 290: #define UUCP "uucp" 291: 292: /* call connect fail stuff */ 293: #define CF_SYSTEM -1 294: #define CF_TIME -2 295: #define CF_LOCK -3 296: #define CF_NODEV -4 297: #define CF_DIAL -5 298: #define CF_LOGIN -6 299: 300: #define F_NAME 0 301: #define F_TIME 1 302: #define F_LINE 2 303: #define F_CLASS 3 /* an optional prefix and the speed */ 304: #define F_PHONE 4 305: #define F_LOGIN 5 306: 307: #define MAXPH 60 /* maximum length of a phone number */ 308: 309: /* This structure tells how to get to a device */ 310: struct condev { 311: char *CU_meth; /* method, such as 'ACU' or 'DIR' */ 312: char *CU_brand; /* brand, such as 'Hayes' or 'Vadic' */ 313: int (*CU_gen)(); /* what to call to search for brands */ 314: int (*CU_open)(); /* what to call to open brand */ 315: int (*CU_clos)(); /* what to call to close brand */ 316: }; 317: 318: /* This structure tells about a device */ 319: struct Devices { 320: #define D_type D_arg[0] 321: #define D_line D_arg[1] 322: #define D_calldev D_arg[2] 323: #define D_class D_arg[3] 324: #define D_brand D_arg[4] 325: #define D_CHAT 5 326: int D_numargs; 327: int D_speed; 328: char *D_arg[20]; 329: char D_argbfr[100]; 330: }; 331: 332: /* system status stuff */ 333: #define SS_OK 0 334: #define SS_NODEVICE 1 335: #define SS_CALLBACK 2 336: #define SS_INPROGRESS 3 337: #define SS_FAIL 4 338: #define SS_BADSEQ 5 339: #define SS_WRONGTIME 6 340: 341: /* fail/retry parameters */ 342: #define RETRYTIME 600 343: #define MAXRECALLS 25 344: 345: /* stuff for command execution */ 346: #define X_RQDFILE 'F' 347: #define X_STDIN 'I' 348: #define X_STDOUT 'O' 349: #define X_CMD 'C' 350: #define X_USER 'U' 351: #define X_SENDFILE 'S' 352: #define X_NONOTI 'N' 353: #define X_RETURNTO 'R' 354: #define X_NONZERO 'Z' 355: #define X_LOCK "XQT" 356: #define X_LOCKTIME 3600L 357: 358: #define WKDSIZE 100 /* size of work dir name */ 359: 360: #include <sys/types.h> 361: #ifndef USG 362: #include <sys/timeb.h> 363: #else USG 364: struct timeb 365: { 366: time_t time; 367: unsigned short millitm; 368: short timezone; 369: short dstflag; 370: }; 371: #define rindex strrchr 372: #define index strchr 373: #endif USG 374: 375: extern struct timeb Now; 376: 377: extern int Ifn, Ofn; 378: extern char *Rmtname; 379: extern char User[]; 380: extern char Loginuser[]; 381: extern char *Spool; 382: extern char Myname[]; 383: extern char Myfullname[]; 384: extern int Debug; 385: extern int Bspeed; 386: extern char Wrkdir[]; 387: extern time_t Retrytime; 388: extern short Usrf; 389: extern int IsTcpIp; 390: extern char Progname[]; 391: extern int (*CU_end)(); 392: extern struct condev condevs[]; 393: extern char NOLOGIN[]; 394: 395: extern char DLocal[], DLocalX[], *subfile(), *subdir(); 396: 397: /* Commonly called routines which return non-int value */ 398: extern char *fdig(), *cfgets(); 399: extern FILE *rpopen(); 400: 401: extern char _FAILED[], CANTOPEN[], DEVNULL[]; 402: 403: #ifdef lint 404: /* This horrible gross kludge is the only way I know to 405: * convince lint that signal(SIGINT,SIG_IGN) is legal. It hates SIG_IGN. 406: */ 407: #ifdef SIG_IGN 408: #undef SIG_IGN 409: #endif /* SIG_IGN */ 410: #define SIG_IGN main 411: extern int main(); 412: #ifdef DEBUG 413: #undef DEBUG 414: #endif DEBUG 415: #define DEBUG(a,b,c) 416: #endif /* lint */