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