with-authinfo-kludge (accept_loop): Might as well use the loop name.
[with-authinfo-kludge] / with-authinfo-kludge
index fae87b5..950ea3b 100755 (executable)
@@ -23,8 +23,6 @@
 
 ## things to do
 ##
-## split parsing and resolution of addresses
-## default port
 ## pidfiles
 
 my $VERSION = "0.1.0~unfinished";
@@ -592,6 +590,8 @@ sub fix_server_config ($) {
   $s->{"_proxy_sockdir"} = undef;
   $s->{"_proxy_server"} = defined $s->{"via"} ?
     $s->{"sshbind"} : $s->{"remote"};
+  $s->{"_proxy_server"} =~ s/:119$//;
+  $s->{"_proxy_server"} =~ s/^\[(.*)\]$/$1/;
   $s->{"_sshkid"} = undef;
   $s->{"_ssh_master"} = undef;
 }
@@ -766,11 +766,13 @@ sub run_client (@) {
 sub accept_loop () {
   my $rfd_in = "";
   for my $fd (keys %SERVMAP) { vec($rfd_in, $fd, 1) = 1; }
-  for (;;) {
+  SELECT: for (;;) {
     my ($n, $t) = select my $rfd_out = $rfd_in, undef, undef, undef;
-    $n >= 0 || $! == EINTR or sysfail "select failed: $!";
+    if ($n >= 0) { }
+    elsif ($! == EINTR) { next SELECT; }
+    else {  sysfail "select failed: $!"; }
     FD: for my $fd (keys %SERVMAP) {
-      next unless vec $rfd_out, $fd, 1;
+      next FD unless vec $rfd_out, $fd, 1;
       my ($s, $a, $sk) = @{$SERVMAP{$fd}};
       my $nsk;
       unless (accept $nsk, $sk) {