2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License, Version 1.0 only
2N/A * (the "License"). You may not use this file except in compliance
2N/A * with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
2N/A/* All Rights Reserved */
2N/A
2N/A/*
2N/A * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _UUCP_H
2N/A#define _UUCP_H
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#include <sys/types.h>
2N/A#include <unistd.h>
2N/A#include <stdlib.h>
2N/A#include <string.h>
2N/A#include <parms.h>
2N/A
2N/A#include <stdio.h>
2N/A#include <ctype.h>
2N/A#include <setjmp.h>
2N/A#include <sys/param.h>
2N/A#include <termio.h>
2N/A#include <signal.h>
2N/A#include <fcntl.h>
2N/A#include <sys/stat.h>
2N/A#include <utime.h>
2N/A#include <dirent.h>
2N/A#include <time.h>
2N/A#include <sys/times.h>
2N/A#include <errno.h>
2N/A#include <sys/mkdev.h>
2N/A#include <strings.h>
2N/A#include <ulimit.h>
2N/A#include <sys/utsname.h>
2N/A#include <ustat.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A/* what mode should user files be allowed to have upon creation? */
2N/A/* NOTE: This does not allow setuid or execute bits on transfer. */
2N/A#define LEGALMODE (mode_t)0666
2N/A
2N/A/* what mode should public files have upon creation? */
2N/A#define PUB_FILEMODE (mode_t)0666
2N/A
2N/A/* what mode should log files have upon creation? */
2N/A#define LOGFILEMODE (mode_t)0644
2N/A
2N/A/* what mode should C. files have upon creation? */
2N/A#define CFILEMODE (mode_t)0644
2N/A
2N/A/* what mode should D. files have upon creation? */
2N/A#define DFILEMODE (mode_t)0600
2N/A
2N/A/* define the value of PUBMASK, used for creating "public" directories */
2N/A#define PUBMASK (mode_t)0000
2N/A
2N/A/* what mode should public directories have upon creation? */
2N/A#define PUB_DIRMODE (mode_t)0777
2N/A
2N/A/* define the value of DIRMASK, used for creating "system" subdirectories */
2N/A#define DIRMASK (mode_t)0022
2N/A
2N/A#define MAXSTART 300 /* how long to wait on startup */
2N/A
2N/A/* define the last characters for ACU (used for 801/212 dialers) */
2N/A#define ACULAST "<"
2N/A
2N/A/*
2N/A * caution - the fillowing names are also in Makefile
2N/A * any changes here have to also be made there
2N/A *
2N/A * it's a good idea to make directories .foo, since this ensures
2N/A * that they'll be ignored by processes that search subdirectories in SPOOL
2N/A *
2N/A * XQTDIR = /var/uucp/.Xqtdir
2N/A * CORRUPT = /var/uucp/.Corrupt
2N/A * LOGDIR = /var/uucp/.Log
2N/A * SEQDIR = /var/uucp/.Sequence
2N/A * STATDIR = /var/uucp/.Status
2N/A */
2N/A
2N/A/* where to put the STST. files? */
2N/A#define STATDIR (const char *)"/var/uucp/.Status"
2N/A
2N/A/* where should logfiles be kept? */
2N/A#define LOGUUX (const char *)"/var/uucp/.Log/uux"
2N/A#define LOGUUXQT (const char *)"/var/uucp/.Log/uuxqt"
2N/A#define LOGUUCP (const char *)"/var/uucp/.Log/uucp"
2N/A#define LOGCICO (const char *)"/var/uucp/.Log/uucico"
2N/A#define CORRUPTDIR (const char *)"/var/uucp/.Corrupt"
2N/A
2N/A/* some sites use /var/uucp/.XQTDIR here */
2N/A/* use caution since things are linked into there */
2N/A#define XQTDIR (const char *)"/var/uucp/.Xqtdir"
2N/A
2N/A/* how much of a system name can we print in a [CX]. file? */
2N/A/* MAXBASENAME - 1 (pre) - 1 ('.') - 1 (grade) - 4 (sequence number) */
2N/A#define SYSNSIZE (MAXBASENAME - 7)
2N/A
2N/A#ifdef USRSPOOLLOCKS
2N/A#define LOCKPRE (const char *)"/var/spool/locks/LCK."
2N/A#else
2N/A#define LOCKPRE (const char *)"/var/spool/uucp/LCK."
2N/A#endif /* USRSPOOLLOCKS */
2N/A
2N/A#define SQFILE (const char *)"/etc/uucp/SQFILE"
2N/A#define SQTMP (const char *)"/etc/uucp/SQTMP"
2N/A#define SLCKTIME 5400 /* system/device timeout (LCK.. files) */
2N/A#define DIALCODES (const char *)"/etc/uucp/Dialcodes"
2N/A#define PERMISSIONS (const char *)"/etc/uucp/Permissions"
2N/A
2N/A#define SPOOL (const char *)"/var/spool/uucp"
2N/A#define SEQDIR (const char *)"/var/uucp/.Sequence"
2N/A
2N/A#define X_LOCKTIME 3600
2N/A#ifdef USRSPOOLLOCKS
2N/A#define SEQLOCK (const char *)"/var/spool/locks/LCK.SQ."
2N/A#define SQLOCK (const char *)"/var/spool/locks/LCK.SQ"
2N/A#define X_LOCK (const char *)"/var/spool/locks/LCK.X"
2N/A#define S_LOCK (const char *)"/var/spool/locks/LCK.S"
2N/A#define L_LOCK (const char *)"/var/spool/locks/LK"
2N/A#define X_LOCKDIR (const char *)"/var/spool/locks"
2N/A /* must be dir part of above */
2N/A#else
2N/A#define SEQLOCK (const char *)"/var/spool/uucp/LCK.SQ."
2N/A#define SQLOCK (const char *)"/var/spool/uucp/LCK.SQ"
2N/A#define X_LOCK (const char *)"/var/spool/uucp/LCK.X"
2N/A#define S_LOCK (const char *)"/var/spool/uucp/LCK.S"
2N/A#define L_LOCK (const char *)"/var/spool/uucp/LK"
2N/A#define X_LOCKDIR (const char *)"/var/spool/uucp"
2N/A /* must be dir part of above */
2N/A#endif /* USRSPOOLLOCKS */
2N/A#define X_LOCKPRE (const char *)"LCK.X" /* must be last part of above */
2N/A
2N/A#define PUBDIR (const char *)"/var/spool/uucppublic"
2N/A#define ADMIN (const char *)"/var/uucp/.Admin"
2N/A#define ERRLOG (const char *)"/var/uucp/.Admin/errors"
2N/A#define SYSLOG (const char *)"/var/uucp/.Admin/xferstats"
2N/A#define RMTDEBUG (const char *)"/var/uucp/.Admin/audit"
2N/A#define CLEANUPLOGFILE (const char *)"/var/uucp/.Admin/uucleanup"
2N/A#define CMDLOG (const char *)"/var/uucp/.Admin/command"
2N/A#define PERFLOG (const char *)"/var/uucp/.Admin/perflog"
2N/A#define ACCOUNT (const char *)"/var/uucp/.Admin/account"
2N/A#define SECURITY (const char *)"/var/uucp/.Admin/security"
2N/A
2N/A#define WORKSPACE (const char *)"/var/uucp/.Workspace"
2N/A
2N/A#define SQTIME 60
2N/A#define TRYCALLS 2 /* number of tries to dial call */
2N/A#define MINULIMIT (1L<<11) /* minimum reasonable ulimit */
2N/A#define MAX_LOCKTRY 5 /* number of attempts to lock device */
2N/A
2N/A/*
2N/A * CDEBUG is for communication line debugging
2N/A * DEBUG is for program debugging
2N/A * #define SMALL to compile without the DEBUG code
2N/A */
2N/A
2N/A#define CDEBUG(l, f, s)
2N/A#define SMALL
2N/A
2N/A#ifndef SMALL
2N/A#define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s)
2N/A#else
2N/A#define DEBUG(l, f, s)
2N/A#endif /* SMALL */
2N/A
2N/A/*
2N/A * VERBOSE is used by cu and ct to inform the user of progress
2N/A * In other programs, the Value of Verbose is always 0.
2N/A */
2N/A#define VERBOSE(f, s) { if (Verbose > 0) (void) fprintf(stderr, f, s); }
2N/A
2N/A#define PREFIX(pre, str) (strncmp((pre), (str), strlen(pre)) == SAME)
2N/A#define BASENAME(str, c) ((Bnptr = strrchr((str), c)) ? (Bnptr + 1) : (str))
2N/A#define EQUALS(a, b) ((a != CNULL) && (b != CNULL) && \
2N/A (strcmp((a), (b)) == SAME))
2N/A#define EQUALSN(a, b, n) ((a != CNULL) && (b != CNULL) && \
2N/A (strncmp((a), (b), (n)) == SAME))
2N/A#define LASTCHAR(s) (s+strlen(s)-1)
2N/A
2N/A#define SAME 0
2N/A#define ANYREAD 04
2N/A#define ANYWRITE 02
2N/A#define FAIL -1
2N/A#define SUCCESS 0
2N/A#define NULLCHAR '\0'
2N/A#define CNULL (char *)0
2N/A#define STBNULL (struct sgttyb *)0
2N/A#define MASTER 1
2N/A#define SLAVE 0
2N/A#define MAXBASENAME 14 /* should be DIRSIZ but that is now fs dependent */
2N/A#define MAXFULLNAME BUFSIZ
2N/A#define MAXNAMESIZE 64 /* /var/spool/uucp/<14 chars>/<14 chars>+slop */
2N/A#define CONNECTTIME 30
2N/A#define EXPECTTIME 45
2N/A#define MSGTIME 60
2N/A#define NAMESIZE MAXBASENAME+1
2N/A#define SIZEOFPID 10 /* maximum number of digits in a pid */
2N/A#define EOTMSG "\004\n\004\n"
2N/A#define CALLBACK 1
2N/A
2N/A/* manifests for sysfiles.c's sysaccess() */
2N/A/* check file access for REAL user id */
2N/A#define ACCESS_SYSTEMS 1
2N/A#define ACCESS_DEVICES 2
2N/A#define ACCESS_DIALERS 3
2N/A/* check file access for EFFECTIVE user id */
2N/A#define EACCESS_SYSTEMS 4
2N/A#define EACCESS_DEVICES 5
2N/A#define EACCESS_DIALERS 6
2N/A
2N/A/* manifest for chkpth flag */
2N/A#define CK_READ 0
2N/A#define CK_WRITE 1
2N/A
2N/A/*
2N/A * commands
2N/A */
2N/A#define SHELL (const char *)"/usr/bin/sh"
2N/A#define MAIL (const char *)"mail"
2N/A#define UUCICO (const char *)"/usr/lib/uucp/uucico"
2N/A#define UUXQT (const char *)"/usr/lib/uucp/uuxqt"
2N/A#define UUX (const char *)"/usr/bin/uux"
2N/A#define UUCP (const char *)"/usr/bin/uucp"
2N/A
2N/A
2N/A/* system status stuff */
2N/A#define SS_OK 0
2N/A#define SS_NO_DEVICE 1
2N/A#define SS_TIME_WRONG 2
2N/A#define SS_INPROGRESS 3
2N/A#define SS_CONVERSATION 4
2N/A#define SS_SEQBAD 5
2N/A#define SS_LOGIN_FAILED 6
2N/A#define SS_DIAL_FAILED 7
2N/A#define SS_BAD_LOG_MCH 8
2N/A#define SS_LOCKED_DEVICE 9
2N/A#define SS_ASSERT_ERROR 10
2N/A#define SS_BADSYSTEM 11
2N/A#define SS_CANT_ACCESS_DEVICE 12
2N/A#define SS_DEVICE_FAILED 13 /* used for interface failure */
2N/A#define SS_WRONG_MCH 14
2N/A#define SS_CALLBACK 15
2N/A#define SS_RLOCKED 16
2N/A#define SS_RUNKNOWN 17
2N/A#define SS_RLOGIN 18
2N/A#define SS_UNKNOWN_RESPONSE 19
2N/A#define SS_STARTUP 20
2N/A#define SS_CHAT_FAILED 21
2N/A#define SS_CALLBACK_LOOP 22
2N/A
2N/A#define MAXPH 60 /* maximum phone string size */
2N/A#define MAXC BUFSIZ
2N/A
2N/A#define TRUE 1
2N/A#define FALSE 0
2N/A#define NAMEBUF 32
2N/A
2N/A/* The call structure is used by ct.c, cu.c, and dial.c. */
2N/A
2N/Astruct call {
2N/A char *speed; /* transmission baud rate */
2N/A char *line; /* device name for outgoing line */
2N/A char *telno; /* ptr to tel-no digit string */
2N/A char *type; /* type of device to use for call. */
2N/A};
2N/A
2N/A/* structure of an Systems file line */
2N/A#define F_MAX 50 /* max number of fields in Systems file line */
2N/A#define F_NAME 0
2N/A#define F_TIME 1
2N/A#define F_TYPE 2
2N/A#define F_CLASS 3 /* an optional prefix and the speed */
2N/A#define F_PHONE 4
2N/A#define F_LOGIN 5
2N/A
2N/A/* structure of an Devices file line */
2N/A#define D_TYPE 0
2N/A#define D_LINE 1
2N/A#define D_CALLDEV 2
2N/A#define D_CLASS 3
2N/A#define D_CALLER 4
2N/A#define D_ARG 5
2N/A#define D_MAX 50 /* max number of fields in Devices file line */
2N/A
2N/A#define D_ACU 1
2N/A#define D_DIRECT 2
2N/A#define D_PROT 4
2N/A
2N/A#define GRADES "/etc/uucp/Grades"
2N/A
2N/A#define D_QUEUE 'Z' /* default queue */
2N/A
2N/A/* past here, local changes are not recommended */
2N/A#define CMDPRE 'C'
2N/A#define DATAPRE 'D'
2N/A#define XQTPRE 'X'
2N/A
2N/A/*
2N/A * stuff for command execution
2N/A */
2N/A#define X_RQDFILE 'F'
2N/A#define X_STDIN 'I'
2N/A#define X_STDOUT 'O'
2N/A#define X_STDERR 'E'
2N/A#define X_CMD 'C'
2N/A#define X_USER 'U'
2N/A#define X_BRINGBACK 'B'
2N/A#define X_MAILF 'M'
2N/A#define X_RETADDR 'R'
2N/A#define X_COMMENT '#'
2N/A#define X_NONZERO 'Z'
2N/A#define X_SENDNOTHING 'N'
2N/A#define X_SENDZERO 'n'
2N/A
2N/A
2N/A/* This structure describes call routines */
2N/Astruct caller {
2N/A const char *CA_type;
2N/A int (*CA_caller)();
2N/A};
2N/A
2N/A/* structure for a saved C file */
2N/A
2N/Astruct cs_struct {
2N/A char file[NAMESIZE];
2N/A char sys[NAMESIZE+5];
2N/A char sgrade[NAMESIZE];
2N/A char grade;
2N/A long jsize;
2N/A};
2N/A
2N/A/* This structure describes dialing routines */
2N/Astruct dialer {
2N/A char *DI_type;
2N/A int (*DI_dialer)();
2N/A};
2N/A
2N/Astruct nstat {
2N/A pid_t t_pid; /* process id */
2N/A time_t t_start; /* start time */
2N/A time_t t_scall; /* start call to system */
2N/A time_t t_ecall; /* end call to system */
2N/A time_t t_tacu; /* acu time */
2N/A time_t t_tlog; /* login time */
2N/A time_t t_sftp; /* start file transfer protocol */
2N/A time_t t_sxf; /* start xfer */
2N/A time_t t_exf; /* end xfer */
2N/A time_t t_eftp; /* end file transfer protocol */
2N/A time_t t_qtime; /* time file queued */
2N/A int t_ndial; /* # of dials */
2N/A int t_nlogs; /* # of login trys */
2N/A struct tms t_tbb; /* start execution times */
2N/A struct tms t_txfs; /* xfer start times */
2N/A struct tms t_txfe; /* xfer end times */
2N/A struct tms t_tga; /* garbage execution times */
2N/A};
2N/A
2N/A/* This structure describes the values from Limits file */
2N/Astruct limits {
2N/A int totalmax; /* overall limit */
2N/A int sitemax; /* limit per site */
2N/A char mode[64]; /* uucico mode */
2N/A};
2N/A
2N/A/* external declarations */
2N/A
2N/Astatic ssize_t (*Read)(), (*Write)();
2N/Astatic int (*Ioctl)(int, int, ...);
2N/Astatic int Debug, Verbose;
2N/Astatic uid_t Uid, Euid; /* user-id and effective-uid */
2N/Astatic mode_t Dev_mode; /* save device mode here */
2N/Astatic long Retrytime;
2N/Astatic char Dc[]; /* line name */
2N/Astatic const char *Spool;
2N/Astatic const char *Pubdir;
2N/Astatic char Progname[];
2N/Astatic char *Bnptr; /* used when BASENAME macro is expanded */
2N/A
2N/Astatic int Uerror; /* global error code */
2N/Astatic char *UerrorText[]; /* text for error code */
2N/A
2N/A#define UERRORTEXT UerrorText[Uerror]
2N/A#define UTEXT(x) UerrorText[x]
2N/A
2N/A/* things get kind of tricky beyond this point -- please stay out */
2N/A
2N/A/* uucp functions and subroutine */
2N/Astatic void (*genbrk)();
2N/Aextern int iswrk(), gtwvec(); /* anlwrk.c */
2N/Aextern void findgrade(); /* grades.c */
2N/Aextern void chremdir(), mkremdir(); /* chremdir.c */
2N/Aextern void toCorrupt(); /* cpmv.c */
2N/Aextern int xmv(); /* cpmv.c */
2N/A
2N/Astatic int getargs(); /* getargs.c */
2N/Astatic void bsfix(); /* getargs.c */
2N/Aextern char *getprm(); /* getprm.c */
2N/A
2N/Aextern char *next_token(); /* permission.c */
2N/Aextern char *nextarg(); /* permission.c */
2N/Aextern int getuline(); /* permission.c */
2N/A
2N/Astatic void logent(const char *, const char *); /* logent.c */
2N/Aextern void commandlog(); /* logent.c */
2N/Aextern time_t millitick(); /* logent.c */
2N/A
2N/Aextern unsigned long getfilesize(); /* statlog.c */
2N/Aextern void putfilesize(); /* statlog.c */
2N/A
2N/Aextern int logFind(), mchFind(); /* permission.c */
2N/Aextern int chkperm(), chkpth(); /* permission.c */
2N/Aextern int cmdOK(), switchRole(); /* permission.c */
2N/Aextern int callBack(), requestOK(); /* permission.c */
2N/Aextern int noSpool(); /* permission.c */
2N/Aextern void myName(); /* permission.c */
2N/A
2N/Aextern int mkdirs(); /* expfile.c */
2N/Aextern int scanlimit(); /* limits.c */
2N/Aextern void systat(); /* systat.c */
2N/Astatic int fd_mklock(); /* ulockf.c */
2N/Astatic int mklock(), cklock(); /* ulockf.c */
2N/Astatic void fd_rmlock(), rmlock(); /* ulockf.c */
2N/Aextern char *timeStamp(); /* utility.c */
2N/Astatic void assert(const char *s1, const char *s2,
2N/A int i1, const char *s3, int i2); /* utility.c */
2N/Aextern void uucpname(); /* uucpname.c */
2N/Aextern int versys(); /* versys.c */
2N/Aextern void xuuxqt(), xuucico(); /* xqt.c */
2N/Astatic void cleanup(); /* misc main.c */
2N/A
2N/A#define ASSERT(e, s1, s2, i1) if (!(e)) { \
2N/A assert(s1, s2, i1, __FILE__, __LINE__); \
2N/A cleanup(FAIL); \
2N/A};
2N/A
2N/A/* messages */
2N/Astatic const char Ct_OPEN[];
2N/Astatic const char Ct_WRITE[];
2N/Astatic const char Ct_READ[];
2N/Astatic const char Ct_CREATE[];
2N/Astatic const char Ct_ALLOCATE[];
2N/Astatic const char Ct_LOCK[];
2N/Astatic const char Ct_STAT[];
2N/Astatic const char Ct_CHOWN[];
2N/Astatic const char Ct_CHMOD[];
2N/Astatic const char Ct_LINK[];
2N/Astatic const char Ct_CHDIR[];
2N/Astatic const char Ct_UNLINK[];
2N/Astatic const char Wr_ROLE[];
2N/Astatic const char Ct_CORRUPT[];
2N/Astatic const char Ct_FORK[];
2N/Astatic const char Ct_CLOSE[];
2N/Astatic const char Ct_BADOWN[];
2N/Astatic const char Fl_EXISTS[];
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _UUCP_H */