Hi,

I've added a secondary port which can be used to fetch statistical data
(based on the infostats-page) without the use for authentication. It is
(should be) protected by the allowStatConnectionsFrom so it works
basically the same way as the apache's extended server-status module.

I don't know if it comes in handy for anyone, but anyway, thought I
share it...

gr,
Joshua

--- old/assp.pl 2007-10-21 15:24:30.000000000 +0100
+++ new/assp.pl 2007-10-21 16:21:29.000000000 +0100
@@ -1229,6 +1229,9 @@
 [OutgoingBufSize,'Size of TCP/IP Buffer',10,textinput,102400,'(\d+)',undef,
  'If ASSP talks to the internet over a modem change this to 4096. The default 
is 102400.'],
 
+[webStatPort,'Web Admin Port',20,textinput,55553,'(\S+)',ConfigChangeStatPort,
+  'The port on which ASSP will listen for http connections to the statistics 
interface. You may also supply an IP address to limit connections to a specific 
interface.<p><small><i>Examples:</i> 55553, 192.168.0.5:12345</small></p>'],
+# I hate hidden password input, but if you like it, uncomment this line and 
comment the next one. -- just quit bugging me about it!
 [webAdminPort,'Web Admin 
Port',20,textinput,55555,'(\S+)',ConfigChangeAdminPort,
   'The port on which ASSP will listen for http connections to the web 
administration interface. If you change this, after you click Apply you must 
change the URL on your browser to reconnect. You may also supply an IP address 
to limit connections to a specific interface.<p><small><i>Examples:</i> 55555, 
192.168.0.5:12345</small></p>'],
 # I hate hidden password input, but if you like it, uncomment this line and 
comment the next one. -- just quit bugging me about it!
@@ -1241,6 +1244,11 @@
   <p><small>127.0.0.1|10. - Accept connections from the localhost and any 
computer in the 10.0.0.0/8 subnet.</small></p>
   <p><small>192.168.0. - Accept connections from any computer in the 
192.168.0.0/24 subnet.</small></p>'],
 
+[allowStatConnectionsFrom,'Only Allow Raw Statistical Connections 
From*',80,textinput,'','(.*)',ConfigMakeRe,
+  'An optional list of IP addresses from which you will accept raw statistical 
connections. Blank means accept connections from any IP address. 
<p><small><i>Examples:</i></small></p>
+  <p><small>127.0.0.1|10. - Accept connections from the localhost and any 
computer in the 10.0.0.0/8 subnet.</small></p>
+  <p><small>192.168.0. - Accept connections from any computer in the 
192.168.0.0/24 subnet.</small></p>'],
+
 [HeaderMaxLength,'Maximum Header Size',10,textinput,100000,'(\d*)',undef,
   'The maximum allowed header length, in bytes. At each mail hop header 
information is added by the mail server. A large mail header could indicate a 
mail loop. If the value is blank or 0 the header size will not be checked.'],
 [HeaderMaxLocal,'Check Header Size for Locals',0,checkbox,1,'([01]?)',undef,
@@ -1273,6 +1281,7 @@
 
  $MakeRE{ispip}=\&setISPRE;
  $MakeRE{allowAdminConnectionsFrom}=\&setACFRE;
+ $MakeRE{allowStatConnectionsFrom}=\&setSCFRE;
  $MakeRE{acceptAllMail}=\&setAMRE;
  $MakeRE{localDomains}=\&setLDRE;
  $MakeRE{myServerRe}=\&setLHNRE;
@@ -1897,11 +1906,13 @@
 
   $lsn = newListen($listenPort,\&NewSMTPConnection);
   $WebSocket = newListen($webAdminPort,\&NewWebConnection);
-  mlog(0,"listening for mail connections at $listenPort and admin connections 
at $webAdminPort");
+  $StatSocket = newListen($webStatPort,\&NewStatConnection);
+  mlog(0,"listening for mail connections at $listenPort and admin connections 
at $webAdminPort and stat connections at $webStatPort");
   if($listenPort2) {
     $lsn2 = newListen($listenPort2,\&NewSMTPConnection);
     mlog(0,"listening for additional mail connections at $listenPort2");
   }
+
 # handle the possible relayhost / smarthost option
   if($relayHost && $relayPort) {
        $this->{noprocessing}=1 if $relayportNP;
@@ -2151,7 +2162,7 @@
   }
   foreach $fh (@$canread) {
     if ($fh && $SocketCalls{$fh}) {
-      if ($CanStatCPU && ($SocketCalls{$fh}==\&WebTraffic || 
$SocketCalls{$fh}==\&NewWebConnection)) {
+      if ($CanStatCPU && ($SocketCalls{$fh}==\&WebTraffic || 
$SocketCalls{$fh}==\&NewWebConnection || 
$SocketCalls{$fh}==\&NewStatConnection)) {
 # calculate time spent serving web request
         $webTime-=Time::HiRes::time();
         $SocketCalls{$fh}->($fh);
@@ -2280,7 +2291,7 @@
         }
       }
       foreach $fh (@$canread) {
-        if ($fh && ($SocketCalls{$fh}==\&SMTPTraffic || 
$SocketCalls{$fh}==\&NewSMTPConnection || $SocketCalls{$fh}==\&WebTraffic || 
$SocketCalls{$fh}==\&NewWebConnection)) {
+        if ($fh && ($SocketCalls{$fh}==\&SMTPTraffic || 
$SocketCalls{$fh}==\&NewSMTPConnection || $SocketCalls{$fh}==\&WebTraffic || 
$SocketCalls{$fh}==\&NewWebConnection || 
$SocketCalls{$fh}==\&NewStatConnection)) {
           $SocketCalls{$fh}->($fh);
         }
       }
@@ -2865,6 +2876,10 @@
   SetRE(ACFRE,"^($_[0])",'i',"Allow Admin Connections From");
 }
 
+sub setSCFRE {
+  SetRE(SCFRE,"^($_[0])",'i',"Allow Stat Connections From");
+}
+
 sub NewWebConnection {
   my $s=$WebSocket->accept;
   return unless $s;
@@ -2881,6 +2896,114 @@
   $SocketCalls{$s}=\&WebTraffic;
 }
 
+sub NewStatConnection {
+  my $s=$StatSocket->accept;
+  return unless $s;
+  my $ip=$s->peerhost();
+  my $port=$s->peerport();
+  if($allowStatConnectionsFrom && $ip!~$SCFRE) {
+    mlog('',"stat connection from $ip:$port rejected by 
allowStatConnectionsFrom");
+    $Stats{statConnDenied}++;
+    $s->close();
+    return;
+  }
+# logging is done later (in webRequest()) due to /shutdown_frame page, which 
auto-refreshes
+  $readable->add($s);
+  $SocketCalls{$s}=\&StatTraffic;
+}
+
+
+sub StatTraffic {
+  my $fh=shift;
+  if($fh->sysread($buf,4096)>0) {
+    local $_=$StatCon{$fh}.=$buf;
+    if(length($_) > 1030000) {
+# throw away connections longer than 1M to prevent flooding
+      WebDone($fh);
+      return;
+    }
+    if(/Content-length: (\d+)/i) {
+# POST request
+      my $l=$1;
+      if (/(.*?\n)\r?\n\r?(.*)/s && length($2) >= $l) {
+        my $reqh=$1;
+        my $reqb=$2;
+        my $resp;
+        my $tempfh;
+        open($tempfh,'>',\$resp);
+        binmode $tempfh;
+        statRequest($tempfh,$fh,$reqh,$reqb);
+        close($tempfh);
+        if ($resp=~/(.*?)\n\r?\n\r?(.*)/s) {
+          my $resph=$1;
+          my $respb=$2;
+          my $time=gmtime();
+          $time=~s/(...) (...) +(\d+) (........) (....)/$1, $3 $2 $5 $4 GMT/;
+          $resph.="\nServer: ASSP/$version$modversion";
+          $resph.="\nDate: $time";
+          if ($EnableHTTPCompression && $CanUseHTTPCompression && 
/Accept-Encoding: (.*?)\n/i && $1=~/(gzip|deflate)/i) {
+            my $enc=$1;
+            if ($enc=~/gzip/i) {
+# encode with gzip
+              $respb=Compress::Zlib::memGzip($respb);
+            } else {
+# encode with deflate
+              my $deflater=deflateInit();
+              $respb=$deflater->deflate($respb);
+              $respb.=$deflater->flush();
+            }
+            $resph.="\nContent-Encoding: $enc";
+          }
+          $resph.="\nContent-Length: ".length($respb);
+          print $fh $resph;
+          print $fh "\n\n";
+          print $fh $respb;
+        }
+# close connection
+        WebDone($fh);
+      }
+    } elsif(/\n\r?\n/) {
+      my $resp;
+      my $tempfh;
+      open($tempfh,'>',\$resp);
+      binmode $tempfh;
+      statRequest($tempfh,$fh,$_);
+      close($tempfh);
+      if ($resp=~/(.*?)\n\r?\n\r?(.*)/s) {
+        my $resph=$1;
+        my $respb=$2;
+        my $time=gmtime();
+        $time=~s/(...) (...) +(\d+) (........) (....)/$1, $3 $2 $5 $4 GMT/;
+        $resph.="\nServer: ASSP/$version$modversion";
+        $resph.="\nDate: $time";
+        if ($EnableHTTPCompression && $CanUseHTTPCompression && 
/Accept-Encoding: (.*?)\n/i && $1=~/(gzip|deflate)/i) {
+          my $enc=$1;
+          if ($enc=~/gzip/i) {
+# encode with gzip
+            $respb=Compress::Zlib::memGzip($respb);
+          } else {
+# encode with deflate
+            my $deflater=deflateInit();
+            $respb=$deflater->deflate($respb);
+            $respb.=$deflater->flush();
+          }
+          $resph.="\nContent-Encoding: $enc";
+        }
+        $resph.="\nContent-Length: ".length($respb);
+        print $fh $resph;
+        print $fh "\n\n";
+        print $fh $respb;
+      }
+# close connection
+      WebDone($fh);
+    }
+  } else {
+# connection closed
+    WebDone($fh);
+  }
+}
+
+
 sub WebTraffic {
   my $fh=shift;
   if($fh->sysread($buf,4096)>0) {
@@ -2975,6 +3098,7 @@
   my $fh=shift;
   delete $SocketCalls{$fh};
   delete $WebCon{$fh};
+  delete $StatCon{$fh};
   $readable->remove($fh);
 }
 
@@ -8574,6 +8698,8 @@
  $Stats{smtpMaxConcurrentSessions}=0;
  $Stats{admConn}=0;
  $Stats{admConnDenied}=0;
+ $Stats{statConn}=0;
+ $Stats{statConnDenied}=0;
  $Stats{rcptValidated}=0;
  $Stats{rcptUnchecked}=0;
  $Stats{rcptSpamLover}=0;
@@ -9050,6 +9176,36 @@
  }
 
 
+sub statRequest {
+ my ($tempfh,$fh,$head,$data)[EMAIL PROTECTED];
+ %statRequests=(
+  '/' => \&ConfigStatsRaw,
+  '/raw' => \&ConfigStatsRaw,
+#  '/xml' => \&ConfigStatsRaw,    # Can be expanded to display in different 
formats like this
+ );
+ my $i=0;
+ # %head -- public hash
+ (%head)=map{++$i % 2 ? lc $_ : $_} map/^([^ :]*)[: ]{0,2}(.*)/, 
split(/\r\n/,$head);
+ my ($page,$qs)=($head{get} || $head{head} || $head{post})=~/^([^\? 
]+)(?:\?(\S*))?/;
+ if(defined $data) { # GET, POST order
+  $qs.='&' if ($qs ne '');
+  $qs.=$data;
+ }
+ $qs=~y/+/ /;
+ $i=0;
+ # parse query string, get rid of google autofill
+ # %qs -- public hash
+ (%qs)=map{s/(e)_(mail)/$1$2/gi if ++$i % 2; $_} split(/[=&]/,$qs);
+ foreach $k (keys %qs) 
{$qs{$k}=~s/%([0-9a-fA-F][0-9a-fA-F])/pack(C,hex($1))/ge}
+ my $ip=$fh->peerhost();
+ my $port=$fh->peerport();
+ mlog('',"stat connection from $ip:$port;");
+
+ $Stats{statConn}++;
+
+ if (defined ($v=$statRequests{$page})) { print $tempfh $v->($head,$qs); }
+}
+
 sub webRequest {
  my ($tempfh,$fh,$head,$data)[EMAIL PROTECTED];
  %webRequests=(
@@ -9159,6 +9315,8 @@
  $s{smtpConnTotal2}=$s{smtpConnAcceptedTotal2}+$s{smtpConnRejectedTotal2};
  $s{admConnTotal}=$Stats{admConn}+$Stats{admConnDenied};
  $s{admConnTotal2}=$AllStats{admConn}+$AllStats{admConnDenied};
+ $s{statConnTotal}=$Stats{statConn}+$Stats{statConnDenied};
+ $s{statConnTotal2}=$AllStats{statConn}+$AllStats{statConnDenied};
  
$s{rcptAcceptedLocal}=$Stats{rcptValidated}+$Stats{rcptUnchecked}+$Stats{rcptSpamLover};
  
$s{rcptAcceptedLocal2}=$AllStats{rcptValidated}+$AllStats{rcptUnchecked}+$AllStats{rcptSpamLover};
  $s{rcptAcceptedRemote}=$Stats{rcptWhitelisted}+$Stats{rcptNotWhitelisted};
@@ -9314,6 +9472,18 @@
 <td class="statsOptionValue" colspan="2">$Stats{admConnDenied}</td>
 <td class="statsOptionValue" colspan="2">$AllStats{admConnDenied}</td>
 </tr>
+<tr><td class="statsOptionTitle"><b>Stat Connections Received:</b></td>
+<td class="statsOptionValue" colspan="2">$tots{statConnTotal}</td>
+<td class="statsOptionValue" colspan="2">$tots{statConnTotal2}</td>
+</tr>
+<tr><td class="statsOptionTitle"><b>&nbsp;&nbsp;&nbsp;&nbsp;Stat Connections 
Accepted:</b></td>
+<td class="statsOptionValue" colspan="2">$Stats{statConn}</td>
+<td class="statsOptionValue" colspan="2">$AllStats{statConn}</td>
+</tr>
+<tr><td class="statsOptionTitle"><b>&nbsp;&nbsp;&nbsp;&nbsp;Stat Connections 
Rejected:</b></td>
+<td class="statsOptionValue" colspan="2">$Stats{statConnDenied}</td>
+<td class="statsOptionValue" colspan="2">$AllStats{statConnDenied}</td>
+</tr>
  <tr>
   <td class="statsOptionValue" style="background-color: #FFFFFF">&nbsp;</td>
   <td class="statsOptionValue" style="background-color: #FFFFFF" colspan="2">
@@ -9787,6 +9957,119 @@
 EOT
 }
 
+
+sub ConfigStatsRaw {
+ SaveStats();
+ my %tots=statsTotals();
+ my $upt=(time-$Stats{starttime})/(24*3600);
+ my $upt2=(time-$AllStats{starttime})/(24*3600);
+ my $uptime=sprintf("%.3f",$upt);
+ my $uptime2=sprintf("%.3f",$upt2);
+ my $mpd=sprintf("%.1f",$upt==0 ? 0 : $tots{msgTotal}/$upt);
+ my $mpd2=sprintf("%.1f",$upt2==0 ? 0 : $tots{msgTotal2}/$upt2);
+ my $pct=sprintf("%.1f",$tots{msgTotal}-$Stats{locals}==0 ? 0 : 
100*$tots{msgRejectedTotal}/($tots{msgTotal}-$Stats{locals}));
+ my $pct2=sprintf("%.1f",$tots{msgTotal2}-$AllStats{locals}==0 ? 0 : 
100*$tots{msgRejectedTotal2}/($tots{msgTotal2}-$AllStats{locals}));
+ my $cpu=$CanStatCPU ? sprintf("%.2f\%",100*$cpuUsage) : 'n/a';
+ my $cpuAvg=sprintf(" (%.2f\% avg)",$Stats{cpuTime}==0 ? 0 : 
100*$Stats{cpuBusyTime}/$Stats{cpuTime}) if $CanStatCPU;
+ my $cpuAvg2=$CanStatCPU ? sprintf("%.2f\% avg",$AllStats{cpuTime}==0 ? 0 : 
100*$AllStats{cpuBusyTime}/$AllStats{cpuTime}) : 'n/a';
+<<EOT;
+$headerHTTP
+ASSP Proxy Uptime | $uptime days | $uptime2 days
+Messages Processed | $tots{msgTotal} ($mpd per day) | $tots{msgTotal2} ($mpd2 
per day)
+Non-Local Mail Blocked | $pct% | $pct2%
+CPU Usage | $cpu$cpuAvg | $cpuAvg2
+Concurrent SMTP Sessions | $smtpConcurrentSessions 
($Stats{smtpMaxConcurrentSessions} max) | $AllStats{smtpMaxConcurrentSessions} 
max
+
+
+SMTP Connections Received | $tots{smtpConnTotal} | $tots{smtpConnTotal2}
+SMTP Connections Accepted | $tots{smtpConnAcceptedTotal} | 
$tots{smtpConnAcceptedTotal2}
+SMTP Connections Rejected | $tots{smtpConnRejectedTotal} | 
$tots{smtpConnRejectedTotal2}
+Envelope Recipients Processed | $tots{rcptTotal} | $tots{rcptTotal2}
+Envelope Recipients Accepted | $tots{rcptAcceptedTotal} | 
$tots{rcptAcceptedTotal2}
+Envelope Recipients Rejected | $tots{rcptRejectedTotal} | 
$tots{rcptRejectedTotal2}
+Messages Processed | $tots{msgTotal} | $tots{msgTotal2}
+Messages Passed | $tots{msgAcceptedTotal} | $tots{msgAcceptedTotal2}
+Messages Rejected | $tots{msgRejectedTotal} | $tots{msgRejectedTotal2}
+Admin Connections Received | $tots{admConnTotal} | $tots{admConnTotal2}
+Admin Connections Accepted | $Stats{admConn} | $AllStats{admConn}
+Admin Connections Rejected | $Stats{admConnDenied} | $AllStats{admConnDenied}
+Stat Connections Received | $tots{statConnTotal} | $tots{statConnTotal2}
+Stat Connections Accepted | $Stats{statConn} | $AllStats{statConn}
+Stat Connections Rejected | $Stats{statConnDenied} | $AllStats{statConnDenied}
+
+
+Accepted Logged SMTP Connections | $Stats{smtpConn} | $AllStats{smtpConn}
+Not Logged SMTP Connections | $Stats{smtpConnNotLogged} | 
$AllStats{smtpConnNotLogged}
+SMTP Connection Limits | $tots{smtpConnLimit} | $tots{smtpConnLimit2}
+Overall Limits | $Stats{smtpConnLimit} | $AllStats{smtpConnLimit}
+By IP Limits | $Stats{smtpConnLimitIP} | $AllStats{smtpConnLimitIP}
+By IP Frequency Limits | $Stats{smtpConnLimitFreq} | 
$AllStats{smtpConnLimitFreq}
+By Domain IP Limits | $Stats{smtpConnDomainIP} | $AllStats{smtpConnDomainIP}
+SMTP Connections Timeout | $tots{smtpConnIdleTimeout} | 
$tots{smtpConnIdleTimeout2}
+Denied SMTP Connections | $Stats{smtpConnDenied} | $AllStats{smtpConnDenied}
+
+
+Local Recipients Accepted | $tots{rcptAcceptedLocal} | 
$tots{rcptAcceptedLocal2}
+Validated Recipients | $Stats{rcptValidated} | $AllStats{rcptValidated}
+Unchecked Recipients | $Stats{rcptUnchecked} | $AllStats{rcptUnchecked}
+Spam-Lover Recipients | $Stats{rcptSpamLover} | $AllStats{rcptSpamLover}
+Remote Recipients Accepted | $tots{rcptAcceptedRemote} | 
$tots{rcptAcceptedRemote2}
+Whitelisted Recipients | $Stats{rcptWhitelisted} | $AllStats{rcptWhitelisted}
+Not Whitelisted Recipients | $Stats{rcptNotWhitelisted} | 
$AllStats{rcptNotWhitelisted}
+Noprocessed Recipients | $Stats{rcptUnprocessed} | $AllStats{rcptUnprocessed}
+Email Reports | $tots{rcptReport} | $tots{rcptReport2}
+Spam Reports | $Stats{rcptReportSpam} | $AllStats{rcptReportSpam}
+Ham Reports | $Stats{rcptReportHam} | $AllStats{rcptReportHam}
+Whitelist Additions | $Stats{rcptReportWhitelistAdd} | 
$AllStats{rcptReportWhitelistAdd}
+Whitelist Deletions | $Stats{rcptReportWhitelistRemove} | 
$AllStats{rcptReportWhitelistRemove}
+Redlist Additions | $Stats{rcptReportRedlistAdd} | 
$AllStats{rcptReportRedlistAdd}
+Redlist Deletions | $Stats{rcptReportRedlistRemove} | 
$AllStats{rcptReportRedlistRemove}
+Local Recipients Rejected | $tots{rcptRejectedLocal} | 
$tots{rcptRejectedLocal2}
+Nonexistent Recipients | $Stats{rcptNonexistent} | $AllStats{rcptNonexistent}
+Delayed Recipients | $Stats{rcptDelayed} | $AllStats{rcptDelayed}
+Delayed (Late) Recipients | $Stats{rcptDelayedLate} | 
$AllStats{rcptDelayedLate}
+Delayed (Expired) Recipients | $Stats{rcptDelayedExpired} | 
$AllStats{rcptDelayedExpired}
+Embargoed Recipients | $Stats{rcptEmbargoed} | $AllStats{rcptEmbargoed}
+Spam Bucketed Recipients | $Stats{rcptSpamBucket} | $AllStats{rcptSpamBucket}
+Remote Recipients Rejected | $tots{rcptRejectedRemote} | 
$tots{rcptRejectedRemote2}
+Relay Attempts Rejected | $Stats{rcptRelayRejected} | 
$AllStats{rcptRelayRejected}
+
+
+Bayesian Hams | $Stats{bhams} | $AllStats{bhams}
+Whitelisted | $Stats{whites} | $AllStats{whites}
+Local | $Stats{locals} | $AllStats{locals}
+Noprocessing | $Stats{noprocessing} | $AllStats{noprocessing}
+Spamlover Spams Passed | $Stats{spamlover} | $AllStats{spamlover}
+Bayesian Spams | $Stats{bspams} | $AllStats{bspams}
+Domains Blacklisted | $Stats{blacklisted} | $AllStats{blacklisted}
+HELO Blacklisted | $Stats{helolisted} | $AllStats{helolisted}
+HELO Invalid | $Stats{invalidHelo} | $AllStats{invalidHelo}
+HELO Forged | $Stats{forgedHelo} | $AllStats{forgedHelo}
+Missing MX/A | $Stats{mxaMissing} | $AllStats{mxaMissing}
+Missing PTR | $Stats{ptrMissing} | $AllStats{ptrMissing}
+Invalid PTR | $Stats{ptrInvalid} | $AllStats{ptrInvalid}
+Spam Collected Messages | $Stats{spambucket} | $AllStats{spambucket}
+Penalty Trap Messages | $Stats{penaltytrap} | $AllStats{penaltytrap}
+Bad Attachments | $Stats{viri} | $AllStats{viri}
+Viruses Detected | $Stats{viridetected} | $AllStats{viridetected}
+Sender Regex | $Stats{bombSender} | $AllStats{bombSender}
+Bomb Regex | $Stats{bombs} | $AllStats{bombs}
+Penalty Box | $Stats{pbdenied} | $AllStats{pbdenied}
+Message Scoring | $Stats{msgscoring} | $AllStats{msgscoring}
+Invalid Local Sender | $Stats{senderInvalidLocals} | 
$AllStats{senderInvalidLocals}
+Invalid Internal Mail | $Stats{internaladdresses} | 
$AllStats{internaladdresses}
+Scripts | $Stats{scripts} | $AllStats{scripts}
+SPF Failures | $Stats{spffails} | $AllStats{spffails}
+RBL Failures | $Stats{rblfails} | $AllStats{rblfails}
+URIBL Failures | $Stats{uriblfails} | $AllStats{uriblfails}
+Max Errors Exceeded | $Stats{msgMaxErrors} | $AllStats{msgMaxErrors}
+Delayed | $Stats{msgDelayed} | $AllStats{msgDelayed}
+Empty Recipient | $Stats{msgNoRcpt} | $AllStats{msgNoRcpt}
+Not SRS Signed Bounces | $Stats{msgNoSRSBounce} | $AllStats{msgNoSRSBounce}
+
+EOT
+}
+
 sub ConfigLists {
  my $s;
  my $a;
@@ -11612,6 +11895,32 @@
  }
 }
 
+sub ConfigChangeStatPort {my ($name, $old, $new)[EMAIL PROTECTED];
+ if($> == 0 || $new >= 1024) {
+  # change the listenport
+  $webStatPort=$new;
+  $readable->remove($StatSocket);
+  $StatSocket->close();
+  $StatSocket = newListen($webStatPort,\&NewStatConnection);
+  if($StatSocket) {
+   mlog(0,"AdminUpdate: listening on new stat port $new (changed from $old)");
+  } else {
+   # couldn't open the port -- switch back
+   $webStatPort=$old;
+   $StatSocket = newListen($webStatPort,\&NewStatConnection);
+   mlog(0,"AdminUpdate: couldn't open new port -- still listening on $old");
+   $Config{$name}=$old;
+   return "<span class=\"negative\">Couldn't open new port $new</span>";
+  }
+  return '';
+ } else {
+  # don't have permissions to change
+  mlog(0,"AdminUpdate: request to listen on new stat port $new (changed from 
$old) -- restart required; euid=$>");
+  return "<br />Restart required; euid=$>";
+ }
+}
+
+
 sub ConfigChangeRelayPort {my ($name, $old, $new)[EMAIL PROTECTED];
  unless ($relayHost && $new) {
   if($Relay) {
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Assp-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/assp-user

Reply via email to