/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1990-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* *18***********************************************************************/19#pragma prototyped20/*21* Glenn Fowler22* AT&T Bell Laboratories23*24* cs remote shell service25* no tty/pty but good enough for nt26* if its the only way in27*/2829static const char id[] = "@(#)$Id: cs.rsh (AT&T Bell Laboratories) 1995-10-13 $\0\n";3031#include <cs.h>32#include <proc.h>33#include <wait.h>3435static int36svc_connect(void* handle, int fd, Cs_id_t* id, int clone, char** argv)37{38Proc_t* p;39int n;40long ops[4];4142static char* args[] = { "sh", "-i", 0 };4344NoP(handle);45NoP(clone);46waitpid(-1, NiL, WNOHANG);47n = 0;48ops[n++] = PROC_FD_DUP(fd, 0, 0);49ops[n++] = PROC_FD_DUP(fd, 1, 0);50ops[n++] = PROC_FD_DUP(fd, 2, PROC_FD_CHILD);51ops[n] = 0;52if (!(p = procopen(NiL, args, NiL, ops, 0)))53return(-1);54procfree(p);55csfd(fd, CS_POLL_CLOSE);56return(0);57}5859int60main(int argc, char** argv)61{62NoP(argc);63csserve(NiL, argv[1], NiL, NiL, svc_connect, NiL, NiL, NiL);64exit(1);65}666768