#!/usr/local/bin/perl # edit_host.cgi # Display options for a new or existing host config require './sshd-lib.pl'; &ReadParse(); if ($in{'new'}) { &ui_print_header(undef, $text{'host_create'}, "", "chost"); } else { &ui_print_header(undef, $text{'host_edit'}, "", "ehost"); $hconf = &get_client_config(); $host = $hconf->[$in{'idx'}]; $conf = $host->{'members'}; } print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'host_header'}
\n"; &scmd(1); print "\n", $host->{'values'}->[0] eq '*' ? '' : $host->{'values'}->[0]; &ecmd(); &scmd(); $user = &find_value("User", $conf); print "\n"; &ecmd(); &scmd(); $keep = &find_value("KeepAlive", $conf); print "\n", !$keep ? "checked" : "", $text{'default'}; &ecmd(); &scmd(); $hostname = &find_value("HostName", $conf); print "\n"; &ecmd(); &scmd(); $batch = &find_value("BatchMode", $conf); print "\n", !$batch ? "checked" : "", $text{'default'}; &ecmd(); &scmd(); $port = &find_value("Port", $conf); print "\n"; &ecmd(); &scmd(); $comp = &find_value("Compression", $conf); print "\n", !$comp ? "checked" : "", $text{'default'}; &ecmd(); &scmd(); $escape = &find_value("EscapeChar", $conf); print "\n", $escape eq "" || $escape eq "none" ? "" : $escape; &ecmd(); if ($version{'type'} ne 'ssh' || $version{'number'} < 3) { &scmd(); $clevel = &find_value("CompressionLevel", $conf); print "\n"; &ecmd(); &scmd(); $attempts = &find_value("ConnectionAttempts", $conf); print "\n"; &ecmd(); &scmd(); $priv = &find_value("UsePrivilegedPort", $conf); print "\n", !$priv ? "checked" : "", $text{'default'}; &ecmd(); &scmd(); $rsh = &find_value("FallBackToRsh", $conf); print "\n", !$rsh ? "checked" : "", $text{'default'}; &ecmd(); &scmd(); $usersh = &find_value("UseRsh", $conf); print "\n", !$usersh ? "checked" : "", $text{'default'}; &ecmd(); } &scmd(); $agent = &find_value("ForwardAgent", $conf); print "\n", !$agent ? "checked" : "", $text{'default'}; &ecmd(); &scmd(); $x11 = &find_value("ForwardX11", $conf); print "\n", !$x11 ? "checked" : "", $text{'default'}; &ecmd(); &scmd(); $strict = &find_value("StrictHostKeyChecking", $conf); print "\n", !$strict ? "checked" : "", $text{'default'}; &ecmd(); if ($version{'type'} eq 'openssh') { &scmd(); $checkip = &find_value("CheckHostIP", $conf); print "\n", !$checkip ? "checked" : "", $text{'default'}; &ecmd(); &scmd(1); $prots = &find_value("Protocol", $conf); @prots = split(/,/, $prots); print "\n"; &ecmd(); } &scmd(1); print "\n"; &ecmd(); &scmd(1); print "\n"; print "\n"; &ecmd(); &scmd(1); print "\n"; &ecmd(); &scmd(1); print "\n"; print "\n"; &ecmd(); print "
$text{'host_name'} \n"; printf " %s\n", $host->{'values'}->[0] eq '*' ? 'checked' : '', $text{'hosts_all'}; printf "\n", $host->{'values'}->[0] eq '*' ? '' : 'checked'; printf "$text{'host_user'} \n"; printf " %s\n", $user ? "" : "checked", $text{'host_user_def'}; printf "\n", $user ? "checked" : ""; print "$text{'host_keep'} \n"; printf " %s\n", lc($keep) eq 'yes' ? "checked" : "", $text{'yes'}; printf " %s\n", lc($keep) eq 'no' ? "checked" : "", $text{'no'}; printf " %s$text{'host_hostname'} \n"; printf " %s\n", $hostname ? "" : "checked", $text{'host_hostname_def'}; printf "\n", $hostname ? "checked" : ""; print "$text{'host_batch'} \n"; printf " %s\n", lc($batch) eq 'no' ? "checked" : "", $text{'yes'}; printf " %s\n", lc($batch) eq 'yes' ? "checked" : "", $text{'no'}; printf " %s$text{'host_port'} \n"; printf " %s\n", $port ? "" : "checked", $text{'default'}; printf "\n", $port ? "checked" : ""; print "$text{'host_comp'} \n"; printf " %s\n", lc($comp) eq 'yes' ? "checked" : "", $text{'yes'}; printf " %s\n", lc($comp) eq 'no' ? "checked" : "", $text{'no'}; printf " %s$text{'host_escape'} \n"; printf " %s\n", $escape eq "" ? "checked" : "", $text{'default'}; printf " %s\n", $escape eq "none" ? "checked" : "", $text{'host_escape_none'}; printf "\n", $escape eq "" || $escape eq "none" ? "" : "checked"; printf "$text{'host_clevel'} \n"; printf " %s\n", $clevel ? "" : "checked", $text{'default'}; printf "\n", $clevel ? "checked" : ""; print "$text{'host_attempts'} \n"; printf " %s\n", $attempts ? "" : "checked", $text{'default'}; printf "\n", $attempts ? "checked" : ""; print "$text{'host_priv'} \n"; printf " %s\n", lc($priv) eq 'yes' ? "checked" : "", $text{'yes'}; printf " %s\n", lc($priv) eq 'no' ? "checked" : "", $text{'no'}; printf " %s$text{'host_rsh'} \n"; printf " %s\n", lc($rsh) eq 'yes' ? "checked" : "", $text{'yes'}; printf " %s\n", lc($rsh) eq 'no' ? "checked" : "", $text{'no'}; printf " %s$text{'host_usersh'} \n"; printf " %s\n", lc($usersh) eq 'yes' ? "checked" : "", $text{'yes'}; printf " %s\n", lc($usersh) eq 'no' ? "checked" : "", $text{'no'}; printf " %s$text{'host_agent'} \n"; printf " %s\n", lc($agent) eq 'yes' ? "checked" : "", $text{'yes'}; printf " %s\n", lc($agent) eq 'no' ? "checked" : "", $text{'no'}; printf " %s$text{'host_x11'} \n"; printf " %s\n", lc($x11) eq 'yes' ? "checked" : "", $text{'yes'}; printf " %s\n", lc($x11) eq 'no' ? "checked" : "", $text{'no'}; printf " %s$text{'host_strict'} \n"; printf " %s\n", lc($strict) eq 'no' ? "checked" : "", $text{'yes'}; printf " %s\n", lc($strict) eq 'yes' ? "checked" : "", $text{'no'}; printf " %s\n", lc($strict) eq 'ask' ? "checked" : "", $text{'host_ask'}; printf " %s$text{'host_checkip'} \n"; printf " %s\n", lc($checkip) eq 'yes' ? "checked" : "", $text{'yes'}; printf " %s\n", lc($checkip) eq 'no' ? "checked" : "", $text{'no'}; printf " %s$text{'host_prots'} \n"; printf " %s\n", $prots ? '' : 'checked', $text{'default'}; printf " %s\n", $prots ? 'checked' : '', $text{'host_prots_sel'}; foreach $p (1, 2) { printf " %s\n", $p, &indexof($p, @prots) >= 0 ? "checked" : "", $text{"net_prots_$p"}; } print "
$text{'host_lforward'}\n"; print " ", " ", "\n"; @lforward = &find("LocalForward", $conf); $i = 0; foreach $l (@lforward, { }) { local ($lp, $rh, $rp) = ( $l->{'values'}->[0], split(/:/, $l->{'values'}->[1]) ); print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; $i++; } print "
$text{'host_llport'}$text{'host_lrhost'}$text{'host_lrport'}

$text{'host_rforward'}\n"; print " ", " ", "\n"; @rforward = &find("RemoteForward", $conf); $i = 0; foreach $r (@rforward, { }) { local ($rp, $lh, $lp) = ( $r->{'values'}->[0], split(/:/, $r->{'values'}->[1]) ); print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; $i++; } print "
$text{'host_rrport'}$text{'host_rlhost'}$text{'host_rlport'}
\n"; print "\n"; print "\n"; print "\n"; print "
\n"; &ui_print_footer("list_hosts.cgi", $text{'hosts_return'}, "", $text{'index_return'});