Project

General

Profile

« Previous | Next » 

Revision 4865

Added by walbridge over 15 years ago

- reformat header
- add debugging for getLdapEntry searches
- add 'filter' parameter for organizations

View differences:

src/perl/ldapweb.cgi
1 1
#!/usr/bin/perl -w
2
 #
3
 #  '$RCSfile$'
4
 #  Copyright: 2001 Regents of the University of California 
5
 #
6
 #   '$Author$'
7
 #     '$Date$'
8
 # '$Revision$' 
9
 # 
10
 # This program is free software; you can redistribute it and/or modify
11
 # it under the terms of the GNU General Public License as published by
12
 # the Free Software Foundation; either version 2 of the License, or
13
 # (at your option) any later version.
14
 #
15
 # This program is distributed in the hope that it will be useful,
16
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 # GNU General Public License for more details.
19
 #
20
 # You should have received a copy of the GNU General Public License
21
 # along with this program; if not, write to the Free Software
22
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
 #
2
#
3
#  '$RCSfile$'
4
#  Copyright: 2001 Regents of the University of California 
5
#
6
#   '$Author$'
7
#     '$Date$'
8
# '$Revision$' 
9
# 
10
# This program is free software; you can redistribute it and/or modify
11
# it under the terms of the GNU General Public License as published by
12
# the Free Software Foundation; either version 2 of the License, or
13
# (at your option) any later version.
14
#
15
# This program is distributed in the hope that it will be useful,
16
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
# GNU General Public License for more details.
19
#
20
# You should have received a copy of the GNU General Public License
21
# along with this program; if not, write to the Free Software
22
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
#
24 24

  
25 25
#
26 26
# This is a web-based application for allowing users to register a new
......
173 173
    } else {
174 174
        $ldapConfig->{$o}{'dn'} = $ldapConfig->{$o}{'base'};
175 175
    }
176

  
177
    # include filter information. By default, our filters are 'o=$name', e.g. 'o=NAPIER'
178
    # these can be overridden by specifying them in metacat.properties.
179
    if (!$ldapConfig->{$o}{'filter'}) {
180
        $ldapConfig->{$o}{'filter'} = "o=$o";
181
    }
176 182
}
177 183

  
178 184
#--------------------------------------------------------------------------80c->
......
589 595
    	}
590 596

  
591 597
    	if($ldapConfig->{$org}{'filter'}){
598
            debug("getLdapEntry: filter set, searching for base=$base, " .
599
                  "(&(uid=$username)($ldapConfig->{$org}{'filter'})");
592 600
        	$mesg = $ldap->search ( base   => $base,
593 601
                filter => "(&(uid=$username)($ldapConfig->{$org}{'filter'}))");
594 602
    	} else {
603
            debug("getLdapEntry: no filter, searching for $base, (uid=$username)");
595 604
        	$mesg = $ldap->search ( base   => $base, filter => "(uid=$username)");
596 605
    	}
597 606
    
......
609 618
            	$path =~ s/^\///;
610 619
            	$entry = &getLdapEntry($host, $path, $username, $org);
611 620
            	if ($entry) {
621
                    debug("getLdapEntry: recursion found $host, $path, $username, $org");
612 622
                	return $entry;
613 623
            	}
614 624
        	}
......
632 642
        my $mailhost = $properties->getProperty('email.mailhost');
633 643
        my $sender =  $properties->getProperty('email.sender');
634 644
        # Send the email message to them
635
        debug("sending notification: $mailhost, $sender, $recipient");
636 645
        my $smtp = Net::SMTP->new($mailhost);
637 646
        $smtp->mail($sender);
638 647
        $smtp->to($recipient);

Also available in: Unified diff