Can't get PerLDAP to work with ActiveState

RESOLVED FIXED

Status

P1
major
RESOLVED FIXED
20 years ago
20 years ago

People

(Reporter: leif, Assigned: leif)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

20 years ago
For some reason, the build I make crashes with an "internal exception" when I
run the regression test.

Some info from: "Shaun Wilde"<Shaun_Wilde@vocaltec.com>

my colleague Paul Blacknell has asked me to send you the build
instructions/info that I used to
compile perldap with activeperl et al.

VC5 SP3
ActivePerl 509
Perldap 121
NT4 SP3
LDAPSDK 3.0

I just followed the instructions supplied - Is there any binaries I
produced that you would want to look at

All appeared fine - though I never tried any regression testing as that was
not in any of the instructions (I think).

I am a Perl beginner - though I do know a bit about LDAP and ADSI. So my
perl scripts tend to be simplistic.
I have used most of the ldap type commands (mod,add,delete etc)
Let us know how you got on.

HTH

Shaun Wilde

Program Manager

Work: swilde@vocaltec.com
http://www.vocaltec.co.uk/vcc/
(Assignee)

Updated

20 years ago
Status: NEW → ASSIGNED
Priority: P3 → P1
(Assignee)

Comment 1

20 years ago
From: andy@haveland.com (Andrew Haveland-Robinson)

Hi Leif,
Thanks very much for your help, though I can't build anything...
(I only have an old Watcom 9.5 compiler) and this will need to run on NT4
sp3/IIS4.

I played around with the authorisation script at "5-10" on the faq
and got the first search returning a DN, but it fails with "Can't locate
object method "simpleAuth" via package "Mozilla::LDAP::Conn" at auth.pl line
66."
Is this found in 1.2?

I couldn't extract anything more than a basic DN with this.

However, I tried qsearch.pl again working after hours of reading and a lot
of experimentation with args... It returned all the information stored on
all the employees, including encrypted passwords. I should now be able to
hack it to give me just the fields I need to authenticate, but could really
do with the algorithm to encrypt passwords to compare them.

It would be a great help to have more illustrated examples, such as

perl qsearch.pl -h ldap.bigfoot.com -p 389 -b "o=bigfoot,c=us" cn=*haveland*

This was arrived at with guesswork... (I can't reveal the address I actually
have to work with unfortunately)
My confusion arises because the X500 fraternity's vocabulary has evolved
down a separate evolutionary path than the rest of the world... I'm more
familiar with tables, fields and records!

>Andrew Haveland-Robinson wrote:
>
>> Are there any plans to update PerLDAP to work with the new consolidated
>> version of ActiveState's Perl, given that this will be the definitive?
>
>It does. ActiveState has a binary distribution of PerLDAP v1.0 for ActivePerl,
>and PerLDAP v1.2 has been tested to build properly with ActiveState. Read the
>FAQ for information about getting v1.2 from the CVS server, at
>
>   http://www.mozilla.org/directory/faq/perldap-faq.html

I still couldn't find 1.2 for NT...  Is PerLDAP another version of Perl
itself, or just library modules? A silly question, but it isn't clear to me.

>> Now all I have to do is figure out what command line options to use to
>> extract the data I need.
>> Is there a list of dc= o= fields etc, or is this  specific to the LDAP
>> server?
>
>It's specific for each server. Some servers allows you to find what suffixes
are
>available, by looking at the "" entry (and examine the namingcontexts
>attributes, for instance).
I'm a little clearer now from hours of research, but I have no idea how to
do what you say above!
I could understand: $entry = $conn->search("host", "base",
"(objectclass=*)"); though!
(Assignee)

Comment 2

20 years ago
From: Stuart Schneider <Stuart.Schneider@pacificorp.com>

   Ok, here's the current status on PerLDAP with ActiveState Perl build 509
and build 513.

   Both build 509 and 513 give the same results - an 'Error: Runtime
exception' after a number of searches have been performed (the exact number
seems to vary depending on the phase of the moon, the current temperature,
etc).

   The script that I am running as a test is as follows (I don't have old
versions of the Mozilla::LDAP library on the system anywhere and I'm running
the script from the folder I extracted your .zip file into):

