nicedaemon
Steve Hubert
hubert at entropy.UUCP
Fri Dec 28 11:58:08 AEST 1984
on */
char *exempt[] = {
"csh",
"-csh",
"vi",
"ex",
"-u",
"ispsh",
X/* "rsh",
"rlogind", */
"sh",
"edit",
"ed",
"funplot",
"glim",
"emacs",
"tip",
"cu",
"readnews",
"BAD", /* If we couldn't read mem properly, don't nail him. */
0
};
X/* Return 1 if a privileged command, and 0 if not */
checkperm(cmd)
char *cmd;
{
register char *cp = cmd, **progs;
register char *cp2;
char schar;
/* Use only first word */
for (cp2 = cp; *cp2 && !isspace(*cp2); cp2++);
schar = *cp2;
*cp2 = NULL; /* Temporary end of string */
if ((cp = rindex(cmd,'/')) != NULL)
cp++;
else
cp = cmd;
for (progs = exempt; *progs; progs++)
if (!strncmp(*progs,cp,strlen(*progs))) {
*cp2 = schar;
return (1);
}
*cp2 = schar;
return (0);
}
#ifdef LOG
struct timeval t;
struct timezone tz;
logit(fmt, args)
char *fmt;
{
static long timekeeper=0;
char *date, *ctime();
gettimeofday(&t, &tz);
if (t.tv_sec - timekeeper > 3600) {
timekeeper = t.tv_sec;
date = ctime(&(t.tv_sec));
date[16] = '\0';
fprintf(llog, "%s\n", date);
}
_doprnt(fmt, &args, llog);
fflush(llog);
}
#endif
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
/bin/chmod 644 nicedaemon.c
/bin/echo -n ' '; /bin/ls -ld nicedaemon.c
fi
More information about the Comp.sources.unix
mailing list