nsh -c "comand to be executed"
This pseudo-shell is executed over the network
as the login shell of an acount "network", no passwd.
It will only execute certain allowed commands.
8 = wrong # arguments to nsh
9 = command you execute may not take arguments
11= could not find full path name for the command
count is the # of arguments (= argc) allowed.
a count of 0 turns off the command
"bpq", 20, "/usr/bin/bpq", "/bin/bpq",
"epq", 20, "/usr/bin/epq", "/bin/epq",
"finger", 20, "/usr/ucb/finger", "/usr/bin/finger",
"lpq", 20, "/usr/bin/lpq", "/bin/lpq",
"lpr", 20, "/usr/bin/lpr", "/bin/lpr",
"mmail", 20, "/usr/net/bin/mmail", "/usr/net/bin/mmail",
"mwrite", 20, "/usr/net/bin/mwrite", "/usr/net/bin/mwrite",
"netlog", 20, "/usr/bin/netlog", "/usr/ucb/netlog",
"netq", 20, "/usr/bin/netq", "/usr/ucb/netq",
"prmail", 20, "/usr/net/bin/prmail", "/usr/net/bin/prmail",
"ps", 20, "/bin/ps", "/usr/bin/ps",
"pstat", 20, "/usr/bin/pstat", "/bin/pstat",
"rcs", 20, "/usr/bin/rcs", "/bin/rcs",
"rcslog", 1, "/usr/bin/rcslog", "/bin/rcslog",
"rcsq", 20, "/usr/bin/rcsq", "/bin/rcsq",
"trq", 20, "/usr/bin/trq", "/bin/trq",
"w", 20, "/usr/bin/w", "/usr/ucb/w",
"where", 20, "/usr/bin/where", "/bin/where",
"who", 20, "/bin/who", "/usr/bin/who",
"whom", 20, "/usr/ucb/whom", "/usr/bin/whom",
"write", 20, "/usr/bin/write", "/bin/write",
"yank", 20, "/usr/ucb/yank", "/usr/bin/yank",
fprintf(stderr
,"Wrong number of arguments to nsh.\n");
while(*s
&& *s
!= ' ')s
++;
if((i
= mlookup(argv
[2])) < 0){
"Command '%s' is not allowed if logged in as 'network'.\n",
"The command '%s' is not allowed to have arguments.\n",argv
[2]);
if(stat(st
[i
].full
,buf
) >= 0)
else strcpy(buf
,st
[i
].full1
);
if(flg
&& st
[i
].count
> 1){ /* some cmds don't allow parms */
fprintf(stderr,"%s\n",buf);
execl(Bsh
,"sh","-c",buf
,0);
fprintf(stderr
,"Execute of shell failed.\n");
for(i
= 0; st
[i
].app
; i
++)
if(strcmp(st
[i
].app
,s
) == 0 || strcmp(st
[i
].full
,s
) == 0
|| strcmp(st
[i
].full1
,s
) == 0)return(i
);