Skip to content

Commit fa9ba76

Browse files
committed
Allow username fortransfer to be specified
1 parent 1c5c3c8 commit fa9ba76

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

Diff for: lang/en

+1
Original file line numberDiff line numberDiff line change
@@ -7327,6 +7327,7 @@ transfer_host0=New system
73277327
transfer_savehost=Save for later use?
73287328
transfer_ssh=SSH
73297329
transfer_webmin=Webmin RPC
7330+
transfer_user=Login for destination system
73307331
transfer_pass=Password for destination system
73317332
transfer_passdef=(optional if SSH authentication is configured)
73327333
transfer_overwrite=Over-write existing domain?

Diff for: transfer.cgi

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ $d = &get_domain($in{'dom'});
99

1010
# Validate inputs
1111
my @hosts = &get_transfer_hosts();
12-
$user = 'root';
1312
if ($in{'host_mode'}) {
1413
# Use an old host
1514
my ($h) = grep { $_->[0] eq $in{'oldhost'} } @hosts;
1615
$h || &error($text{'transfer_eoldhost'});
1716
$host = $h->[0];
1817
$pass = $h->[1];
1918
$proto = $h->[2] || 'ssh';
19+
$user = $h->[3] || 'root';
2020
}
2121
else {
2222
# Entering a new host
@@ -25,16 +25,18 @@ else {
2525
&to_ipaddress($hostname) || &to_ip6address($hostname) ||
2626
&error($text{'transfer_ehost2'});
2727
$host = $in{'host'};
28+
$user = $in{'hostuser'};
2829
$pass = $in{'hostpass'};
2930
$proto = $in{'proto'};
3031
if ($in{'savehost'}) {
3132
my ($h) = grep { $_->[0] eq $in{'host'} } @hosts;
3233
if ($h) {
3334
$h->[1] = $pass;
3435
$h->[2] = $proto;
36+
$h->[3] = $user;
3537
}
3638
else {
37-
push(@hosts, [ $host, $pass, $proto ]);
39+
push(@hosts, [ $host, $pass, $proto, $user ]);
3840
}
3941
&save_transfer_hosts(@hosts);
4042
}

Diff for: transfer_form.cgi

+4
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ else {
7777
print &ui_table_row($text{'transfer_host'}, $hfield);
7878
}
7979

80+
# Root login
81+
print &ui_table_row($text{'transfer_user'},
82+
&ui_textbox("hostuser", "root", 20));
83+
8084
# Root password
8185
print &ui_table_row($text{'transfer_pass'},
8286
&ui_password("hostpass", undef, 20)." ".

Diff for: virtual-server-lib-funcs.pl

+2-1
Original file line numberDiff line numberDiff line change
@@ -19455,7 +19455,8 @@ sub get_transfer_hosts
1945519455
sub save_transfer_hosts
1945619456
{
1945719457
my $hfile = "$module_config_directory/transfer-hosts";
19458-
my %hosts = map { $_->[0], $_->[1].($_->[2] ? " ".$_->[2] : "") } @_;
19458+
my %hosts = map { $_->[0], $_->[1]." ".($_->[2] || "ssh")." ".
19459+
($_->[3] || "root") } @_;
1945919460
&write_file($hfile, \%hosts);
1946019461
&set_ownership_permissions(undef, undef, 0600, $hfile);
1946119462
}

0 commit comments

Comments
 (0)