[Webcalendar] LDAP feedback
Yan Fitterer
y.fitterer a t ram.ac.uk
Wed, 21 Apr 2004 14:54:29 +0100
--Message-Boundary-575
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body
Hi,
I've now setup our webcal server to authenticate via ldap, against
Novel eDir (8.7.3).
Works a treat.
I needed to authenticate against a different LDAP attribute though.
The original module webcalAuth_ldap.pm uses UID, while the default
Novell mapping is to the CN attribute.
I made some (minimal) changes to webcalAuth_ldap.pm. Attached is a
diff against the current CVS version of the file.
What is really needed is to parametrise the name of the LDAP
attribute to be used for authentication. I'm sorry I haven't go the
time to do that... I'm leaving my job and am just trying to tidy
things up a little before I go...
Anyway, Thanks a million again Maorong, 2.8.8 is another fine version
of WebCal. I intended to pitch in with some LDAP stuff a long time
ago, but it never happened - sorry for that.
Yan
--
Yan Fitterer
IT Manager, Royal Academy of Music
E-mail : y.fitterer a t ram.ac.uk
Marylebone Rd, London, NW1 5HT
Phone (+44) 20 7873 7365 Fax (+44) 20 7873 7364
--Message-Boundary-575
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Text from file 'webcalAuth_ldap.diff'
--- webcalAuth_ldap.cvs 2004-04-21 14:39:34.000000000 +0100
+++ webcalAuth.pm 2004-04-02 20:56:24.000000000 +0100
a t a t -90,9 +90,9 a t a t
my $ldap = &ldap_connect();
if($ldap) {
my $s_opts = $webcal_ldap_config::ldap{'search_options'};
- my $result = $ldap->search( a t {$s_opts}, filter => "(uid=$user)");
+ my $result = $ldap->search( a t {$s_opts}, filter => "(cn=$user)");
if($result->code()) { return(0, "LDAP search failed: " . $result->error() );}
- if(not $result->count) { return(0, "No matching UID=$user found");}
+ if(not $result->count) { return(0, "No matching CN=$user found");}
# use the first entry;
my $entry = $result->entry(0);
my $msg = $ldap->bind($entry->dn(), password => $password);
a t a t -150,9 +150,9 a t a t
my $ldap = &ldap_connect;
my $s_opts = $webcal_ldap_config::ldap{'search_options'};
if($ldap) {
- my $result = $ldap->search( a t {$s_opts}, filter=> "(uid=$user)");
+ my $result = $ldap->search( a t {$s_opts}, filter=> "(cn=$user)");
if($result->code()) { return(0, "Could not Authenticate. LDAP search failed: " . $result->error() );}
- if(not $result->count) { return(0, "No matching UID=$user found");}
+ if(not $result->count) { return(0, "No matching CN=$user found");}
# use the first entry;
my $entry = $result->entry(0);
my $msg = $ldap->bind($entry->dn(), password => $passwd);
a t a t -175,12 +175,12 a t a t
my $ldap = &ldap_connect();
if($ldap) {
my $s_opts = $webcal_ldap_config::ldap{'search_options'};
- my $result = $ldap->search( a t {$s_opts}, filter => "(uid=$user)");
+ my $result = $ldap->search( a t {$s_opts}, filter => "(cn=$user)");
if($result->code()) { return ;}
if(not $result->count) { return;}
# use the first entry;
my $entry = $result->entry(0);
- my $cn = $entry->get_value('cn'); $::calinfo{'name'} = $cn if $cn;
+ my $cn = $entry->get_value('fullName'); $::calinfo{'name'} = $cn if $cn;
my $email = $entry->get_value('mail'); $::calinfo{'email'} = $email if $email;
my $URI= $entry->get_value('labeledURI'); $::calinfo{'homepage'} = $URI if $URI;
$::calinfo{'w'}=$user;
a t a t -291,9 +291,9 a t a t
my $ldap = &ldap_connect();
if($ldap) {
my $s_opts = $webcal_ldap_config::ldap{'search_options'};
- my $result = $ldap->search( a t {$s_opts}, filter => "(uid=$user)");
+ my $result = $ldap->search( a t {$s_opts}, filter => "(cn=$user)");
if($result->code()) { return(0, "LDAP search failed: " . $result->error() );}
- if(not $result->count) { return(0, "No matching UID=$user found");}
+ if(not $result->count) { return(0, "No matching CN=$user found");}
# use the first entry;
my $entry = $result->entry(0);
my $msg = $ldap->bind($entry->dn(), password => $oldpswd);
a t a t -321,9 +321,9 a t a t
my $ldap = &ldap_connect();
if($ldap) {
my $s_opts = $webcal_ldap_config::ldap{'search_options'};
- my $result = $ldap->search( a t {$s_opts}, filter => "(uid=$user)");
+ my $result = $ldap->search( a t {$s_opts}, filter => "(cn=$user)");
if($result->code()) { return(0, "LDAP search failed: " . $result->error() );}
- if(not $result->count) { return(0, "No matching UID=$user found");}
+ if(not $result->count) { return(0, "No matching CN=$user found");}
# use the first entry;
my $entry = $result->entry(0);
my ($admin_dn, $admin_pass);
a t a t -336,8 +336,8 a t a t
my $admin = $::d{'remote_user'};
$admin_pass = $::d{'remote_user_crypted_password'};
$admin_pass = DecryptPassword($admin_pass);
- my $ans = $ldap->search( a t {$s_opts}, filter => "(uid=$admin)");
- if($ans->code() or not $ans->count) { return(0, "No matching UID=$admin found");}
+ my $ans = $ldap->search( a t {$s_opts}, filter => "(cn=$admin)");
+ if($ans->code() or not $ans->count) { return(0, "No matching CN=$admin found");}
my $tmp = $ans->entry(0);
$admin_dn = $tmp->dn();
}
--Message-Boundary-575--