📄 classroom.exp
字号:
# $Id: classroom.exp,v 1.3 2006/09/23 09:27:59 peterc Exp $# Copyright (C) 2003 Tarantella, Inc.## Source file for implementing shadowing of a single session# by multiple read only sessions#source xauth.expproc encode {value} { regsub -all {%} $value "%25" value regsub -all {&} $value "%26" value regsub -all {\+} $value "%2b" value regsub -all { } $value "+" value regsub -all {=} $value "%3d" value regsub -all {#} $value "%23" value regsub -all {/} $value "%2f" value regsub -all {\[} $value "%5b" value regsub -all {\]} $value "%5d" value regsub -all {\(} $value "%28" value regsub -all {\)} $value "%29" value regsub -all {\{} $value "%7b" value regsub -all {\}} $value "%7d" value return $value}proc getClasses {} { global env a_display a_cookie if { ! [info exists env(TTABASEDATADIR) ] } { set env(TTABASEDATADIR) $env(TTADATADIR) } if [file readable $env(TTABASEDATADIR)/classrooms ] { source $env(TTABASEDATADIR)/classrooms }}proc setClassroomShadowProperty { mydisplay mycookie } { global spawn_id user_spawn_id num_xauthcmds xauthcmds env set i 0 while { $i < $num_xauthcmds } { if { [ file readable [lindex $xauthcmds $i] ] } { break } else { incr i } } if { $i >= $num_xauthcmds } { send_log "$errorStrings(xauth_not_found)" return } # We need to give root permissions somehow if {[catch { exec [lindex $xauthcmds $i] -i add $mydisplay . $mycookie } myErr] } { send_log "Failed to add root authorisation: $myErr\n" } if {[catch { exec $env(TTAINSTDIR)/bin/bin/ttaxnotify -display $mydisplay -set "TTA_SHADOW_CLASSROOM" -value "You are allowed to shadow this session." } myErr] } { send_log "Failed to set property: $myErr\n" }}proc setXDisplayForClass { xdisplay xcookie } { global env a_display a_cookie getClasses set myclass [encode $env(TTA_ApplicationName)] set a_display($myclass) $xdisplay set a_cookie($myclass) $xcookie set myfile [open $env(TTABASEDATADIR)/classrooms w] foreach value [array names a_display] { puts $myfile "set myvar $value" puts $myfile "set a_display(\$myvar) \"$a_display($value)\"\n" } foreach value [array names a_cookie] { puts $myfile "set myvar $value" puts $myfile "set a_cookie(\$myvar) \"$a_cookie($value)\"\n" } close $myfile setClassroomShadowProperty $xdisplay $xcookie}proc getXDisplayForClass { myclass } { global a_display exitCode if { ! [info exists a_display ] } { getClasses } set c [encode $myclass] if {[ info exists a_display($c) ]} { return $a_display($c) } else { send_error "Classroom session $myclass does not exist.\n" exit $exitCode(ErrSessionDoesNotExist); }}proc getXCookieForClass { myclass } { global a_cookie exitCode if { ! [info exists a_cookie ] } { getClasses } set c [encode $myclass] if {[ info exists a_cookie($c) ]} { return $a_cookie($c) } else { send_error "Classroom session $myclass does not exist." exit $exitCode(ErrSessionDoesNotExist); }}proc runxauthforshadow { shadowdisplay shadowcookie xauthcmd } { global env prompts xauthcmds num_xauthcmds locallaunchflag \ errorStrings if { [string length $shadowcookie] <= 0 } { return } if { [string length $xauthcmd] <= 0 } { return } # Unset XAUTHORITY env var on local su launches, as pam on RedHat 7.x # sets it to a temporary $HOME/.xauthXXXXXX file. if { $locallaunchflag == 1 } { send -s "unset XAUTHORITY\n" } setXAuthCookie $xauthcmd $shadowdisplay $shadowcookie wait_for_prompt}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -