[Netpass-devel] NetPass/lib/NetPass API.pm,1.17,1.18
Brought to you by:
jeffmurphy
|
From: Matt <mt...@us...> - 2005-06-03 15:15:21
|
Update of /cvsroot/netpass/NetPass/lib/NetPass In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29126 Modified Files: API.pm Log Message: Index: API.pm =================================================================== RCS file: /cvsroot/netpass/NetPass/lib/NetPass/API.pm,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- API.pm 2 Jun 2005 20:37:42 -0000 1.17 +++ API.pm 3 Jun 2005 15:15:13 -0000 1.18 @@ -223,17 +223,37 @@ _log("ERROR", "Unknown Error"); return undef; } + } - my $rv2 = $np->db->updateResult ( - -mac => $mac, - -status => "QUAR", - ); + my $rv2 = $np->db->updateRegister ( + -mac => $mac, + -status => "QUAR", + ); - if ($rv2 ne 1) { - _log("ERROR", "Unable to quarantine $mac"); - return undef; - } + if ($rv2 ne 1) { + _log("ERROR", "Unable to quarantine $mac"); + return undef; + } + + my($sw, $po, $m2p, $p2m) = $np->findOurSwitchPort($mac, $ip); + + if (!defined($sw) || !defined($po)) { + _log("ERROR", "unable to determine switch for $mac $ip\n"); + return undef; + } + + my $rv3 = $np->db->requestMovePort( + -switch => $sw, + -port => $po, + -vlan => 'quarantine', + -by => 'npapi', + ); + + if (!$rv3) { + _log("ERROR", "$mac requestMovePort($sw, $po) failed\n"); + return undef; } + return ("quarantined"); } |