-----BEGIN SCRIPT-----
use lib './site/lib';
use lib './site/lib/auto';
use Mozilla::LDAP::Conn;
use Mozilla::LDAP::Entry;

$conn=new Mozilla::LDAP::Conn("pdxexc01.pacificorp.com",389,"","");
die "Could't connect to LDAP server" unless $conn;

print "starting LDAP\n";

$search=0;
$found=0;
while (<>) {
  chop($_);

  $search++;
  print "dbg: $_ ($search)\n";
  if (! $conn) { die "conn is dead\n"; }

  my($entry)=$conn->search("","sub","uid=$_",0,"cn","uid");
  print "done ($search)\n";

  if (! $entry) {
    next;
  } else {
    $found++;
    print "found ($found)\n";

    $entry=undef;
  }
}

$conn->close if $conn;
-----END SCRIPT-----

   I've tried to keep the script as simple as possible while still
monitoring the progress as much as possible.  STDIN is a list of 14000+
UID's from my HR database that I'm trying to determine if they have an
account on the Exchange servers.  An equivalent script using the
Net::LDAPapi module handles all 14000+ queries without any problems.  A
sample of the output I see just as this test script dies is as follows:

-----BEGIN COPY OF OUTPUT-----
[many lines deleted]
dbg: P03333 (215)
done (215)
dbg: P03334 (216)
done (216)
found (92)
dbg: P03335 (217)
done (217)
dbg: P03337 (218)
done (218)
dbg: P03339 (219)
done (219)
found (93)
dbg: P03340 (220)
Error: Runtime exception
-----END COPY OF OUTPUT-----

   As you can see, the test script blew after 220 queries, 93 of which had
found accounts within Exchange.


   This is probably unrelated, but when I run my test script with the -w
parameter to Perl, I get the following warnings:

-----BEGIN COPY OF WARNINGS-----
Parens missing around "my" list at site/lib/Mozilla/LDAP/Conn.pm line 109.
Useless use of a variable in void context at site/lib/Mozilla/LDAP/Conn.pm
line 109.
Parens missing around "my" list at site/lib/Mozilla/LDAP/Conn.pm line 232.
Useless use of a variable in void context at site/lib/Mozilla/LDAP/Conn.pm
line 232.
Parens missing around "my" list at site/lib/Mozilla/LDAP/Conn.pm line 273.
Useless use of a variable in void context at site/lib/Mozilla/LDAP/Conn.pm
line 273.
Parens missing around "my" list at site/lib/Mozilla/LDAP/Conn.pm line 301.
Useless use of a variable in void context at site/lib/Mozilla/LDAP/Conn.pm
line 301.
Useless use of a variable in void context at site/lib/Mozilla/LDAP/Conn.pm
line 301.
Useless use of a variable in void context at site/lib/Mozilla/LDAP/Conn.pm
line 301.
Useless use of a variable in void context at site/lib/Mozilla/LDAP/Conn.pm
line 301.
Useless use of a variable in void context at site/lib/Mozilla/LDAP/Conn.pm
line 301.
Useless use of a variable in void context at site/lib/Mozilla/LDAP/Conn.pm
line 301.
Parens missing around "my" list at site/lib/Mozilla/LDAP/Conn.pm line 419.
Useless use of a variable in void context at site/lib/Mozilla/LDAP/Conn.pm
line 419.
Useless use of a variable in void context at site/lib/Mozilla/LDAP/Conn.pm
line 419.
Parens missing around "my" list at site/lib/Mozilla/LDAP/Conn.pm line 497.
Useless use of a variable in void context at site/lib/Mozilla/LDAP/Conn.pm
line 497.
-----END COPY OF WARNINGS-----

   Let me know if this is anything you can tackle or if any additional
information is needed.

Thanks,
   Stuart Schneider
(Assignee)

Comment 3

20 years ago
You wrote:
> >
> >We have a very small test program in perl that reproduces the problem.
>
> So let's see it!

Please access this URL
http://www.creativeis.com.sg/perLDAP/

It downloads a zip file with a README and the program.
If you have any questions, please contact Mutalib, probably best by email
(what time zone are you in, we are GMT+8)?

