-26Aug17=======================================================================
+27Oct17=======================================================================
+1. Get correct hostname support and privilege levels on web connects.
+26Oct17=======================================================================
1. Start (serious) work on web interface. Make the necessary changes to allow
a local webserver to connect and get its own style of messages.
11Aug17=======================================================================
inqueue => '9,Input Queue,parray',
next_pc92_update => '9,Next PC92 Update,atime',
next_pc92_keepalive => '9,Next PC92 KeepAlive,atime',
- hostname => '0,(Proxied)Hostname',
+ hostname => '0,Hostname',
);
$maxerrors = 20; # the maximum number of concurrent errors allowed before disconnection
use AsyncMsg;
use JSON;
use Time::HiRes qw(gettimeofday tv_interval);
-use Regexp::IPv6 qw($IPv6_re);
use Mojo::IOLoop;
use Mojo::IOLoop::ForkCall;
my $pkg = shift;
my $call = shift;
# my @rout = $main::routeroot->add_user($call, Route::here(1));
- DXProt::_add_thingy($main::routeroot, [$call, 0, 0, 1, undef, undef, $self->{conn}->peerhost], );
+ DXProt::_add_thingy($main::routeroot, [$call, 0, 0, 1, undef, undef, $self->hostname], );
# ALWAYS output the user
my $ref = Route::User::get($call);
my $host = $self->{conn}->peerhost;
$host ||= "AGW Port #$self->{conn}->{agwport}" if exists $self->{conn}->{agwport};
$host ||= "unknown";
- LogDbg('DXCommand', "$call connected from $host");
+ $self->{hostname} = $host;
$self->{name} = $name ? $name : $call;
$self->send($self->msg('l2',$self->{name}));
$self->{pagelth} = $pagelth;
($self->{width}) = $line =~ /width=(\d+)/; $line =~ s/\s*width=\d+\s*//;
if ($line =~ /host=/) {
- ($self->{hostname}) = $line =~ /host=(\d+\.\d+\.\d+\.\d+)/; $line =~ s/\s*host=\d+\.\d+\.\d+\.\d+//;
- unless ($self->{hostname}) {
- ($self->{hostname}) = $line =~ /host=($IPv6_re)/;
- $line =~ s/\s*host=$IPv6_re//;
+ my ($h) = $line =~ /host=(\d+\.\d+\.\d+\.\d+)/;
+ $line =~ s/\s*host=\d+\.\d+\.\d+\.\d+// if $h;
+ unless ($h) {
+ ($h) = $line =~ /host=([\da..fA..F:]+)/;
+ $line =~ s/\s*host=[\da..fA..F:]+// if $h;
}
+ $self->{hostname} = $h if $h;
}
$self->{width} = 80 unless $self->{width} && $self->{width} > 80;
$self->{consort} = $line; # save the connection type
-
+
+ LogDbg('DXCommand', "$call connected from $self->{hostname}");
+
# set some necessary flags on the user if they are connecting
$self->{beep} = $user->wantbeep;
$self->{ann} = $user->wantann;
$self->send_motd;
# sort out privilege reduction
- $self->{priv} = 0 if $line =~ /^(ax|te)/ && !$self->conn->{usedpasswd};
+ $self->{priv} = 0 unless $self->{hostname} eq '127.0.0.1' || $self->{hostname} eq '::1' || $self->conn->{usedpasswd};
# get the filters
my $nossid = $call;
return;
}
if ($bumpexisting) {
- my $ip = $conn->peerhost || 'unknown';
+ my $ip = $dxchan->hostname;
$dxchan->send_now('D', DXM::msg($lang, 'conbump', $call, $ip));
LogDbg('DXCommand', "$call bumped off by $ip, disconnected");
$dxchan->disconnect;
my $lock = $user->lockout if $user;
if ($baseuser && $baseuser->lockout || $lock) {
if (!$user || !defined $lock || $lock) {
- my $host = $conn->peerhost || "unknown";
+ my $host = $conn->peerhost;
LogDbg('DXCommand', "$call on $host is locked out, disconnected");
$conn->disconnect;
return;