# edit_host.cgi
# Display options for a new or existing host config
-require './sshd-lib.pl';
+require (-r 'sshd-lib.pl' ? './sshd-lib.pl' : './ssh-lib.pl');
&ReadParse();
if ($in{'new'}) {
&ui_print_header(undef, $text{'host_create'}, "", "chost");
$conf = $host->{'members'};
}
+# Get version and type
+if (&get_product_name() eq 'usermin') {
+ $version_type = &get_ssh_type();
+ $version_number = &get_ssh_version();
+ }
+else {
+ $version_type = $version{'type'};
+ $version_number = $version{'number'};
+ }
+
print &ui_form_start("save_host.cgi", "post");
print &ui_hidden("idx", $in{'idx'});
print &ui_hidden("new", $in{'new'});
[ 0, &ui_textbox("escape",
$escape eq "none" ? "" : $escape, 4) ] ]));
-if ($version{'type'} ne 'ssh' || $version{'number'} < 3) {
+if ($version_type ne 'ssh' || $version_number < 3) {
# SSH compression level
$clevel = &find_value("CompressionLevel", $conf);
print &ui_table_row($text{'host_clevel'},
[ [ 0, $text{'yes'} ], [ 1, $text{'no'} ],
[ 3, $text{'host_ask'} ], [ 2, $text{'default'} ] ]));
-if ($version{'type'} eq 'openssh') {
+if ($version_type eq 'openssh') {
# Double-check remote host IP?
$checkip = &find_value("CheckHostIP", $conf);
print &ui_table_row($text{'host_checkip'},
print &ui_table_row($text{'host_lforward'},
&ui_columns_table([ $text{'host_llport'}, $text{'host_lrhost'},
$text{'host_lrport'} ],
- 100, \@ltable));
+ 50, \@ltable));
print &ui_table_hr();
print &ui_table_row($text{'host_rforward'},
&ui_columns_table([ $text{'host_rrport'}, $text{'host_rlhost'},
$text{'host_rlport'} ],
- 100, \@rtable));
+ 50, \@rtable));
print &ui_table_end();
if ($in{'new'}) {
# save_host.cgi
# Create, update or delete a client host
-require './sshd-lib.pl';
+require (-r 'sshd-lib.pl' ? './sshd-lib.pl' : './ssh-lib.pl');
&ReadParse();
&lock_file($config{'client_config'});
$hconf = &get_client_config();
&error_setup($text{'host_err'});
+# Get version and type
+if (&get_product_name() eq 'usermin') {
+ $version_type = &get_ssh_type();
+ $version_number = &get_ssh_version();
+ }
+else {
+ $version_type = $version{'type'};
+ $version_number = $version{'number'};
+ }
+
if ($in{'delete'}) {
# Just delete the host
$host = $hconf->[$in{'idx'}];
&save_directive("Port", $conf, $in{'port'});
}
- if ($version{'type'} ne 'ssh' || $version{'number'} < 3) {
+ if ($version_type ne 'ssh' || $version_number < 3) {
&save_directive("Compression", $conf,
$in{'comp'} == 2 ? undef : $in{'comp'} ? 'yes' : 'no');
}
}
- if ($version{'type'} ne 'ssh' || $version{'number'} < 3) {
+ if ($version_type ne 'ssh' || $version_number < 3) {
if ($in{'clevel_def'}) {
&save_directive("CompressionLevel", $conf);
}
$in{'strict'} == 2 ? undef : $in{'strict'} == 1 ? 'yes' :
$in{'strict'} == 0 ? 'no' : 'ask');
- if ($version{'type'} eq 'openssh') {
+ if ($version_type eq 'openssh') {
&save_directive("CheckHostIP", $conf,
$in{'checkip'} == 2 ? undef : $in{'checkip'} ? 'yes' : 'no');
&flush_file_lines();
&unlock_file($config{'client_config'});
-&webmin_log($in{'new'} ? "create" : $in{'delete'} ? "delete" : "update",
- "host", $host->{'values'}->[0]);
+if (&get_product_name() ne 'usermin') {
+ &webmin_log($in{'new'} ? "create" : $in{'delete'} ? "delete" : "update",
+ "host", $host->{'values'}->[0]);
+ }
&redirect("list_hosts.cgi");