Thanks in advance.
Philipp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Philipp Schaumann, Managing Consultant
Creative Internet Solutions/Control Data Systems, Singapore
Tel: office (65) 256 9011 - home (65) 271 7243 (GMT+8)
Fax: office (65) 256 9021 - home (65) 274 2415
Address: 51, Goldhill Plaza #14-11, Singapore 308900
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(Assignee)

Comment 4

20 years ago
On Mon, 26 Apr 1999 16:25:21 -0700, Leif Hedstrom <leif@netscape.com>
wrote:

>Nick Ing-Simmons wrote:
>
>> I'd suggest changing the default in the Config.pm that you ship to
>> default to -Od (or whatever the "safest" value is).
>> Reasoning here is that those that have the expertise to dork with
>> this stuff can still dork it back to -O2, while those that don't are
>> more likely to get something that works "out of the box".
>
>Ahh, makes a lot of sense. Thanks for all the suggestions, I'm going to
>try it again as soon as I possibly can. Does anyone know if this
>optimization bug is in VC++ 5.0 only, or is it in 6.0 as well? I remember
>having a similar problem when compiling Perl on NT with VC++ v5.0, and
>setting optimization to just /O (I think) helped (otherwise the build
>wouldn't even pass Perl's regression tests...).

I have verified that the particular bug (messed up stack frame pointer)
that was responsible for the failure of the Perl regression test has been
fixed in VC++ 98. The bug exists in VC++ 5.0 even with SP3. It didn't get
triggered in Perl itself when you compile with PERL_OBJECT. I haven't come
upon a problem yet when Perl and extensions are all compiled with VC++98
and -O2, whatever that has to say. :-)

>Btw, how hard is it to create a binary install package that I can send to
>my ActivePerl users? I most certainly understand that ActiveState can't
>support all these rogue binary packages, but if I knew how to create one,
>I'd be happy to supply and support one for PerLDAP myself.

You'll find information about creating a PPM distribution here:

    http://jenda.krynicky.cz/perl/PPM.html

-Jan
(Assignee)

Comment 5

20 years ago
Leif Hedstrom <leif@netscape.com> writes:
>Nick Ing-Simmons wrote:
>
>> I'd suggest changing the default in the Config.pm that you ship to
>> default to -Od (or whatever the "safest" value is).
>> Reasoning here is that those that have the expertise to dork with
>> this stuff can still dork it back to -O2, while those that don't are
>> more likely to get something that works "out of the box".
>
>Ahh, makes a lot of sense. Thanks for all the suggestions, I'm going to
>try it again as soon as I possibly can. Does anyone know if this
>optimization bug is in VC++ 5.0 only, or is it in 6.0 as well?

There is more than one bug. For ages VC++ could not build perl with -O2.
Then some service pack to VC5 allowed that, but still could not build
Tk.

FWIW (and it ain't worth what I paid for it) VC6.0 Professional _does_
seem to be able to build Tk800.014 with -O2.


>I remember
>having a similar problem when compiling Perl on NT with VC++ v5.0, and
>setting optimization to just /O (I think) helped (otherwise the build
>wouldn't even pass Perl's regression tests...).
>
>Btw, how hard is it to create a binary install package that I can send to
>my ActivePerl users?

Quite easy. Tinker with top-level Makefile.PL then tar up the blib
attached is mail that helped me.

--
Nick Ing-Simmons <nik@tiuk.ti.com>
Via, but not speaking for: Texas Instruments Ltd.
(Assignee)

Comment 6

20 years ago
Created attachment 1087 [details]
PPM HowTo
(Assignee)

Comment 7

20 years ago
From:   "Philipp Schaumann" <Philipp.Schaumann@cdc.com>
CC:
        "Monty W.\"" <Monty.Dickerson@econophone.com>,
        "Jacob Morrison" <Jacob.Morrison@cdc.com>,
        "Singapore Techies" <Singapore.Support@cdc.com>


Thanks for the reply and the action.

No, we are not part of that newsgroup. It would be nice if you could notify
us directly. :-)
(Assignee)

Comment 8

20 years ago
From: Edwin Shin <eshin@mail.law.berkeley.edu>

