Update of /cvsroot/netpass/NetPass/lib/NetPass
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4657/lib/NetPass
Modified Files:
Config.pm DB.pm Network.pm
Log Message:
bug fixes to userform, arp table searching (osx), ldap ui, auth.mhtml ui
Index: Config.pm
===================================================================
RCS file: /cvsroot/netpass/NetPass/lib/NetPass/Config.pm,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- Config.pm 14 Jun 2005 20:29:54 -0000 1.50
+++ Config.pm 23 Jun 2005 20:21:07 -0000 1.51
@@ -1448,6 +1448,7 @@
_log("DEBUG", "nw=$nw examine network clause\n") if $self->debug;
if (! recur_exists ($self->{'cfg'}, "network", $nw)) {
+ _log("DEBUG", "nw=$nw no such network\n");
return undef; #"nosuch network";
}
@@ -2689,7 +2690,7 @@
base the search base
filter the filter to use
- passwordField the name of the password field
+ passwordfield the name of the password field
RETURNS
arrayref on success
@@ -2703,9 +2704,9 @@
my $s = shift;
$s ||= "";
if (recur_exists($self->{'cfg'}, "ldap", $s)) {
- return { 'base' => $self->{'cfg'}->obj('radius')->obj($s)->value('base'),
- 'filter' => $self->{'cfg'}->obj('radius')->obj($s)->value('filter'),
- 'passwordField' => $self->{'cfg'}->obj('radius')->obj($s)->value('passwordField'),
+ return { 'base' => $self->{'cfg'}->obj('ldap')->obj($s)->value('base'),
+ 'filter' => $self->{'cfg'}->obj('ldap')->obj($s)->value('filter'),
+ 'passwordField' => $self->{'cfg'}->obj('ldap')->obj($s)->value('passwordfield'),
};
}
elsif (recur_exists($self->{'cfg'}, "ldap")) {
@@ -2752,9 +2753,12 @@
$self->{'cfg'}->obj('ldap')->$server({});
}
if ($base.$filter.$pfield ne "") {
- $self->{'cfg'}->obj('ldap')->obj($server)->base($base);
- $self->{'cfg'}->obj('ldap')->obj($server)->filter($filter);
- $self->{'cfg'}->obj('ldap')->obj($server)->passwordField($pfield);
+ $self->{'cfg'}->obj('ldap')->obj($server)->base($base)
+ if ($base);
+ $self->{'cfg'}->obj('ldap')->obj($server)->filter($filter)
+ if ($filter);
+ $self->{'cfg'}->obj('ldap')->obj($server)->passwordfield($pfield)
+ if ($pfield);
}
else {
$self->{'cfg'}->obj('ldap')->delete($server);
Index: DB.pm
===================================================================
RCS file: /cvsroot/netpass/NetPass/lib/NetPass/DB.pm,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- DB.pm 8 Jun 2005 16:35:41 -0000 1.46
+++ DB.pm 23 Jun 2005 20:21:07 -0000 1.47
@@ -1475,14 +1475,15 @@
}
} else {
my $ugh = $self->getUserGroups($u);
- if (!defined($ugh)) {
+ my $numGroups = keys %$ugh;
+ if ($numGroups == 0) {
# user doesnt exist
- $sql = "NSERT INTO users (username, groups) VALUES (";
+ $sql = "INSERT INTO users (username, groups) VALUES (";
$sql .= $self->dbh->quote($u). ",";
$sql .= $self->dbh->quote($groups). ")";
if (!$self->dbh->do($sql)) {
_log("ERROR", "failed to add user: $u sql=$sql err=".$self->dbh->errstr);
- return "db failured ".$self->dbh->errstr;
+ return "db failure ".$self->dbh->errstr;
}
_log ("INFO", qq{$whoami added user $u groups "$groups"});
$self->audit(-ip => $myip, -user => $whoami, -severity => 'ALERT',
@@ -1491,7 +1492,6 @@
else {
# user already exists
-
my $groups_orig = $self->composeGroupMembership($ugh);
if ($groups ne $groups_orig) {
$sql = qq{UPDATE users SET groups = };
Index: Network.pm
===================================================================
RCS file: /cvsroot/netpass/NetPass/lib/NetPass/Network.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Network.pm 25 Oct 2004 17:48:25 -0000 1.4
+++ Network.pm 23 Jun 2005 20:21:08 -0000 1.5
@@ -258,10 +258,14 @@
if ($#matches == 0) {
$matches[0] =~ /\($ip\)\s+at\s+(\S+)/;
my $mac = $1;
- $mac =~ s/\://g;
+ my $mac2 = '';
+ foreach my $_mp (split(/:/, $mac)) {
+ $mac2 .= substr("00".$_mp, -2);
+ }
$mac =~ tr [A-Z] [a-z];
+ $mac2 =~ tr [A-Z] [a-z];
return undef if (!$ii && $mac =~ /incomplete/);
- return $mac;
+ return $mac2;
}
my $macs = {};
@@ -272,10 +276,14 @@
if($l =~ /\(($ip)\)\s+at\s+(\S+)/) {
my $ip = $1;
my $mac = $2;
+ my $mac2 = '';
+ foreach my $_mp (split(/:/, $mac)) {
+ $mac2 .= substr("00".$_mp, -2);
+ }
$mac =~ tr [A-Z] [a-z];
- $mac =~ s/\://g;
+ $mac2 =~ tr [A-Z] [a-z];
next if (!$ii && $mac =~ /incomplete/);
- $macs->{$ip} = $mac;
+ $macs->{$ip} = $mac2;
}
}
return $macs;
|