1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate *
4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate * with the License.
8*7c478bd9Sstevel@tonic-gate *
9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate *
14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate *
20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate */
22*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */
24*7c478bd9Sstevel@tonic-gate
25*7c478bd9Sstevel@tonic-gate
26*7c478bd9Sstevel@tonic-gate #ident "%Z%%M% %I% %E% SMI" /* from SVR4 bnu:security.c 1.3 */
27*7c478bd9Sstevel@tonic-gate /*
28*7c478bd9Sstevel@tonic-gate */
29*7c478bd9Sstevel@tonic-gate
30*7c478bd9Sstevel@tonic-gate #include "uucp.h"
31*7c478bd9Sstevel@tonic-gate #include "log.h"
32*7c478bd9Sstevel@tonic-gate
33*7c478bd9Sstevel@tonic-gate extern int guinfo();
34*7c478bd9Sstevel@tonic-gate
35*7c478bd9Sstevel@tonic-gate /*
36*7c478bd9Sstevel@tonic-gate * SYMBOL DEFINITIONS
37*7c478bd9Sstevel@tonic-gate */
38*7c478bd9Sstevel@tonic-gate
39*7c478bd9Sstevel@tonic-gate #define FS ' ' /* Field seperator for output records. */
40*7c478bd9Sstevel@tonic-gate #define LOGCHECK { if (Collecting == FALSE) return; }
41*7c478bd9Sstevel@tonic-gate #define LOGCHECKC { if (Collecting == FALSE) return(NOTAVAIL); }
42*7c478bd9Sstevel@tonic-gate
43*7c478bd9Sstevel@tonic-gate /*
44*7c478bd9Sstevel@tonic-gate * STRUCTURE DEFINITIONS
45*7c478bd9Sstevel@tonic-gate */
46*7c478bd9Sstevel@tonic-gate
47*7c478bd9Sstevel@tonic-gate struct secXfer /* Data for construction of security record. */
48*7c478bd9Sstevel@tonic-gate {
49*7c478bd9Sstevel@tonic-gate char reqSystem[MODSTR]; /* requester system name */
50*7c478bd9Sstevel@tonic-gate char reqUser[MODSTR]; /* requester login name */
51*7c478bd9Sstevel@tonic-gate char desSystem[MODSTR]; /* destination system name */
52*7c478bd9Sstevel@tonic-gate char desUser[MODSTR]; /* destination login name */
53*7c478bd9Sstevel@tonic-gate char desFile[MODSTR]; /* destination file name */
54*7c478bd9Sstevel@tonic-gate char srcSystem[MODSTR]; /* source system name */
55*7c478bd9Sstevel@tonic-gate char srcOwner[MODSTR]; /* source file owner */
56*7c478bd9Sstevel@tonic-gate char srcFile[MODSTR]; /* source file name */
57*7c478bd9Sstevel@tonic-gate char srcSize[MODSTR];/* source file size in Bytes .*/
58*7c478bd9Sstevel@tonic-gate char srcMtime[MODSTR]; /* modification date and time of
59*7c478bd9Sstevel@tonic-gate source file */
60*7c478bd9Sstevel@tonic-gate char stime[MODSTR]; /* date and time that transfer
61*7c478bd9Sstevel@tonic-gate started */
62*7c478bd9Sstevel@tonic-gate char etime[MODSTR]; /* date and time that transfer
63*7c478bd9Sstevel@tonic-gate completed */
64*7c478bd9Sstevel@tonic-gate };
65*7c478bd9Sstevel@tonic-gate
66*7c478bd9Sstevel@tonic-gate struct secRexe /* Data for construction of security record. */
67*7c478bd9Sstevel@tonic-gate {
68*7c478bd9Sstevel@tonic-gate char cliSystem[MODSTR]; /* client system name */
69*7c478bd9Sstevel@tonic-gate char cliUser[MODSTR]; /* client login name */
70*7c478bd9Sstevel@tonic-gate char serUser[MODSTR]; /* server login name */
71*7c478bd9Sstevel@tonic-gate char time[MODSTR]; /* date and time that command was
72*7c478bd9Sstevel@tonic-gate issued*/
73*7c478bd9Sstevel@tonic-gate char command[BUFSIZ]; /* command name and options */
74*7c478bd9Sstevel@tonic-gate };
75*7c478bd9Sstevel@tonic-gate /*
76*7c478bd9Sstevel@tonic-gate * LOCAL DATA
77*7c478bd9Sstevel@tonic-gate */
78*7c478bd9Sstevel@tonic-gate
79*7c478bd9Sstevel@tonic-gate static int Collecting = TRUE; /* ok to collect security inf.*/
80*7c478bd9Sstevel@tonic-gate static int LogFile = CLOSED; /* Log file file destriptor. */
81*7c478bd9Sstevel@tonic-gate static char LogName[] = SECURITY; /* Name of our log file. */
82*7c478bd9Sstevel@tonic-gate static char Record[LOGSIZE]; /* Place to build log records. */
83*7c478bd9Sstevel@tonic-gate static char Type[MODSTR]; /* record type */
84*7c478bd9Sstevel@tonic-gate
85*7c478bd9Sstevel@tonic-gate static struct secXfer Xfer; /* security transfer data. */
86*7c478bd9Sstevel@tonic-gate static struct secRexe Rexe; /* security remote execution data. */
87*7c478bd9Sstevel@tonic-gate
88*7c478bd9Sstevel@tonic-gate /*
89*7c478bd9Sstevel@tonic-gate * LOCAL FUNCTIONS
90*7c478bd9Sstevel@tonic-gate */
91*7c478bd9Sstevel@tonic-gate
92*7c478bd9Sstevel@tonic-gate
93*7c478bd9Sstevel@tonic-gate /*
94*7c478bd9Sstevel@tonic-gate * Local Function: newRec - Initialize new record
95*7c478bd9Sstevel@tonic-gate */
96*7c478bd9Sstevel@tonic-gate
97*7c478bd9Sstevel@tonic-gate STATIC_FUNC void
newRec(type)98*7c478bd9Sstevel@tonic-gate newRec(type)
99*7c478bd9Sstevel@tonic-gate char * type;
100*7c478bd9Sstevel@tonic-gate {
101*7c478bd9Sstevel@tonic-gate register struct secXfer * scptr = &Xfer;
102*7c478bd9Sstevel@tonic-gate register struct secRexe * reptr = &Rexe;
103*7c478bd9Sstevel@tonic-gate
104*7c478bd9Sstevel@tonic-gate if EQUALS(type,"xfer"){
105*7c478bd9Sstevel@tonic-gate copyText(scptr->reqUser, sizeof(scptr->reqUser), NOTAVAIL);
106*7c478bd9Sstevel@tonic-gate copyText(scptr->desSystem, sizeof(scptr->desSystem), NOTAVAIL);
107*7c478bd9Sstevel@tonic-gate copyText(scptr->desUser, sizeof(scptr->desUser), NOTAVAIL);
108*7c478bd9Sstevel@tonic-gate copyText(scptr->desFile, sizeof(scptr->desFile), NOTAVAIL);
109*7c478bd9Sstevel@tonic-gate copyText(scptr->srcSystem, sizeof(scptr->srcSystem), NOTAVAIL);
110*7c478bd9Sstevel@tonic-gate copyText(scptr->srcOwner, sizeof(scptr->srcOwner), NOTAVAIL);
111*7c478bd9Sstevel@tonic-gate copyText(scptr->srcFile, sizeof(scptr->srcFile), NOTAVAIL);
112*7c478bd9Sstevel@tonic-gate copyText(scptr->srcMtime, sizeof(scptr->srcMtime), NOTAVAIL);
113*7c478bd9Sstevel@tonic-gate copyText(scptr->stime, sizeof(scptr->stime), NOTAVAIL);
114*7c478bd9Sstevel@tonic-gate copyText(scptr->etime, sizeof(scptr->etime), NOTAVAIL);
115*7c478bd9Sstevel@tonic-gate }
116*7c478bd9Sstevel@tonic-gate else {
117*7c478bd9Sstevel@tonic-gate copyText(reptr->cliSystem, sizeof(reptr->cliSystem), NOTAVAIL);
118*7c478bd9Sstevel@tonic-gate copyText(reptr->cliUser, sizeof(reptr->cliUser), NOTAVAIL);
119*7c478bd9Sstevel@tonic-gate copyText(reptr->serUser, sizeof(reptr->serUser), NOTAVAIL);
120*7c478bd9Sstevel@tonic-gate copyText(reptr->time, sizeof(reptr->time), NOTAVAIL);
121*7c478bd9Sstevel@tonic-gate copyText(reptr->command, sizeof(reptr->command), NOTAVAIL);
122*7c478bd9Sstevel@tonic-gate }
123*7c478bd9Sstevel@tonic-gate return;
124*7c478bd9Sstevel@tonic-gate }
125*7c478bd9Sstevel@tonic-gate
126*7c478bd9Sstevel@tonic-gate /*
127*7c478bd9Sstevel@tonic-gate * EXTERNAL FUNCTIONS
128*7c478bd9Sstevel@tonic-gate */
129*7c478bd9Sstevel@tonic-gate
130*7c478bd9Sstevel@tonic-gate
131*7c478bd9Sstevel@tonic-gate /*
132*7c478bd9Sstevel@tonic-gate * Function: scInit - Initialize Security Package
133*7c478bd9Sstevel@tonic-gate *
134*7c478bd9Sstevel@tonic-gate * This function allows the security package to initialize its internal
135*7c478bd9Sstevel@tonic-gate * data structures. It should be called when uucico starts running on master
136*7c478bd9Sstevel@tonic-gate * or slave, or uuxqt is invoked.
137*7c478bd9Sstevel@tonic-gate *
138*7c478bd9Sstevel@tonic-gate * Parameters:
139*7c478bd9Sstevel@tonic-gate *
140*7c478bd9Sstevel@tonic-gate * type: file transfer or remote exec.
141*7c478bd9Sstevel@tonic-gate */
142*7c478bd9Sstevel@tonic-gate
143*7c478bd9Sstevel@tonic-gate void
scInit(type)144*7c478bd9Sstevel@tonic-gate scInit (type)
145*7c478bd9Sstevel@tonic-gate char * type;
146*7c478bd9Sstevel@tonic-gate
147*7c478bd9Sstevel@tonic-gate {
148*7c478bd9Sstevel@tonic-gate
149*7c478bd9Sstevel@tonic-gate if (LogFile == CLOSED) {
150*7c478bd9Sstevel@tonic-gate errno = 0;
151*7c478bd9Sstevel@tonic-gate LogFile = open(LogName, O_WRONLY | O_APPEND);
152*7c478bd9Sstevel@tonic-gate if (errno == ENOENT) {
153*7c478bd9Sstevel@tonic-gate LogFile = creat(LogName, LOGFILEMODE);
154*7c478bd9Sstevel@tonic-gate (void) chmod(LogName, LOGFILEMODE);
155*7c478bd9Sstevel@tonic-gate }
156*7c478bd9Sstevel@tonic-gate if (LogFile < 0){
157*7c478bd9Sstevel@tonic-gate Collecting = FALSE;
158*7c478bd9Sstevel@tonic-gate return;
159*7c478bd9Sstevel@tonic-gate }
160*7c478bd9Sstevel@tonic-gate }
161*7c478bd9Sstevel@tonic-gate copyText(Type, sizeof(Type), type);
162*7c478bd9Sstevel@tonic-gate newRec(Type);
163*7c478bd9Sstevel@tonic-gate return;
164*7c478bd9Sstevel@tonic-gate }
165*7c478bd9Sstevel@tonic-gate
166*7c478bd9Sstevel@tonic-gate /*
167*7c478bd9Sstevel@tonic-gate * Function: scWrite - write an entry to the log
168*7c478bd9Sstevel@tonic-gate * initialize the next entry
169*7c478bd9Sstevel@tonic-gate */
170*7c478bd9Sstevel@tonic-gate
171*7c478bd9Sstevel@tonic-gate void
scWrite()172*7c478bd9Sstevel@tonic-gate scWrite()
173*7c478bd9Sstevel@tonic-gate
174*7c478bd9Sstevel@tonic-gate {
175*7c478bd9Sstevel@tonic-gate static char format[] = "%s%c%s%c%s%c%s%c%s%c%s%c%s%c%s%c%s%c%s%c(%s)%c(%s)%c(%s)";
176*7c478bd9Sstevel@tonic-gate
177*7c478bd9Sstevel@tonic-gate register struct secXfer * scptr;
178*7c478bd9Sstevel@tonic-gate
179*7c478bd9Sstevel@tonic-gate LOGCHECK;
180*7c478bd9Sstevel@tonic-gate scptr = &Xfer; /* Point to security transfer data. */
181*7c478bd9Sstevel@tonic-gate sprintf(Record, format,
182*7c478bd9Sstevel@tonic-gate Type, FS,
183*7c478bd9Sstevel@tonic-gate scptr->reqSystem, FS,
184*7c478bd9Sstevel@tonic-gate scptr->reqUser, FS,
185*7c478bd9Sstevel@tonic-gate scptr->desSystem, FS,
186*7c478bd9Sstevel@tonic-gate scptr->desUser, FS,
187*7c478bd9Sstevel@tonic-gate scptr->desFile, FS,
188*7c478bd9Sstevel@tonic-gate scptr->srcSystem, FS,
189*7c478bd9Sstevel@tonic-gate scptr->srcOwner, FS,
190*7c478bd9Sstevel@tonic-gate scptr->srcFile, FS,
191*7c478bd9Sstevel@tonic-gate scptr->srcSize, FS,
192*7c478bd9Sstevel@tonic-gate scptr->srcMtime, FS,
193*7c478bd9Sstevel@tonic-gate scptr->stime, FS,
194*7c478bd9Sstevel@tonic-gate scptr->etime
195*7c478bd9Sstevel@tonic-gate );
196*7c478bd9Sstevel@tonic-gate
197*7c478bd9Sstevel@tonic-gate /* Terminate the record and write it out. */
198*7c478bd9Sstevel@tonic-gate
199*7c478bd9Sstevel@tonic-gate (void) strcat(Record, EOR);
200*7c478bd9Sstevel@tonic-gate writeLog(Record,&LogFile,LogName,&Collecting);
201*7c478bd9Sstevel@tonic-gate newRec(Type);
202*7c478bd9Sstevel@tonic-gate return;
203*7c478bd9Sstevel@tonic-gate }
204*7c478bd9Sstevel@tonic-gate
205*7c478bd9Sstevel@tonic-gate /*
206*7c478bd9Sstevel@tonic-gate * Function: scReqsys - log requestor system name
207*7c478bd9Sstevel@tonic-gate *
208*7c478bd9Sstevel@tonic-gate * Parameters:
209*7c478bd9Sstevel@tonic-gate * reqsys: master machine name
210*7c478bd9Sstevel@tonic-gate */
211*7c478bd9Sstevel@tonic-gate
212*7c478bd9Sstevel@tonic-gate void
scReqsys(reqsys)213*7c478bd9Sstevel@tonic-gate scReqsys(reqsys)
214*7c478bd9Sstevel@tonic-gate char * reqsys;
215*7c478bd9Sstevel@tonic-gate
216*7c478bd9Sstevel@tonic-gate {
217*7c478bd9Sstevel@tonic-gate register struct secXfer * scptr = &Xfer;
218*7c478bd9Sstevel@tonic-gate
219*7c478bd9Sstevel@tonic-gate LOGCHECK;
220*7c478bd9Sstevel@tonic-gate copyText(scptr->reqSystem, sizeof(scptr->reqSystem), reqsys);
221*7c478bd9Sstevel@tonic-gate return;
222*7c478bd9Sstevel@tonic-gate }
223*7c478bd9Sstevel@tonic-gate
224*7c478bd9Sstevel@tonic-gate /*
225*7c478bd9Sstevel@tonic-gate * Function: scRequser - log requestor user name
226*7c478bd9Sstevel@tonic-gate *
227*7c478bd9Sstevel@tonic-gate * Parameters:
228*7c478bd9Sstevel@tonic-gate * requser: one who issued the command
229*7c478bd9Sstevel@tonic-gate */
230*7c478bd9Sstevel@tonic-gate
231*7c478bd9Sstevel@tonic-gate void
scRequser(requser)232*7c478bd9Sstevel@tonic-gate scRequser(requser)
233*7c478bd9Sstevel@tonic-gate char * requser;
234*7c478bd9Sstevel@tonic-gate
235*7c478bd9Sstevel@tonic-gate {
236*7c478bd9Sstevel@tonic-gate register struct secXfer * scptr = &Xfer;
237*7c478bd9Sstevel@tonic-gate
238*7c478bd9Sstevel@tonic-gate LOGCHECK;
239*7c478bd9Sstevel@tonic-gate copyText(scptr->reqUser, sizeof(scptr->reqUser), requser);
240*7c478bd9Sstevel@tonic-gate return;
241*7c478bd9Sstevel@tonic-gate }
242*7c478bd9Sstevel@tonic-gate
243*7c478bd9Sstevel@tonic-gate /*
244*7c478bd9Sstevel@tonic-gate * Function: scStime - log start transfer time
245*7c478bd9Sstevel@tonic-gate *
246*7c478bd9Sstevel@tonic-gate */
247*7c478bd9Sstevel@tonic-gate
248*7c478bd9Sstevel@tonic-gate void
scStime()249*7c478bd9Sstevel@tonic-gate scStime()
250*7c478bd9Sstevel@tonic-gate
251*7c478bd9Sstevel@tonic-gate {
252*7c478bd9Sstevel@tonic-gate register struct secXfer * scptr = &Xfer;
253*7c478bd9Sstevel@tonic-gate
254*7c478bd9Sstevel@tonic-gate LOGCHECK;
255*7c478bd9Sstevel@tonic-gate copyText(scptr->stime, sizeof(scptr->stime), timeStamp());
256*7c478bd9Sstevel@tonic-gate return;
257*7c478bd9Sstevel@tonic-gate }
258*7c478bd9Sstevel@tonic-gate
259*7c478bd9Sstevel@tonic-gate /*
260*7c478bd9Sstevel@tonic-gate * Function: scEtime - log end transfer time
261*7c478bd9Sstevel@tonic-gate *
262*7c478bd9Sstevel@tonic-gate */
263*7c478bd9Sstevel@tonic-gate
264*7c478bd9Sstevel@tonic-gate void
scEtime()265*7c478bd9Sstevel@tonic-gate scEtime()
266*7c478bd9Sstevel@tonic-gate
267*7c478bd9Sstevel@tonic-gate {
268*7c478bd9Sstevel@tonic-gate register struct secXfer * scptr = &Xfer;
269*7c478bd9Sstevel@tonic-gate
270*7c478bd9Sstevel@tonic-gate LOGCHECK;
271*7c478bd9Sstevel@tonic-gate copyText(scptr->etime, sizeof(scptr->etime), timeStamp());
272*7c478bd9Sstevel@tonic-gate return;
273*7c478bd9Sstevel@tonic-gate }
274*7c478bd9Sstevel@tonic-gate
275*7c478bd9Sstevel@tonic-gate /*
276*7c478bd9Sstevel@tonic-gate * Function: scDest - log destination node, user and file name
277*7c478bd9Sstevel@tonic-gate *
278*7c478bd9Sstevel@tonic-gate * Parameters:
279*7c478bd9Sstevel@tonic-gate * destsys: system where the dest file is sent to
280*7c478bd9Sstevel@tonic-gate * destuser: user where the dest file is sent to
281*7c478bd9Sstevel@tonic-gate * destfile: name of the dest file
282*7c478bd9Sstevel@tonic-gate *
283*7c478bd9Sstevel@tonic-gate */
284*7c478bd9Sstevel@tonic-gate
285*7c478bd9Sstevel@tonic-gate void
scDest(destsys,destuser,destfile)286*7c478bd9Sstevel@tonic-gate scDest(destsys, destuser, destfile)
287*7c478bd9Sstevel@tonic-gate char * destsys;
288*7c478bd9Sstevel@tonic-gate char * destuser;
289*7c478bd9Sstevel@tonic-gate char * destfile;
290*7c478bd9Sstevel@tonic-gate
291*7c478bd9Sstevel@tonic-gate {
292*7c478bd9Sstevel@tonic-gate register struct secXfer * scptr = &Xfer;
293*7c478bd9Sstevel@tonic-gate
294*7c478bd9Sstevel@tonic-gate LOGCHECK;
295*7c478bd9Sstevel@tonic-gate copyText(scptr->desSystem, sizeof(scptr->desSystem), destsys);
296*7c478bd9Sstevel@tonic-gate copyText(scptr->desUser, sizeof(scptr->desUser), destuser);
297*7c478bd9Sstevel@tonic-gate copyText(scptr->desFile, sizeof(scptr->desFile), destfile);
298*7c478bd9Sstevel@tonic-gate return;
299*7c478bd9Sstevel@tonic-gate }
300*7c478bd9Sstevel@tonic-gate
301*7c478bd9Sstevel@tonic-gate /*
302*7c478bd9Sstevel@tonic-gate * Function: scSrc - log source node, file owner, file name
303*7c478bd9Sstevel@tonic-gate * modification time and size
304*7c478bd9Sstevel@tonic-gate *
305*7c478bd9Sstevel@tonic-gate * Parameters:
306*7c478bd9Sstevel@tonic-gate * srcsys: system where the source file is recieved from
307*7c478bd9Sstevel@tonic-gate * srcowner: owner of the source file
308*7c478bd9Sstevel@tonic-gate * srcfile: name of the source file
309*7c478bd9Sstevel@tonic-gate * srcmtime: modification date and time of source file
310*7c478bd9Sstevel@tonic-gate * srcsize: size of the source file
311*7c478bd9Sstevel@tonic-gate *
312*7c478bd9Sstevel@tonic-gate */
313*7c478bd9Sstevel@tonic-gate
314*7c478bd9Sstevel@tonic-gate void
scSrc(srcsys,srcowner,srcfile,srcmtime,srcsize)315*7c478bd9Sstevel@tonic-gate scSrc(srcsys, srcowner, srcfile, srcmtime, srcsize)
316*7c478bd9Sstevel@tonic-gate char * srcsys;
317*7c478bd9Sstevel@tonic-gate char * srcowner;
318*7c478bd9Sstevel@tonic-gate char * srcfile;
319*7c478bd9Sstevel@tonic-gate char * srcmtime;
320*7c478bd9Sstevel@tonic-gate char * srcsize;
321*7c478bd9Sstevel@tonic-gate
322*7c478bd9Sstevel@tonic-gate {
323*7c478bd9Sstevel@tonic-gate register struct secXfer * scptr = &Xfer;
324*7c478bd9Sstevel@tonic-gate
325*7c478bd9Sstevel@tonic-gate LOGCHECK;
326*7c478bd9Sstevel@tonic-gate copyText(scptr->srcSystem, sizeof(scptr->srcSystem), srcsys);
327*7c478bd9Sstevel@tonic-gate copyText(scptr->srcOwner, sizeof(scptr->srcOwner), srcowner );
328*7c478bd9Sstevel@tonic-gate copyText(scptr->srcFile, sizeof(scptr->srcFile), srcfile);
329*7c478bd9Sstevel@tonic-gate copyText(scptr->srcMtime, sizeof(scptr->srcMtime), srcmtime );
330*7c478bd9Sstevel@tonic-gate copyText(scptr->srcSize, sizeof(scptr->srcSize), srcsize);
331*7c478bd9Sstevel@tonic-gate return;
332*7c478bd9Sstevel@tonic-gate }
333*7c478bd9Sstevel@tonic-gate
334*7c478bd9Sstevel@tonic-gate /*
335*7c478bd9Sstevel@tonic-gate * Function: scSize - get size of source file
336*7c478bd9Sstevel@tonic-gate *
337*7c478bd9Sstevel@tonic-gate * parameter srcfile: name of the source file
338*7c478bd9Sstevel@tonic-gate *
339*7c478bd9Sstevel@tonic-gate */
340*7c478bd9Sstevel@tonic-gate
341*7c478bd9Sstevel@tonic-gate char *
scSize(srcfile)342*7c478bd9Sstevel@tonic-gate scSize(srcfile)
343*7c478bd9Sstevel@tonic-gate char * srcfile;
344*7c478bd9Sstevel@tonic-gate
345*7c478bd9Sstevel@tonic-gate {
346*7c478bd9Sstevel@tonic-gate struct stat stbuf;
347*7c478bd9Sstevel@tonic-gate static char size[MODSTR];
348*7c478bd9Sstevel@tonic-gate
349*7c478bd9Sstevel@tonic-gate LOGCHECKC;
350*7c478bd9Sstevel@tonic-gate if (stat(srcfile, &stbuf))
351*7c478bd9Sstevel@tonic-gate return(NOTAVAIL);/* fail, set it "" */
352*7c478bd9Sstevel@tonic-gate sprintf(size,"%ld",stbuf.st_size);
353*7c478bd9Sstevel@tonic-gate return(size);
354*7c478bd9Sstevel@tonic-gate }
355*7c478bd9Sstevel@tonic-gate
356*7c478bd9Sstevel@tonic-gate /*
357*7c478bd9Sstevel@tonic-gate * Function: scOwn - get owner of source file
358*7c478bd9Sstevel@tonic-gate *
359*7c478bd9Sstevel@tonic-gate * parameter srcfile: name of the source file
360*7c478bd9Sstevel@tonic-gate *
361*7c478bd9Sstevel@tonic-gate */
362*7c478bd9Sstevel@tonic-gate
363*7c478bd9Sstevel@tonic-gate char *
scOwn(srcfile)364*7c478bd9Sstevel@tonic-gate scOwn(srcfile)
365*7c478bd9Sstevel@tonic-gate char * srcfile;
366*7c478bd9Sstevel@tonic-gate
367*7c478bd9Sstevel@tonic-gate {
368*7c478bd9Sstevel@tonic-gate struct stat stbuf;
369*7c478bd9Sstevel@tonic-gate static char user[MODSTR];
370*7c478bd9Sstevel@tonic-gate
371*7c478bd9Sstevel@tonic-gate LOGCHECKC;
372*7c478bd9Sstevel@tonic-gate if (stat(srcfile, &stbuf))
373*7c478bd9Sstevel@tonic-gate return(NOTAVAIL);
374*7c478bd9Sstevel@tonic-gate (void) guinfo(stbuf.st_uid,user);
375*7c478bd9Sstevel@tonic-gate return(user);
376*7c478bd9Sstevel@tonic-gate }
377*7c478bd9Sstevel@tonic-gate
378*7c478bd9Sstevel@tonic-gate /*
379*7c478bd9Sstevel@tonic-gate * Function: scMtime - get modification date and time of source file
380*7c478bd9Sstevel@tonic-gate *
381*7c478bd9Sstevel@tonic-gate * parameter srcfile: name of the source file
382*7c478bd9Sstevel@tonic-gate *
383*7c478bd9Sstevel@tonic-gate */
384*7c478bd9Sstevel@tonic-gate
385*7c478bd9Sstevel@tonic-gate char *
scMtime(srcfile)386*7c478bd9Sstevel@tonic-gate scMtime(srcfile)
387*7c478bd9Sstevel@tonic-gate char * srcfile;
388*7c478bd9Sstevel@tonic-gate
389*7c478bd9Sstevel@tonic-gate {
390*7c478bd9Sstevel@tonic-gate struct stat stbuf;
391*7c478bd9Sstevel@tonic-gate static char mtime[MODSTR];
392*7c478bd9Sstevel@tonic-gate register struct tm *tp;
393*7c478bd9Sstevel@tonic-gate
394*7c478bd9Sstevel@tonic-gate LOGCHECKC;
395*7c478bd9Sstevel@tonic-gate if (stat(srcfile, &stbuf))
396*7c478bd9Sstevel@tonic-gate return(NOTAVAIL);
397*7c478bd9Sstevel@tonic-gate tp = localtime(&stbuf.st_mtime);
398*7c478bd9Sstevel@tonic-gate (void) sprintf(mtime, "%d/%d-%d:%2.2d", tp->tm_mon + 1,
399*7c478bd9Sstevel@tonic-gate tp->tm_mday, tp->tm_hour, tp->tm_min);
400*7c478bd9Sstevel@tonic-gate return(mtime);
401*7c478bd9Sstevel@tonic-gate }
402*7c478bd9Sstevel@tonic-gate
403*7c478bd9Sstevel@tonic-gate /*
404*7c478bd9Sstevel@tonic-gate * Function - scRexe: It is called when uuxqt is running
405*7c478bd9Sstevel@tonic-gate *
406*7c478bd9Sstevel@tonic-gate * Parameter:
407*7c478bd9Sstevel@tonic-gate * clientsys - Client node name.
408*7c478bd9Sstevel@tonic-gate * clientusr - Client user ID.
409*7c478bd9Sstevel@tonic-gate * serverusr - Server user ID.
410*7c478bd9Sstevel@tonic-gate * cmd - command to be execed by uuxqt
411*7c478bd9Sstevel@tonic-gate */
412*7c478bd9Sstevel@tonic-gate
413*7c478bd9Sstevel@tonic-gate void
scRexe(clientsys,clientusr,serverusr,cmd)414*7c478bd9Sstevel@tonic-gate scRexe(clientsys,clientusr,serverusr,cmd)
415*7c478bd9Sstevel@tonic-gate char * clientsys;
416*7c478bd9Sstevel@tonic-gate char * clientusr;
417*7c478bd9Sstevel@tonic-gate char * serverusr;
418*7c478bd9Sstevel@tonic-gate char * cmd;
419*7c478bd9Sstevel@tonic-gate {
420*7c478bd9Sstevel@tonic-gate register struct secRexe * scptr = &Rexe;
421*7c478bd9Sstevel@tonic-gate
422*7c478bd9Sstevel@tonic-gate
423*7c478bd9Sstevel@tonic-gate LOGCHECK;
424*7c478bd9Sstevel@tonic-gate copyText(scptr->cliSystem, sizeof(scptr->cliSystem), clientsys);
425*7c478bd9Sstevel@tonic-gate copyText(scptr->cliUser, sizeof(scptr->cliUser), clientusr);
426*7c478bd9Sstevel@tonic-gate copyText(scptr->serUser, sizeof(scptr->serUser), serverusr);
427*7c478bd9Sstevel@tonic-gate copyText(scptr->time, sizeof(scptr->time), timeStamp());
428*7c478bd9Sstevel@tonic-gate copyText(scptr->command, sizeof(scptr->command), cmd);
429*7c478bd9Sstevel@tonic-gate return;
430*7c478bd9Sstevel@tonic-gate }
431*7c478bd9Sstevel@tonic-gate
432*7c478bd9Sstevel@tonic-gate /*
433*7c478bd9Sstevel@tonic-gate * Function - scWlog: It is called when the violation is occurred
434*7c478bd9Sstevel@tonic-gate *
435*7c478bd9Sstevel@tonic-gate */
436*7c478bd9Sstevel@tonic-gate
437*7c478bd9Sstevel@tonic-gate void
scWlog()438*7c478bd9Sstevel@tonic-gate scWlog()
439*7c478bd9Sstevel@tonic-gate {
440*7c478bd9Sstevel@tonic-gate static char format[] = "%s%c%s%c%s%c%s%c(%s)%c%s";
441*7c478bd9Sstevel@tonic-gate
442*7c478bd9Sstevel@tonic-gate register struct secRexe * scptr;
443*7c478bd9Sstevel@tonic-gate
444*7c478bd9Sstevel@tonic-gate LOGCHECK;
445*7c478bd9Sstevel@tonic-gate scptr = &Rexe; /* Point to security remote exec data. */
446*7c478bd9Sstevel@tonic-gate sprintf(Record, format,
447*7c478bd9Sstevel@tonic-gate Type, FS,
448*7c478bd9Sstevel@tonic-gate scptr->cliSystem, FS,
449*7c478bd9Sstevel@tonic-gate scptr->cliUser, FS,
450*7c478bd9Sstevel@tonic-gate scptr->serUser, FS,
451*7c478bd9Sstevel@tonic-gate scptr->time, FS,
452*7c478bd9Sstevel@tonic-gate scptr->command
453*7c478bd9Sstevel@tonic-gate );
454*7c478bd9Sstevel@tonic-gate
455*7c478bd9Sstevel@tonic-gate /* Terminate the record and write it out. */
456*7c478bd9Sstevel@tonic-gate
457*7c478bd9Sstevel@tonic-gate (void) strcat(Record, EOR);
458*7c478bd9Sstevel@tonic-gate writeLog(Record,&LogFile,LogName,&Collecting);
459*7c478bd9Sstevel@tonic-gate newRec(Type);
460*7c478bd9Sstevel@tonic-gate return;
461*7c478bd9Sstevel@tonic-gate }
462