one of my scripts using perldap is crashing perl (perl.exe Application
error...The instruction at ... referenced memory at... The memory could
not be "written"), vc++ 5 debugger yields "Unhandled exception in
perl.exe (NTDLL.DLL): ... : Access Violation".

while i was happy to attribute the problem to my own programming error,
i can't duplicate the problem on solaris, so i'm assuming some problem
with either my build of perl or perldap. i've been able to duplicate the
error on two entirely different NT boxes using perl 5.005_02 and
5.005_03 and perldap 1.2.2. i built perl on NT using vc++ 5 sp3.

so perl seems to regularly bug out at the line that goes:
        push(@people, $entry);

which doesn't make much sense to me.

I'm unfamiliar with using perl's debugger--i couldn't seem to get the
debugger to show me the values of a given variable at a given time--i
kept getting all of my system's environment variables instead.

the crashing behavior is weird--on the command line, perl always
crashes, unless i invoke perl with -d. then it goes through and prints
the index. via a web browser, it runs when called once, but perl crashes
on any reloads.

any help, pointers or "look, there's the stupid mistake you made that's
breaking it" would be much appreciated =)


here's an abbreviated version of the script:
#!c:/perl/5.00503/bin/MSWin32-x86/perl.exe -w

use Mozilla::LDAP::Conn;
use CGI;
use strict;

my $cgi = new CGI;
my $script = $cgi->url(-absolute=>1);

my ( $conn, $entry );
my $host = 'xxx.yyy.zzz.zzz';
my $port = '389';

print_index();

sub print_index {
        my ( $base, $filter, @attributes );
        my ( $group_count, @groups, $people_count, @people );
        my ( $i, $j, $first_letter, $subhead );

        $base = "ou=x,ou=y,o=abc,c=123";
        $filter =
"(|(cn=blah)(cn=blah2)(cn=blah3)(cn=blah4)(cn=blah5)(cn=blah6))";
        @attributes = ("uniquemember");

        $conn = new Mozilla::LDAP::Conn($host, $port) || die "No LDAP
connection";

        $entry = $conn->search($base, "sub", $filter, 0, @attributes);
        while ($entry) {
                push(@groups, $entry);
                $entry = $conn->nextEntry();
        }

        $group_count = scalar @groups;

        for ( $i = 0; $i < $group_count; $i++ ) {
                $people_count = @{$groups[$i]->{uniquemember}};
                #error($people_count);

                for ( $j = 0; $j < $people_count; $j++ ) {
                        @attributes = ("uid", "sn", "givenName");
                        ($filter, $base) =
dn_chopper($groups[$i]->{uniquemember}[$j]);
                        $entry = $conn->search($base, "sub", $filter, 0,
@attributes);
                        push(@people, $entry);
                }
        }

        @people = sort {
                "$a->{sn}[0] $a->{givenName}[0]"
                        cmp
                "$b->{sn}[0] $b->{givenName}[0]"
        } @people;

        send_html_header();
        print <<EOT;

<p><a href="$script/$people[$i]->{uid}[0]">$people[$i]->{sn}[0],
$people[$i]->{givenName}[0]</a>, title here
EOT
        }
        send_html_footer();
}

sub dn_chopper {
        my ( $dn, $cn, $base );
        $dn = $_[0];
        $dn =~ /(cn=.*?),(ou=.*)/i;
        $cn = $1;
        $base = $2;
        return ($cn, $base);
}
(Assignee)

Comment 9

20 years ago
I had problems compiling your Perldap module with ActiveState Perl 516
under Windows NT 4.0.

The linker complained about missing symbols:

        __imp__strdup
        __imp__InitializeCriticalSection
        __imp__DeleteCriticalSection
        __imp__LeaveCriticalSection
        __imp__EnterCriticalSection
        __imp__DisableThreadLibraryCalls

I added the following parameter to your WriteMakefile call in
Makefile.PL

        dynamic_lib => {
                OTHERLDFLAGS => 'kernel32.lib oldnames.lib'
        }
(Assignee)

Updated

20 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 20 years ago
Resolution: --- → FIXED
(Assignee)

Comment 10

20 years ago
We finally nailed this one... Thanks Kevin!
You need to log in before you can comment on or make changes to this bug.