Update of /cvsroot/netpass/NetPass/www/htdocs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28167/www/htdocs
Modified Files:
netpass.mhtml
Log Message:
strike system feature
Index: netpass.mhtml
===================================================================
RCS file: /cvsroot/netpass/NetPass/www/htdocs/netpass.mhtml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- netpass.mhtml 24 Apr 2005 03:42:03 -0000 1.7
+++ netpass.mhtml 1 May 2005 19:46:04 -0000 1.8
@@ -96,12 +96,42 @@
print "<meta http-equiv=\"Refresh\" content=\"15;$url\">";
}
+ my $existingHost = $np->db->macIsRegistered($mac);
+
_log("DEBUG", "$mac $ip registerHost()\n");
$np->db->registerHost($m->session->{'remote_mac'},
$m->session->{'remote_addr'},
$m->session->{'remote_os'},
$m->session->{'username'});
+ # if this wasn't a pre-existing (already registered) host, then any
+ # user-fixed results are converted to 'fixed'. the situation is:
+ # a new client arrives, and clicks 'fixed' a bunch of times. since they
+ # arent yet registered, they won't appear in quarctl, so an admin cant
+ # change the results to 'fixed'. because of that, we dont apply strikes to
+ # unregistered hosts. they can click 'fixed' as much as they like (but will
+ # never get out of quarantine until they register). but, since we disable
+ # strikes for unregistered hosts, but are still recording results for them,
+ # once they register, all of those 'user-fixed' results get attached to
+ # their registration and can exhaust their alotted strikes. so we change
+ # them to 'fixed' upon registration - this allows us to keep some history
+ # on the client, and give them a clean slate to start out with.
+
+ if (!$existingHost) {
+ _log("DEBUG", "$mac $ip changing user-fixed to fixed\n");
+ my $ufr = $np->db->getResults(-mac => $mac, -status => 'user-fixed');
+ if (ref($ufr) eq "HASH") {
+ for (my $rn = 0 ; $rn <= $#{$ufr->{'rowid'}} ; $rn++) {
+ my $rv = $np->db->updateResult(-mac => $mac, -ip => $ip,
+ -rowid => $ufr->{'rowid'}->[0],
+ -status => 'fixed');
+ if ($rv) {
+ _log("ERROR", "$mac $ip updateResult failed: $rv\n");
+ }
+ }
+ }
+ }
+
my $sw = $m->session->{'switch'};
my $po = $m->session->{'port'};
|