17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 22*61961e0fSrobinson 237c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 247c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate /* 27*61961e0fSrobinson * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 287c478bd9Sstevel@tonic-gate * Use is subject to license terms. 297c478bd9Sstevel@tonic-gate */ 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifndef _UUCP_H 327c478bd9Sstevel@tonic-gate #define _UUCP_H 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #include <sys/types.h> 357c478bd9Sstevel@tonic-gate #include <unistd.h> 367c478bd9Sstevel@tonic-gate #include <stdlib.h> 377c478bd9Sstevel@tonic-gate #include <string.h> 38*61961e0fSrobinson #include <parms.h> 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate #include <stdio.h> 417c478bd9Sstevel@tonic-gate #include <ctype.h> 427c478bd9Sstevel@tonic-gate #include <setjmp.h> 437c478bd9Sstevel@tonic-gate #include <sys/param.h> 447c478bd9Sstevel@tonic-gate #include <termio.h> 457c478bd9Sstevel@tonic-gate #include <signal.h> 467c478bd9Sstevel@tonic-gate #include <fcntl.h> 477c478bd9Sstevel@tonic-gate #include <sys/stat.h> 487c478bd9Sstevel@tonic-gate #include <utime.h> 497c478bd9Sstevel@tonic-gate #include <dirent.h> 507c478bd9Sstevel@tonic-gate #include <time.h> 517c478bd9Sstevel@tonic-gate #include <sys/times.h> 527c478bd9Sstevel@tonic-gate #include <errno.h> 537c478bd9Sstevel@tonic-gate #include <sys/mkdev.h> 54*61961e0fSrobinson #include <strings.h> 55*61961e0fSrobinson #include <ulimit.h> 56*61961e0fSrobinson #include <sys/utsname.h> 57*61961e0fSrobinson #include <ustat.h> 587c478bd9Sstevel@tonic-gate 59*61961e0fSrobinson #ifdef __cplusplus 60*61961e0fSrobinson extern "C" { 61*61961e0fSrobinson #endif 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate /* what mode should user files be allowed to have upon creation? */ 647c478bd9Sstevel@tonic-gate /* NOTE: This does not allow setuid or execute bits on transfer. */ 657c478bd9Sstevel@tonic-gate #define LEGALMODE (mode_t)0666 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate /* what mode should public files have upon creation? */ 687c478bd9Sstevel@tonic-gate #define PUB_FILEMODE (mode_t)0666 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate /* what mode should log files have upon creation? */ 717c478bd9Sstevel@tonic-gate #define LOGFILEMODE (mode_t)0644 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate /* what mode should C. files have upon creation? */ 747c478bd9Sstevel@tonic-gate #define CFILEMODE (mode_t)0644 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate /* what mode should D. files have upon creation? */ 777c478bd9Sstevel@tonic-gate #define DFILEMODE (mode_t)0600 787c478bd9Sstevel@tonic-gate 797c478bd9Sstevel@tonic-gate /* define the value of PUBMASK, used for creating "public" directories */ 807c478bd9Sstevel@tonic-gate #define PUBMASK (mode_t)0000 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate /* what mode should public directories have upon creation? */ 837c478bd9Sstevel@tonic-gate #define PUB_DIRMODE (mode_t)0777 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate /* define the value of DIRMASK, used for creating "system" subdirectories */ 867c478bd9Sstevel@tonic-gate #define DIRMASK (mode_t)0022 877c478bd9Sstevel@tonic-gate 887c478bd9Sstevel@tonic-gate #define MAXSTART 300 /* how long to wait on startup */ 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate /* define the last characters for ACU (used for 801/212 dialers) */ 917c478bd9Sstevel@tonic-gate #define ACULAST "<" 927c478bd9Sstevel@tonic-gate 93*61961e0fSrobinson /* 94*61961e0fSrobinson * caution - the fillowing names are also in Makefile 957c478bd9Sstevel@tonic-gate * any changes here have to also be made there 967c478bd9Sstevel@tonic-gate * 977c478bd9Sstevel@tonic-gate * it's a good idea to make directories .foo, since this ensures 987c478bd9Sstevel@tonic-gate * that they'll be ignored by processes that search subdirectories in SPOOL 997c478bd9Sstevel@tonic-gate * 1007c478bd9Sstevel@tonic-gate * XQTDIR = /var/uucp/.Xqtdir 1017c478bd9Sstevel@tonic-gate * CORRUPT = /var/uucp/.Corrupt 1027c478bd9Sstevel@tonic-gate * LOGDIR = /var/uucp/.Log 1037c478bd9Sstevel@tonic-gate * SEQDIR = /var/uucp/.Sequence 1047c478bd9Sstevel@tonic-gate * STATDIR = /var/uucp/.Status 1057c478bd9Sstevel@tonic-gate */ 1067c478bd9Sstevel@tonic-gate 1077c478bd9Sstevel@tonic-gate /* where to put the STST. files? */ 1087c478bd9Sstevel@tonic-gate #define STATDIR (const char *)"/var/uucp/.Status" 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate /* where should logfiles be kept? */ 1117c478bd9Sstevel@tonic-gate #define LOGUUX (const char *)"/var/uucp/.Log/uux" 1127c478bd9Sstevel@tonic-gate #define LOGUUXQT (const char *)"/var/uucp/.Log/uuxqt" 1137c478bd9Sstevel@tonic-gate #define LOGUUCP (const char *)"/var/uucp/.Log/uucp" 1147c478bd9Sstevel@tonic-gate #define LOGCICO (const char *)"/var/uucp/.Log/uucico" 1157c478bd9Sstevel@tonic-gate #define CORRUPTDIR (const char *)"/var/uucp/.Corrupt" 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate /* some sites use /var/uucp/.XQTDIR here */ 1187c478bd9Sstevel@tonic-gate /* use caution since things are linked into there */ 1197c478bd9Sstevel@tonic-gate #define XQTDIR (const char *)"/var/uucp/.Xqtdir" 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate /* how much of a system name can we print in a [CX]. file? */ 1227c478bd9Sstevel@tonic-gate /* MAXBASENAME - 1 (pre) - 1 ('.') - 1 (grade) - 4 (sequence number) */ 1237c478bd9Sstevel@tonic-gate #define SYSNSIZE (MAXBASENAME - 7) 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate #ifdef USRSPOOLLOCKS 1267c478bd9Sstevel@tonic-gate #define LOCKPRE (const char *)"/var/spool/locks/LCK." 1277c478bd9Sstevel@tonic-gate #else 1287c478bd9Sstevel@tonic-gate #define LOCKPRE (const char *)"/var/spool/uucp/LCK." 1297c478bd9Sstevel@tonic-gate #endif /* USRSPOOLLOCKS */ 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate #define SQFILE (const char *)"/etc/uucp/SQFILE" 1327c478bd9Sstevel@tonic-gate #define SQTMP (const char *)"/etc/uucp/SQTMP" 1337c478bd9Sstevel@tonic-gate #define SLCKTIME 5400 /* system/device timeout (LCK.. files) */ 1347c478bd9Sstevel@tonic-gate #define DIALCODES (const char *)"/etc/uucp/Dialcodes" 1357c478bd9Sstevel@tonic-gate #define PERMISSIONS (const char *)"/etc/uucp/Permissions" 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate #define SPOOL (const char *)"/var/spool/uucp" 1387c478bd9Sstevel@tonic-gate #define SEQDIR (const char *)"/var/uucp/.Sequence" 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate #define X_LOCKTIME 3600 1417c478bd9Sstevel@tonic-gate #ifdef USRSPOOLLOCKS 1427c478bd9Sstevel@tonic-gate #define SEQLOCK (const char *)"/var/spool/locks/LCK.SQ." 1437c478bd9Sstevel@tonic-gate #define SQLOCK (const char *)"/var/spool/locks/LCK.SQ" 1447c478bd9Sstevel@tonic-gate #define X_LOCK (const char *)"/var/spool/locks/LCK.X" 1457c478bd9Sstevel@tonic-gate #define S_LOCK (const char *)"/var/spool/locks/LCK.S" 1467c478bd9Sstevel@tonic-gate #define L_LOCK (const char *)"/var/spool/locks/LK" 147*61961e0fSrobinson #define X_LOCKDIR (const char *)"/var/spool/locks" 148*61961e0fSrobinson /* must be dir part of above */ 1497c478bd9Sstevel@tonic-gate #else 1507c478bd9Sstevel@tonic-gate #define SEQLOCK (const char *)"/var/spool/uucp/LCK.SQ." 1517c478bd9Sstevel@tonic-gate #define SQLOCK (const char *)"/var/spool/uucp/LCK.SQ" 1527c478bd9Sstevel@tonic-gate #define X_LOCK (const char *)"/var/spool/uucp/LCK.X" 1537c478bd9Sstevel@tonic-gate #define S_LOCK (const char *)"/var/spool/uucp/LCK.S" 1547c478bd9Sstevel@tonic-gate #define L_LOCK (const char *)"/var/spool/uucp/LK" 155*61961e0fSrobinson #define X_LOCKDIR (const char *)"/var/spool/uucp" 156*61961e0fSrobinson /* must be dir part of above */ 1577c478bd9Sstevel@tonic-gate #endif /* USRSPOOLLOCKS */ 1587c478bd9Sstevel@tonic-gate #define X_LOCKPRE (const char *)"LCK.X" /* must be last part of above */ 1597c478bd9Sstevel@tonic-gate 1607c478bd9Sstevel@tonic-gate #define PUBDIR (const char *)"/var/spool/uucppublic" 1617c478bd9Sstevel@tonic-gate #define ADMIN (const char *)"/var/uucp/.Admin" 1627c478bd9Sstevel@tonic-gate #define ERRLOG (const char *)"/var/uucp/.Admin/errors" 1637c478bd9Sstevel@tonic-gate #define SYSLOG (const char *)"/var/uucp/.Admin/xferstats" 1647c478bd9Sstevel@tonic-gate #define RMTDEBUG (const char *)"/var/uucp/.Admin/audit" 1657c478bd9Sstevel@tonic-gate #define CLEANUPLOGFILE (const char *)"/var/uucp/.Admin/uucleanup" 1667c478bd9Sstevel@tonic-gate #define CMDLOG (const char *)"/var/uucp/.Admin/command" 1677c478bd9Sstevel@tonic-gate #define PERFLOG (const char *)"/var/uucp/.Admin/perflog" 1687c478bd9Sstevel@tonic-gate #define ACCOUNT (const char *)"/var/uucp/.Admin/account" 1697c478bd9Sstevel@tonic-gate #define SECURITY (const char *)"/var/uucp/.Admin/security" 1707c478bd9Sstevel@tonic-gate 1717c478bd9Sstevel@tonic-gate #define WORKSPACE (const char *)"/var/uucp/.Workspace" 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate #define SQTIME 60 1747c478bd9Sstevel@tonic-gate #define TRYCALLS 2 /* number of tries to dial call */ 1757c478bd9Sstevel@tonic-gate #define MINULIMIT (1L<<11) /* minimum reasonable ulimit */ 1767c478bd9Sstevel@tonic-gate #define MAX_LOCKTRY 5 /* number of attempts to lock device */ 1777c478bd9Sstevel@tonic-gate 1787c478bd9Sstevel@tonic-gate /* 1797c478bd9Sstevel@tonic-gate * CDEBUG is for communication line debugging 1807c478bd9Sstevel@tonic-gate * DEBUG is for program debugging 1817c478bd9Sstevel@tonic-gate * #define SMALL to compile without the DEBUG code 1827c478bd9Sstevel@tonic-gate */ 1837c478bd9Sstevel@tonic-gate 1847c478bd9Sstevel@tonic-gate #define CDEBUG(l, f, s) 1857c478bd9Sstevel@tonic-gate #define SMALL 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate #ifndef SMALL 1887c478bd9Sstevel@tonic-gate #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s) 1897c478bd9Sstevel@tonic-gate #else 1907c478bd9Sstevel@tonic-gate #define DEBUG(l, f, s) 1917c478bd9Sstevel@tonic-gate #endif /* SMALL */ 1927c478bd9Sstevel@tonic-gate 1937c478bd9Sstevel@tonic-gate /* 1947c478bd9Sstevel@tonic-gate * VERBOSE is used by cu and ct to inform the user of progress 1957c478bd9Sstevel@tonic-gate * In other programs, the Value of Verbose is always 0. 1967c478bd9Sstevel@tonic-gate */ 197*61961e0fSrobinson #define VERBOSE(f, s) { if (Verbose > 0) (void) fprintf(stderr, f, s); } 1987c478bd9Sstevel@tonic-gate 1997c478bd9Sstevel@tonic-gate #define PREFIX(pre, str) (strncmp((pre), (str), strlen(pre)) == SAME) 2007c478bd9Sstevel@tonic-gate #define BASENAME(str, c) ((Bnptr = strrchr((str), c)) ? (Bnptr + 1) : (str)) 201*61961e0fSrobinson #define EQUALS(a, b) ((a != CNULL) && (b != CNULL) && \ 202*61961e0fSrobinson (strcmp((a), (b)) == SAME)) 203*61961e0fSrobinson #define EQUALSN(a, b, n) ((a != CNULL) && (b != CNULL) && \ 204*61961e0fSrobinson (strncmp((a), (b), (n)) == SAME)) 2057c478bd9Sstevel@tonic-gate #define LASTCHAR(s) (s+strlen(s)-1) 2067c478bd9Sstevel@tonic-gate 2077c478bd9Sstevel@tonic-gate #define SAME 0 2087c478bd9Sstevel@tonic-gate #define ANYREAD 04 2097c478bd9Sstevel@tonic-gate #define ANYWRITE 02 2107c478bd9Sstevel@tonic-gate #define FAIL -1 2117c478bd9Sstevel@tonic-gate #define SUCCESS 0 2127c478bd9Sstevel@tonic-gate #define NULLCHAR '\0' 2137c478bd9Sstevel@tonic-gate #define CNULL (char *)0 2147c478bd9Sstevel@tonic-gate #define STBNULL (struct sgttyb *)0 2157c478bd9Sstevel@tonic-gate #define MASTER 1 2167c478bd9Sstevel@tonic-gate #define SLAVE 0 2177c478bd9Sstevel@tonic-gate #define MAXBASENAME 14 /* should be DIRSIZ but that is now fs dependent */ 2187c478bd9Sstevel@tonic-gate #define MAXFULLNAME BUFSIZ 2197c478bd9Sstevel@tonic-gate #define MAXNAMESIZE 64 /* /var/spool/uucp/<14 chars>/<14 chars>+slop */ 2207c478bd9Sstevel@tonic-gate #define CONNECTTIME 30 2217c478bd9Sstevel@tonic-gate #define EXPECTTIME 45 2227c478bd9Sstevel@tonic-gate #define MSGTIME 60 2237c478bd9Sstevel@tonic-gate #define NAMESIZE MAXBASENAME+1 2247c478bd9Sstevel@tonic-gate #define SIZEOFPID 10 /* maximum number of digits in a pid */ 2257c478bd9Sstevel@tonic-gate #define EOTMSG "\004\n\004\n" 2267c478bd9Sstevel@tonic-gate #define CALLBACK 1 2277c478bd9Sstevel@tonic-gate 2287c478bd9Sstevel@tonic-gate /* manifests for sysfiles.c's sysaccess() */ 2297c478bd9Sstevel@tonic-gate /* check file access for REAL user id */ 2307c478bd9Sstevel@tonic-gate #define ACCESS_SYSTEMS 1 2317c478bd9Sstevel@tonic-gate #define ACCESS_DEVICES 2 2327c478bd9Sstevel@tonic-gate #define ACCESS_DIALERS 3 2337c478bd9Sstevel@tonic-gate /* check file access for EFFECTIVE user id */ 2347c478bd9Sstevel@tonic-gate #define EACCESS_SYSTEMS 4 2357c478bd9Sstevel@tonic-gate #define EACCESS_DEVICES 5 2367c478bd9Sstevel@tonic-gate #define EACCESS_DIALERS 6 2377c478bd9Sstevel@tonic-gate 2387c478bd9Sstevel@tonic-gate /* manifest for chkpth flag */ 2397c478bd9Sstevel@tonic-gate #define CK_READ 0 2407c478bd9Sstevel@tonic-gate #define CK_WRITE 1 2417c478bd9Sstevel@tonic-gate 2427c478bd9Sstevel@tonic-gate /* 2437c478bd9Sstevel@tonic-gate * commands 2447c478bd9Sstevel@tonic-gate */ 2457c478bd9Sstevel@tonic-gate #define SHELL (const char *)"/usr/bin/sh" 2467c478bd9Sstevel@tonic-gate #define MAIL (const char *)"mail" 2477c478bd9Sstevel@tonic-gate #define UUCICO (const char *)"/usr/lib/uucp/uucico" 2487c478bd9Sstevel@tonic-gate #define UUXQT (const char *)"/usr/lib/uucp/uuxqt" 2497c478bd9Sstevel@tonic-gate #define UUX (const char *)"/usr/bin/uux" 2507c478bd9Sstevel@tonic-gate #define UUCP (const char *)"/usr/bin/uucp" 2517c478bd9Sstevel@tonic-gate 2527c478bd9Sstevel@tonic-gate 2537c478bd9Sstevel@tonic-gate /* system status stuff */ 2547c478bd9Sstevel@tonic-gate #define SS_OK 0 2557c478bd9Sstevel@tonic-gate #define SS_NO_DEVICE 1 2567c478bd9Sstevel@tonic-gate #define SS_TIME_WRONG 2 2577c478bd9Sstevel@tonic-gate #define SS_INPROGRESS 3 2587c478bd9Sstevel@tonic-gate #define SS_CONVERSATION 4 2597c478bd9Sstevel@tonic-gate #define SS_SEQBAD 5 2607c478bd9Sstevel@tonic-gate #define SS_LOGIN_FAILED 6 2617c478bd9Sstevel@tonic-gate #define SS_DIAL_FAILED 7 2627c478bd9Sstevel@tonic-gate #define SS_BAD_LOG_MCH 8 2637c478bd9Sstevel@tonic-gate #define SS_LOCKED_DEVICE 9 2647c478bd9Sstevel@tonic-gate #define SS_ASSERT_ERROR 10 2657c478bd9Sstevel@tonic-gate #define SS_BADSYSTEM 11 2667c478bd9Sstevel@tonic-gate #define SS_CANT_ACCESS_DEVICE 12 2677c478bd9Sstevel@tonic-gate #define SS_DEVICE_FAILED 13 /* used for interface failure */ 2687c478bd9Sstevel@tonic-gate #define SS_WRONG_MCH 14 2697c478bd9Sstevel@tonic-gate #define SS_CALLBACK 15 2707c478bd9Sstevel@tonic-gate #define SS_RLOCKED 16 2717c478bd9Sstevel@tonic-gate #define SS_RUNKNOWN 17 2727c478bd9Sstevel@tonic-gate #define SS_RLOGIN 18 2737c478bd9Sstevel@tonic-gate #define SS_UNKNOWN_RESPONSE 19 2747c478bd9Sstevel@tonic-gate #define SS_STARTUP 20 2757c478bd9Sstevel@tonic-gate #define SS_CHAT_FAILED 21 2767c478bd9Sstevel@tonic-gate #define SS_CALLBACK_LOOP 22 2777c478bd9Sstevel@tonic-gate 2787c478bd9Sstevel@tonic-gate #define MAXPH 60 /* maximum phone string size */ 2797c478bd9Sstevel@tonic-gate #define MAXC BUFSIZ 2807c478bd9Sstevel@tonic-gate 2817c478bd9Sstevel@tonic-gate #define TRUE 1 2827c478bd9Sstevel@tonic-gate #define FALSE 0 2837c478bd9Sstevel@tonic-gate #define NAMEBUF 32 2847c478bd9Sstevel@tonic-gate 2857c478bd9Sstevel@tonic-gate /* The call structure is used by ct.c, cu.c, and dial.c. */ 2867c478bd9Sstevel@tonic-gate 2877c478bd9Sstevel@tonic-gate struct call { 2887c478bd9Sstevel@tonic-gate char *speed; /* transmission baud rate */ 2897c478bd9Sstevel@tonic-gate char *line; /* device name for outgoing line */ 2907c478bd9Sstevel@tonic-gate char *telno; /* ptr to tel-no digit string */ 2917c478bd9Sstevel@tonic-gate char *type; /* type of device to use for call. */ 2927c478bd9Sstevel@tonic-gate }; 2937c478bd9Sstevel@tonic-gate 2947c478bd9Sstevel@tonic-gate /* structure of an Systems file line */ 2957c478bd9Sstevel@tonic-gate #define F_MAX 50 /* max number of fields in Systems file line */ 2967c478bd9Sstevel@tonic-gate #define F_NAME 0 2977c478bd9Sstevel@tonic-gate #define F_TIME 1 2987c478bd9Sstevel@tonic-gate #define F_TYPE 2 2997c478bd9Sstevel@tonic-gate #define F_CLASS 3 /* an optional prefix and the speed */ 3007c478bd9Sstevel@tonic-gate #define F_PHONE 4 3017c478bd9Sstevel@tonic-gate #define F_LOGIN 5 3027c478bd9Sstevel@tonic-gate 3037c478bd9Sstevel@tonic-gate /* structure of an Devices file line */ 3047c478bd9Sstevel@tonic-gate #define D_TYPE 0 3057c478bd9Sstevel@tonic-gate #define D_LINE 1 3067c478bd9Sstevel@tonic-gate #define D_CALLDEV 2 3077c478bd9Sstevel@tonic-gate #define D_CLASS 3 3087c478bd9Sstevel@tonic-gate #define D_CALLER 4 3097c478bd9Sstevel@tonic-gate #define D_ARG 5 3107c478bd9Sstevel@tonic-gate #define D_MAX 50 /* max number of fields in Devices file line */ 3117c478bd9Sstevel@tonic-gate 3127c478bd9Sstevel@tonic-gate #define D_ACU 1 3137c478bd9Sstevel@tonic-gate #define D_DIRECT 2 3147c478bd9Sstevel@tonic-gate #define D_PROT 4 3157c478bd9Sstevel@tonic-gate 3167c478bd9Sstevel@tonic-gate #define GRADES "/etc/uucp/Grades" 3177c478bd9Sstevel@tonic-gate 3187c478bd9Sstevel@tonic-gate #define D_QUEUE 'Z' /* default queue */ 3197c478bd9Sstevel@tonic-gate 3207c478bd9Sstevel@tonic-gate /* past here, local changes are not recommended */ 3217c478bd9Sstevel@tonic-gate #define CMDPRE 'C' 3227c478bd9Sstevel@tonic-gate #define DATAPRE 'D' 3237c478bd9Sstevel@tonic-gate #define XQTPRE 'X' 3247c478bd9Sstevel@tonic-gate 3257c478bd9Sstevel@tonic-gate /* 3267c478bd9Sstevel@tonic-gate * stuff for command execution 3277c478bd9Sstevel@tonic-gate */ 3287c478bd9Sstevel@tonic-gate #define X_RQDFILE 'F' 3297c478bd9Sstevel@tonic-gate #define X_STDIN 'I' 3307c478bd9Sstevel@tonic-gate #define X_STDOUT 'O' 3317c478bd9Sstevel@tonic-gate #define X_STDERR 'E' 3327c478bd9Sstevel@tonic-gate #define X_CMD 'C' 3337c478bd9Sstevel@tonic-gate #define X_USER 'U' 3347c478bd9Sstevel@tonic-gate #define X_BRINGBACK 'B' 3357c478bd9Sstevel@tonic-gate #define X_MAILF 'M' 3367c478bd9Sstevel@tonic-gate #define X_RETADDR 'R' 3377c478bd9Sstevel@tonic-gate #define X_COMMENT '#' 3387c478bd9Sstevel@tonic-gate #define X_NONZERO 'Z' 3397c478bd9Sstevel@tonic-gate #define X_SENDNOTHING 'N' 3407c478bd9Sstevel@tonic-gate #define X_SENDZERO 'n' 3417c478bd9Sstevel@tonic-gate 3427c478bd9Sstevel@tonic-gate 3437c478bd9Sstevel@tonic-gate /* This structure describes call routines */ 3447c478bd9Sstevel@tonic-gate struct caller { 3457c478bd9Sstevel@tonic-gate const char *CA_type; 3467c478bd9Sstevel@tonic-gate int (*CA_caller)(); 3477c478bd9Sstevel@tonic-gate }; 3487c478bd9Sstevel@tonic-gate 3497c478bd9Sstevel@tonic-gate /* structure for a saved C file */ 3507c478bd9Sstevel@tonic-gate 3517c478bd9Sstevel@tonic-gate struct cs_struct { 3527c478bd9Sstevel@tonic-gate char file[NAMESIZE]; 3537c478bd9Sstevel@tonic-gate char sys[NAMESIZE+5]; 3547c478bd9Sstevel@tonic-gate char sgrade[NAMESIZE]; 3557c478bd9Sstevel@tonic-gate char grade; 3567c478bd9Sstevel@tonic-gate long jsize; 3577c478bd9Sstevel@tonic-gate }; 3587c478bd9Sstevel@tonic-gate 3597c478bd9Sstevel@tonic-gate /* This structure describes dialing routines */ 3607c478bd9Sstevel@tonic-gate struct dialer { 3617c478bd9Sstevel@tonic-gate char *DI_type; 3627c478bd9Sstevel@tonic-gate int (*DI_dialer)(); 3637c478bd9Sstevel@tonic-gate }; 3647c478bd9Sstevel@tonic-gate 3657c478bd9Sstevel@tonic-gate struct nstat { 3667c478bd9Sstevel@tonic-gate pid_t t_pid; /* process id */ 3677c478bd9Sstevel@tonic-gate time_t t_start; /* start time */ 3687c478bd9Sstevel@tonic-gate time_t t_scall; /* start call to system */ 3697c478bd9Sstevel@tonic-gate time_t t_ecall; /* end call to system */ 3707c478bd9Sstevel@tonic-gate time_t t_tacu; /* acu time */ 3717c478bd9Sstevel@tonic-gate time_t t_tlog; /* login time */ 3727c478bd9Sstevel@tonic-gate time_t t_sftp; /* start file transfer protocol */ 3737c478bd9Sstevel@tonic-gate time_t t_sxf; /* start xfer */ 3747c478bd9Sstevel@tonic-gate time_t t_exf; /* end xfer */ 3757c478bd9Sstevel@tonic-gate time_t t_eftp; /* end file transfer protocol */ 3767c478bd9Sstevel@tonic-gate time_t t_qtime; /* time file queued */ 3777c478bd9Sstevel@tonic-gate int t_ndial; /* # of dials */ 3787c478bd9Sstevel@tonic-gate int t_nlogs; /* # of login trys */ 3797c478bd9Sstevel@tonic-gate struct tms t_tbb; /* start execution times */ 3807c478bd9Sstevel@tonic-gate struct tms t_txfs; /* xfer start times */ 3817c478bd9Sstevel@tonic-gate struct tms t_txfe; /* xfer end times */ 3827c478bd9Sstevel@tonic-gate struct tms t_tga; /* garbage execution times */ 3837c478bd9Sstevel@tonic-gate }; 3847c478bd9Sstevel@tonic-gate 3857c478bd9Sstevel@tonic-gate /* This structure describes the values from Limits file */ 3867c478bd9Sstevel@tonic-gate struct limits { 3877c478bd9Sstevel@tonic-gate int totalmax; /* overall limit */ 3887c478bd9Sstevel@tonic-gate int sitemax; /* limit per site */ 3897c478bd9Sstevel@tonic-gate char mode[64]; /* uucico mode */ 3907c478bd9Sstevel@tonic-gate }; 3917c478bd9Sstevel@tonic-gate 3927c478bd9Sstevel@tonic-gate /* external declarations */ 3937c478bd9Sstevel@tonic-gate 394*61961e0fSrobinson static ssize_t (*Read)(), (*Write)(); 395*61961e0fSrobinson static int (*Ioctl)(int, int, ...); 396*61961e0fSrobinson static int Debug, Verbose; 397*61961e0fSrobinson static uid_t Uid, Euid; /* user-id and effective-uid */ 398*61961e0fSrobinson static mode_t Dev_mode; /* save device mode here */ 399*61961e0fSrobinson static long Retrytime; 400*61961e0fSrobinson static char Dc[]; /* line name */ 401*61961e0fSrobinson static const char *Spool; 402*61961e0fSrobinson static const char *Pubdir; 403*61961e0fSrobinson static char Progname[]; 404*61961e0fSrobinson static char *Bnptr; /* used when BASENAME macro is expanded */ 4057c478bd9Sstevel@tonic-gate 406*61961e0fSrobinson static int Uerror; /* global error code */ 407*61961e0fSrobinson static char *UerrorText[]; /* text for error code */ 4087c478bd9Sstevel@tonic-gate 4097c478bd9Sstevel@tonic-gate #define UERRORTEXT UerrorText[Uerror] 4107c478bd9Sstevel@tonic-gate #define UTEXT(x) UerrorText[x] 4117c478bd9Sstevel@tonic-gate 4127c478bd9Sstevel@tonic-gate /* things get kind of tricky beyond this point -- please stay out */ 4137c478bd9Sstevel@tonic-gate 4147c478bd9Sstevel@tonic-gate /* uucp functions and subroutine */ 415*61961e0fSrobinson static void (*genbrk)(); 4167c478bd9Sstevel@tonic-gate extern int iswrk(), gtwvec(); /* anlwrk.c */ 4177c478bd9Sstevel@tonic-gate extern void findgrade(); /* grades.c */ 4187c478bd9Sstevel@tonic-gate extern void chremdir(), mkremdir(); /* chremdir.c */ 4197c478bd9Sstevel@tonic-gate extern void toCorrupt(); /* cpmv.c */ 4207c478bd9Sstevel@tonic-gate extern int xmv(); /* cpmv.c */ 4217c478bd9Sstevel@tonic-gate 422*61961e0fSrobinson static int getargs(); /* getargs.c */ 423*61961e0fSrobinson static void bsfix(); /* getargs.c */ 4247c478bd9Sstevel@tonic-gate extern char *getprm(); /* getprm.c */ 4257c478bd9Sstevel@tonic-gate 4267c478bd9Sstevel@tonic-gate extern char *next_token(); /* permission.c */ 4277c478bd9Sstevel@tonic-gate extern char *nextarg(); /* permission.c */ 4287c478bd9Sstevel@tonic-gate extern int getuline(); /* permission.c */ 4297c478bd9Sstevel@tonic-gate 430*61961e0fSrobinson static void logent(const char *, const char *); /* logent.c */ 4317c478bd9Sstevel@tonic-gate extern void commandlog(); /* logent.c */ 4327c478bd9Sstevel@tonic-gate extern time_t millitick(); /* logent.c */ 4337c478bd9Sstevel@tonic-gate 4347c478bd9Sstevel@tonic-gate extern unsigned long getfilesize(); /* statlog.c */ 4357c478bd9Sstevel@tonic-gate extern void putfilesize(); /* statlog.c */ 4367c478bd9Sstevel@tonic-gate 4377c478bd9Sstevel@tonic-gate extern int logFind(), mchFind(); /* permission.c */ 4387c478bd9Sstevel@tonic-gate extern int chkperm(), chkpth(); /* permission.c */ 4397c478bd9Sstevel@tonic-gate extern int cmdOK(), switchRole(); /* permission.c */ 4407c478bd9Sstevel@tonic-gate extern int callBack(), requestOK(); /* permission.c */ 4417c478bd9Sstevel@tonic-gate extern int noSpool(); /* permission.c */ 4427c478bd9Sstevel@tonic-gate extern void myName(); /* permission.c */ 4437c478bd9Sstevel@tonic-gate 4447c478bd9Sstevel@tonic-gate extern int mkdirs(); /* expfile.c */ 4457c478bd9Sstevel@tonic-gate extern int scanlimit(); /* limits.c */ 4467c478bd9Sstevel@tonic-gate extern void systat(); /* systat.c */ 447*61961e0fSrobinson static int fd_mklock(); /* ulockf.c */ 448*61961e0fSrobinson static int mklock(), cklock(); /* ulockf.c */ 449*61961e0fSrobinson static void fd_rmlock(), rmlock(); /* ulockf.c */ 4507c478bd9Sstevel@tonic-gate extern char *timeStamp(); /* utility.c */ 451*61961e0fSrobinson static void assert(const char *s1, const char *s2, 4527c478bd9Sstevel@tonic-gate int i1, const char *s3, int i2); /* utility.c */ 4537c478bd9Sstevel@tonic-gate extern void uucpname(); /* uucpname.c */ 4547c478bd9Sstevel@tonic-gate extern int versys(); /* versys.c */ 4557c478bd9Sstevel@tonic-gate extern void xuuxqt(), xuucico(); /* xqt.c */ 456*61961e0fSrobinson static void cleanup(); /* misc main.c */ 4577c478bd9Sstevel@tonic-gate 4587c478bd9Sstevel@tonic-gate #define ASSERT(e, s1, s2, i1) if (!(e)) { \ 4597c478bd9Sstevel@tonic-gate assert(s1, s2, i1, __FILE__, __LINE__); \ 460*61961e0fSrobinson cleanup(FAIL); \ 4617c478bd9Sstevel@tonic-gate }; 4627c478bd9Sstevel@tonic-gate 4637c478bd9Sstevel@tonic-gate /* messages */ 464*61961e0fSrobinson static const char Ct_OPEN[]; 465*61961e0fSrobinson static const char Ct_WRITE[]; 466*61961e0fSrobinson static const char Ct_READ[]; 467*61961e0fSrobinson static const char Ct_CREATE[]; 468*61961e0fSrobinson static const char Ct_ALLOCATE[]; 469*61961e0fSrobinson static const char Ct_LOCK[]; 470*61961e0fSrobinson static const char Ct_STAT[]; 471*61961e0fSrobinson static const char Ct_CHOWN[]; 472*61961e0fSrobinson static const char Ct_CHMOD[]; 473*61961e0fSrobinson static const char Ct_LINK[]; 474*61961e0fSrobinson static const char Ct_CHDIR[]; 475*61961e0fSrobinson static const char Ct_UNLINK[]; 476*61961e0fSrobinson static const char Wr_ROLE[]; 477*61961e0fSrobinson static const char Ct_CORRUPT[]; 478*61961e0fSrobinson static const char Ct_FORK[]; 479*61961e0fSrobinson static const char Ct_CLOSE[]; 480*61961e0fSrobinson static const char Ct_BADOWN[]; 481*61961e0fSrobinson static const char Fl_EXISTS[]; 4827c478bd9Sstevel@tonic-gate 483*61961e0fSrobinson #ifdef __cplusplus 484*61961e0fSrobinson } 4857c478bd9Sstevel@tonic-gate #endif 486*61961e0fSrobinson 487*61961e0fSrobinson #endif /* _UUCP_H */ 488