mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 08:40:24 +00:00
Fix to adjust functions names
This commit is contained in:
@@ -14,7 +14,7 @@ my @uinfo = getpwnam($user);
|
||||
my ($uid, $gid);
|
||||
if ($user ne "root" && !$<) {
|
||||
if (!@uinfo) {
|
||||
&cleanup_miniserv($port);
|
||||
&remove_miniserv_websocket($port);
|
||||
die "User $user does not exist!";
|
||||
}
|
||||
$uid = $uinfo[2];
|
||||
@@ -68,7 +68,7 @@ my ($shellfh, $pid) = &proc::pty_process_exec($shellexec, $uid, $gid, $shelllogi
|
||||
&reset_environment();
|
||||
my $shcmd = "'$shellexec".($shelllogin ? " $shelllogin" : "")."'";
|
||||
if (!$pid) {
|
||||
&cleanup_miniserv($port);
|
||||
&remove_miniserv_websocket($port);
|
||||
die "Failed to run shell with $shcmd\n";
|
||||
}
|
||||
else {
|
||||
@@ -87,7 +87,7 @@ untie(*STDIN);
|
||||
close(STDIN);
|
||||
|
||||
$SIG{'ALRM'} = sub {
|
||||
&cleanup_miniserv($port);
|
||||
&remove_miniserv_websocket($port);
|
||||
die "timeout waiting for connection";
|
||||
};
|
||||
alarm(60);
|
||||
@@ -137,13 +137,13 @@ Net::WebSocket::Server->new(
|
||||
}
|
||||
if (!syswrite($shellfh, $msg, length($msg))) {
|
||||
print STDERR "write to shell failed : $!\n";
|
||||
&cleanup_miniserv($port);
|
||||
&remove_miniserv_websocket($port);
|
||||
exit(1);
|
||||
}
|
||||
},
|
||||
disconnect => sub {
|
||||
print STDERR "websocket connection closed\n";
|
||||
&cleanup_miniserv($port);
|
||||
&remove_miniserv_websocket($port);
|
||||
kill('KILL', $pid) if ($pid);
|
||||
exit(0);
|
||||
}
|
||||
@@ -156,7 +156,7 @@ Net::WebSocket::Server->new(
|
||||
my $ok = sysread($shellfh, $buf, 1024);
|
||||
if ($ok <= 0) {
|
||||
print STDERR "end of output from shell\n";
|
||||
&cleanup_miniserv($port);
|
||||
&remove_miniserv_websocket($port);
|
||||
exit(0);
|
||||
}
|
||||
if ($wsconn) {
|
||||
@@ -169,5 +169,5 @@ Net::WebSocket::Server->new(
|
||||
],
|
||||
)->start;
|
||||
print STDERR "exited websockets server\n";
|
||||
&cleanup_miniserv($port);
|
||||
&cleanup_old_websockets([$port]);
|
||||
&remove_miniserv_websocket($port);
|
||||
&cleanup_miniserv_websockets([$port]);
|
||||
@@ -22,10 +22,10 @@ if ($port) {
|
||||
}
|
||||
}
|
||||
|
||||
# cleanup_miniserv(port)
|
||||
# remove_miniserv_websocket(port)
|
||||
# Remove old websocket info
|
||||
# from miniserv.conf
|
||||
sub cleanup_miniserv
|
||||
sub remove_miniserv_websocket
|
||||
{
|
||||
my ($port) = @_;
|
||||
my %miniserv;
|
||||
@@ -42,10 +42,10 @@ if ($port) {
|
||||
}
|
||||
}
|
||||
|
||||
# cleanup_old_websockets([&skip-ports])
|
||||
# cleanup_miniserv_websockets([&skip-ports])
|
||||
# Called by scheduled status collection to remove any
|
||||
# websockets in miniserv.conf that are no longer used
|
||||
sub cleanup_old_websockets
|
||||
sub cleanup_miniserv_websockets
|
||||
{
|
||||
my ($skip) = @_;
|
||||
$skip ||= [ ];
|
||||
|
||||
Reference in New Issue
Block a user