|
|
1.1 root 1: # define THEKEY "hellotherekids"
2: /*
3: get all the machine dependencies, standard I/O, and the
4: configuration definitions (LOCAL machine, etc.)
5: */
6:
7: # include <stdio.h>
8:
9: # define min(a,b) (a > b ? b : a)
10: # define getremote(S) (remtable[(S)-'a'])
11:
12: /* adjustable parameters, may differ per machine */
13:
14: # define MAXBREAD 3
15: # define ATIME 20
16: # define DBV 0
17: # define BLOCKSIZE 500
18: # define SIZE 100
19: # define INITFILE "/usr/net/initfile"
20: # define NSEND 20
21: # define SAMPL 3600 /* 1 hour = 3600 */
22: # define BIGSAMPL 64800L /* 18 hours = 64800L */
23: # define LINKS 9
24: # define SUPERUSER 0
25:
26: /* adjustable parameters, must be same on all machines */
27:
28: /* MAXFILE is the file size limit. If changed on one machine
29: but not the others, files bigger than the common minimum will
30: be flushed with no guarantee of err msgs. Thus if one link
31: is to be of a different limit than the others, make sure the users
32: know this.
33: */
34: # define MAXFILE 100000L
35: # define MAXFILELARGE 500000L
36: /* the version of the protocol the network speaks */
37: # define VMAJOR 1
38: # define VMINOR 0
39: /* the time constant added to all time stamps sent around the net */
40: # define TIMEBASE 282098011L
41: /* the number of mail forwarding hops allowed before looping is detected */
42: # define MAXHOPS 30
43:
44: /* non-adjustable constants */
45:
46: /* PARMLIST = max size of variable length parm list used in protocol */
47: # define PARMLIST 2000
48: /* FNS = max length of file name string */
49: # define FNS 50
50: /* NS = length of UNIX user name*/
51: # define NS 10
52: /* returned by prot.c */
53: # define BROKENREAD -2
54: # define WRITEFAIL -3
55: # define INCR 040
56: # define MINSIZE 50
57:
58: /* flags for packet type (pcode) */
59: # define RESET 01
60: # define REQUEST 02
61: # define ACK 04
62: # define PURGE 020
63:
64: /* flags for mach type */
65: # define M_CORY 1
66: # define M_CC 2
67: # define M_VAX 3
68: # define M_INGRES 4
69: # define M_SRC 5
70: # define M_OTHER 6
71:
72: /* codes for cflag, powers of two, max (8 bits - 'a'), others may be added */
73:
74: /* F_QUIET means send back only error messages and output of programs,
75: don't send back confimation with no data */
76: /* F_NONOTIFY means don't send back anything, ever,
77: even if there are errors (used for responses, etc.) */
78:
79: # define F_QUIET 02
80: # define F_NONOTIFY 04
81:
82:
83: /*
84: at this point bring in the locally-dependent definitions.
85: this way the above parms may be altered.
86: */
87: # include "mach.h"
88: # include "Paths.h"
89:
90: /* structure declarations */
91: struct packet {
92: short seqno;
93: char pcode;
94: char len;
95: char chksum;
96: char data[1];
97: };
98:
99: /* the chksum is only on a per-perpacket level,
100: which is not enough.
101: There should be a checksum on the entire file as well.
102: */
103: struct dumpstruc {
104: long shorttime, longtime, elaptot, waittime, waittot; /* in secs */
105: long outime, ostime; /* in 60ths sec */
106: long nbytesent,nbytercv, bytetot; /* in bytes */
107: int nretrans, nabnormal, nloop;
108: int ncksum,npacksent,npackrcv;
109: int nnetcp,nnetlpr,nsmail,nnetmail,nresp,nnet;
110: int npass, nsend, nsendfail;
111: };
112:
113: struct bstruct {
114: char *bname;
115: char bmach;
116: };
117: /* functions */
118:
119: char *calloc(), *crypt(), *ctime(), *getenv(), *longname();
120: char *SnFromUid(), *comptime(), *getpass(), *handlesp(), *SnCurrent();
121: FILE *mopen(), *fdopen();
122: struct passwd *getpwnam(), *getpwuid(), *PwdCurrent(), *getpwent();
123: struct packet *getpacket();
124: long fixuplong(),atol();
125:
126: /* variables */
127: extern errno;
128: extern char *sys_errlist[];
129: int debugflg;
130: char remote, local; /* must be global, remote is not initialized*/
131: char netcmd[],senddir[], resfile[], Bsh[];
132: char machtype[], remtable[];
133:
134: /* used to pass around info about user */
135: struct info {
136: char login[NS];
137: char mpasswd[20];
138: int muid; /* combines uid and gid for FUID */
139: int mgid; /* unused for FUID */
140: char dir[FNS];
141: char loginshell[FNS];
142: char localname[NS];
143: int jobno;
144: char defcmd[FNS];
145: char force; /* if true, always prompt for login and pass */
146: char nonotify; /* if true, don't send anything back */
147: char nowrite; /* if true, mail rather than write to user */
148: char quiet; /* if true, only send a response back if rc !=0
149: or if there is stdout or stderr */
150: char sTtyname[20]; /* tty user is on,full name e.g. /dev/tty0 */
151: char sCmdAct[BUFSIZ]; /* the actual command the net will exec */
152: char sCmdVirt[BUFSIZ]; /* the command the user thinks he is getting */
153: long lTtytime; /* the time recorded for tty login in utmp */
154: } status;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.