From: Graham B. <gb...@po...> - 2000-05-04 14:54:23
|
----- Forwarded message from Gerald Roehrbein/Pctdmn <gro...@bi...> ----- From: Gerald Roehrbein/Pctdmn <gro...@bi...> Date: Thu, 4 May 2000 14:54:40 -0100 To: gb...@po... Subject: Your LDAP Perl Module Hello Graham, I try to use your LDAP Module but I'am not able to use it. Maybe I'am not so experienced with LDAP. I have to write a little module that should do the following: The Module have to use 3 Parameter (Name, Password, UniqueId) Then it should build a mail adress Uni...@my... and a mail alias. The Software should query LDAP to permit/deny double e-mail aliases. And then it should add the data to LDAP directory. Sounds easy. The prgram is from the examples of ACTIVE PERL but it does not run. The Source Code is below and the output of the programm is added below the source. I do not know what the problem is and how to debug. I'am not an experienced Perl prorgammer so I do not have any idea how to debug it and how to get more information about the reasons of the errors. ---------------------------------------------------------------------BEGIN OF SOURCE------------------------------------------------------------- use CGI; # use strict # 'vars'; # use Mail::Send; use Net::LDAP; # use Net::LDAP::message; $ldap = Net::LDAP->new('mcis01', debug=> 3) or die "$@"; $ldap->bind ; # an anonymous bind $mesg = $ldap->search ( # perform a search base => "c=mcis01", filter => "(& (uid= (o=microsoft))" ); print "Error: "+$mesg->error+"!!!"; $mesg->code && die $mesg->error; foreach $entry ($mesg->all_entries) { print "ENTRY: "; $entry->dump; } $ldap->unbind; # take down session $ldap = Net::LDAP->new('mcis01', debug =>3 ); $ldap->bind ( # bind to a directory with dn and password dn => 'cn=Administrator,ou=Members, o=microsoft', password => 'NetFRAME' ); $result = $ldap->add ( dn => 'cn = Barbara Jensen', # dn => 'cn = Barbara Jensen', attr => [ 'cn' => ['Barbara Jensen', 'Barbs Jensen'], #'sn' => 'Jensen', 'mail' => 'b.j...@um...' ] ); $result->code && warn "failed to add entry: ", $result->error ; -------------------------------------------------------END OF SOURCE---------------------------------------------------- Output of the above source: ---------------------------------------------------------BEGIN OF LOG------------------------------------------------------- C:\ldap>ldap.pl Net::LDAP=HASH(0x8bbf1f0) sending: 30 0C 02 01 01 60 07 02 01 02 04 00 80 00 __ __ 0....`........ Net::LDAP=HASH(0x8bbf1f0) received: 30 0C 02 01 01 61 07 0A 01 00 04 00 04 00 __ __ 0....a........ Net::LDAP=HASH(0x8bbf1f0) sending: 30 32 02 01 02 63 2D 04 08 63 3D 6D 63 69 73 30 02...c-..c=mcis0 31 0A 01 02 0A 01 02 02 01 00 02 01 00 01 01 00 1............... A0 10 A3 0E 04 01 6F 04 09 6D 69 63 72 6F 73 6F ......o..microso 66 74 30 00 __ __ __ __ __ __ __ __ __ __ __ __ ft0. Net::LDAP=HASH(0x8bbf1f0) received: 30 0C 02 01 02 65 07 0A 01 00 04 00 04 00 __ __ 0....e........ 0Net::LDAP=HASH(0x8bbf1f0) sending: 30 05 02 01 03 42 00 __ __ __ __ __ __ __ __ __ 0....B. Net::LDAP=HASH(0x8f76be4) sending: 30 3C 02 01 04 60 37 02 01 02 04 28 63 6E 3D 41 0<...`7....(cn=A 64 6D 69 6E 69 73 74 72 61 74 6F 72 2C 6F 75 3D dministrator,ou= 4D 65 6D 62 65 72 73 2C 20 6F 3D 6D 69 63 72 6F Members, o=micro 73 6F 66 74 80 08 4E 65 74 46 52 41 4D 45 __ __ soft..NetFRAME Net::LDAP=HASH(0x8f76be4) received: 30 0C 02 01 04 61 07 0A 01 00 04 00 04 00 __ __ 0....a........ Net::LDAP=HASH(0x8f76be4) sending: 30 60 02 01 05 68 5B 04 13 63 6E 20 3D 20 42 61 0`...h[..cn = Ba 72 62 61 72 61 20 4A 65 6E 73 65 6E 30 44 30 24 rbara Jensen0D0$ 04 02 63 6E 31 1E 04 0E 42 61 72 62 61 72 61 20 ..cn1...Barbara 4A 65 6E 73 65 6E 04 0C 42 61 72 62 73 20 4A 65 Jensen..Barbs Je 6E 73 65 6E 30 1C 04 04 6D 61 69 6C 31 14 04 12 nsen0...mail1... 62 2E 6A 65 6E 73 65 6E 40 75 6D 69 63 68 2E 65 b.jensen@umich.e 64 75 __ __ __ __ __ __ __ __ __ __ __ __ __ __ du Net::LDAP=HASH(0x8f76be4) received: 30 0C 02 01 05 69 07 0A 01 41 04 00 04 00 __ __ 0....i...A.... failed to add entry: at C:\dfbldap\ldap.pl line 36. C:\ldap> ---------------------------------------------------------------------END OF LOG--------------------------------------------------------------- Within the LDAP directory there are two Members. But the search does not find them. It would be nice to get a little help from you. Thanks a lot. With best regards Gerald P.S. It's running under Windows NT 4.0 and the LDAP Server is LDAP from the MCIS MAIL. ----- End forwarded message ----- |
From: Chris R. <Chr...@me...> - 2000-05-04 15:29:05
|
On Thu, 04 May 2000 15:47:25 BST, Graham Barr wrote: > ----- Forwarded message from Gerald Roehrbein/Pctdmn <gro...@bi...> ----- > > From: Gerald Roehrbein/Pctdmn <gro...@bi...> > Date: Thu, 4 May 2000 14:54:40 -0100 > To: gb...@po... > Subject: Your LDAP Perl Module > > > Hello Graham, > > I try to use your LDAP Module but I'am not able to use it. Maybe I'am not > so experienced with LDAP. > I have to write a little module that should do the following: > > The Module have to use 3 Parameter (Name, Password, UniqueId) > Then it should build a mail adress Uni...@my... and a mail alias. > The Software should query > LDAP to permit/deny double e-mail aliases. And then it should add the data > to LDAP directory. > > Sounds easy. > > The prgram is from the examples of ACTIVE PERL but it does not run. > The Source Code is below and the output of the programm is added below the > source. I do not know what the problem > is and how to debug. I'am not an experienced Perl prorgammer so I do not > have any idea how to debug it and how to get more information about the > reasons of the errors. A lot of the problems appear to be because you haven't taught your script enough about what information your LDAP server is holding. > > ---------------------------------------------------------------------BEGIN > OF SOURCE------------------------------------------------------------- > use CGI; > # use strict # 'vars'; > # use Mail::Send; > use Net::LDAP; > # use Net::LDAP::message; > > $ldap = Net::LDAP->new('mcis01', debug=> 3) or die "$@"; > $ldap->bind ; # an anonymous bind > $mesg = $ldap->search ( # perform a search > base => "c=mcis01", That isn't a legal country name. Country names can only be two characters wide, eg US, or GB, or EH. (A mini competition! Who can tell me where c=EH is?) > filter => "(& (uid= (o=microsoft))" That isn't a legal search filter. It should probably be something like: filter => '(&(uid=1234abcd)(o=microsoft))' > $result = $ldap->add ( > dn => 'cn = Barbara Jensen', That DN looks unlikely; it is indicating a person directly below the directory ROOT entry. > attr => [ 'cn' => ['Barbara Jensen', 'Barbs Jensen'], > #'sn' => 'Jensen', > 'mail' => 'b.j...@um...' > ] This is not adding all the attributes that are required by the directory. In particular, you need to specify the objectclass attribute. You need to work out: 1) what is the DN of the top entry that your LDAP server is storing. This entry is often called something like an "initial naming context", or possibly just "naming context". 2) where under this point you can add entries. If you find out th DN of the top entry is "o=some company,c=US" then change the add to say: dn => "cn=Barbara Jensen,o=some company,c=US", Graham, does the sample script look awfully familiar to you? Like the start of an old version of LDAP.pod perhaps? :-) Cheers, Chris |
From: Graham B. <gb...@po...> - 2000-05-04 17:12:33
|
On Thu, May 04, 2000 at 04:27:02PM +0100, Chris Ridd wrote: > Graham, does the sample script look awfully familiar to you? Like the > start of an old version of LDAP.pod perhaps? :-) Now that you mention it. Graham. |
From: Gerald R. <gro...@q8...> - 2000-05-05 07:04:05
|
Hello Graham, Hello Chris, I use the newest Version of ACTIVE PERL (5.6.0.613) and I've downloaded the LDAP Module from Graham's website last tuesday. The example code I used to test if it work may be old but the LDAP module is not old. It's from the File (Perl/html/site/lib/Net/LDAP.html). At the end of the file there is a copyright notice (c) 1997-1999 Graham Barr. I think the sample code is really great because it's all I need. ;-) I've only to add some fancy gizmos and then it's complete. But first it should be run! best regards Gerald Graham Barr wrote: > On Thu, May 04, 2000 at 04:27:02PM +0100, Chris Ridd wrote: > > Graham, does the sample script look awfully familiar to you? Like the > > start of an old version of LDAP.pod perhaps? :-) > > Now that you mention it. > > Graham. |
From: Graham B. <gb...@po...> - 2000-05-05 08:13:45
|
On Fri, May 05, 2000 at 09:06:05AM +0200, Gerald Roehrbein wrote: > Hello Graham, > Hello Chris, > > > > I use the newest Version of ACTIVE PERL (5.6.0.613) and I've downloaded the > LDAP Module from Graham's website last tuesday. Oh dear. perl 5.6.0 has been found to have some bad bugs in it. I would suggest using 5.005_03 until 5.6.1 is released. > The example code I used to test if it work may be old but the LDAP module > is not old. It's from the File (Perl/html/site/lib/Net/LDAP.html). At the > end of the file there is a copyright notice (c) 1997-1999 Graham Barr. Ooops, that website was old, it will now point you to the new website at http://perl-ldap.sourceforge.net where you will find the latest docs etc. There is also http://download.sourceforge.net/perl-ldap/perl-ldap-0.16_01.tar.gz which has a couple of bug fixes in. > I think the sample code is really great because it's all I need. ;-) > I've only to add some fancy gizmos and then it's complete. But first it > should be run! Hopefully the sameple code in the latest docs is more correct. Graham. |