Changeset 2748 for package_branches/invirt-web
- Timestamp:
- Dec 21, 2009, 1:10:18 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
package_branches/invirt-web/ajaxterm-rebased/code/ajaxterm.py
r2747 r2748 368 368 369 369 class Multiplex: 370 def __init__(self ,cmd=None):370 def __init__(self): 371 371 signal.signal(signal.SIGCHLD, signal.SIG_IGN) 372 self.cmd=cmd373 372 self.proc={} 374 373 self.lock=threading.RLock() … … 380 379 setattr(self,name,SynchronizedMethod(self.lock,orig)) 381 380 self.thread.start() 382 def create(self, w=80,h=25):381 def create(self,cmd,w=80,h=25): 383 382 pid,fd=pty.fork() 384 383 if pid==0: … … 392 391 except OSError: 393 392 pass 394 if self.cmd:395 cmd=['/bin/sh','-c',self.cmd]396 elif os.getuid()==0:397 cmd=['/bin/login']398 else:399 sys.stdout.write("Login: ")400 login=sys.stdin.readline().strip()401 if re.match('^[0-9A-Za-z-_. ]+$',login):402 cmd=['ssh']403 cmd+=['-oPreferredAuthentications=keyboard-interactive,password']404 cmd+=['-oNoHostAuthenticationForLocalhost=yes']405 cmd+=['-oLogLevel=FATAL']406 cmd+=['-F/dev/null','-l',login,'localhost']407 else:408 os._exit(0)409 393 env={} 410 394 env["COLUMNS"]=str(w)
Note: See TracChangeset
for help on using the changeset viewer.