Doh, Im very sorry, I forgot to attach the script.

Thanks in advance,

Steve.
------------------------------------------------------------------
#!/opt/perl5.8.0/bin/perl
# ISH Authenticaiton script
#  External Authenication script for CommuniGate Pro.
#  This script should be placed on the CGPro Server, and the server should
#  configured to use it as an external authenticator
(Settings->General->Helpers
).
#  Also, the appropriate CommuniGate Domain should be configured to allow
its us
ers
#  to use the External Authenticator by default
#  (Domains->Account Defaults->External Authentication).
#  Finally, the $LDAPServerAddress and $BASE_DN values below should be set
corre
ctly.
#

#  You may need to install the following modules:
#  ASN1 from <http://www.cpan.org/modules/by-module/Convert/>
#  LDAP from <http://www.cpan.org/modules/by-module/Net/>

use Net::LDAP;
use Net::LDAP::Constant qw(LDAP_SUCCESS LDAP_COMPARE_TRUE
LDAP_COMPARE_FALSE);
use strict;


my $LDAPServerAddress = 'ldap-be-01';   # You should define this value
my $BASE_DN           = "ou=ishmail,dc=ish,dc=de";


$| = 1;     #force STDOUT autoflush after each write

my $a=0;

while(<STDIN>) {
  chomp;    # remove \n from the end of line
  my ($prefix,$method,$name,$password) = split(/ /);

  my $errorMsg = "";
  for(my $i=0;$i<50000;$i++)
  {
       $errorMsg = checkPassword('[EMAIL PROTECTED]','basspaddws');
     $a++;
     print "TRY: $a\n";
     print "Err: '$errorMsg'\n";
  }
}

###########################################################################

sub checkPassword() {
  my ($user,$password)[EMAIL PROTECTED];
  my $result;
  my $activated;
  my $domain;

  my $name,$domain="";
  if($user =~ /(.+)\@(.+)/) {
    $name=$1;
    $domain=$2;
  } else {
    return "Full account name with \@ and domain part expected";
  }

  ############# End of Leak Marker

  my $ldap = Net::LDAP->new($LDAPServerAddress,port=>389,timeout=>20);
  if(!defined ($ldap))
  {
    return "Can't connect to $LDAPServerAddress via LDAP";
  }

#  $result=$ldap->bind( "uid=$name,$BASE_DN", password=>$password );
#  if(!defined ($ldap))
#  {
#    return "Can't bind";
#  }

  $ldap->{net_ldap_mesg}="";              # Try and stop mem leak
  $ldap->unbind();                        # unbind
  $ldap->disconnect();                    # disconnect

  ############# End of Leak Marker

  return undef;                           # return "undef" on success
}

------------------------------------------------------------------


----- Original Message -----
From: "Steven Carr" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 16, 2003 1:50 PM
Subject: Memory Leak


> Hello,
>        Im experiencing a memory leak problem with my Net::LDAP. I upgraded
> to the perl-ldap-0.29 bundle hoping it would stop it, but its still there.
> :(
> Can anybody see the problem in my script?
>
> The script is at the end of the email.
>
> When started I used top to see the memory used...
>
>    PID USERNAME THR PRI NICE  SIZE   RES STATE    TIME    CPU COMMAND
>  16112 root       1  41    0 5584K 5016K sleep    0:00  0.29% cut_down.pl
>
> Then I hit Enter once to loop it 50000 times. and the memory SIZE used
> increased to.... 10MB
>
>    PID USERNAME THR PRI NICE  SIZE   RES STATE    TIME    CPU COMMAND
>  16112 root       1   0    0   10M 9944K sleep    4:02  0.03% cut_down.pl
>
>
> When I comment out the lines in the scrpt between my # Memory Leak
comments,
> I do not get the leak.
>
> Im using Solaris 8, and have compiled Perl 5.8.0 and installed following
> modules...
>   perl-ldap-0.29.tar.gz   (version 28 was installed before, I installed 29
> over the top.)
>   Authen::SASL  -> Authen-SASL-2.04.tar.gz
>   IO::Socket::SSL -> IO-Socket-SSL-0.92.tar.gz
>        Net::SSLeay  -> Net_SSLeay.pm-1.23.tar.gz    -> needs
OpenSSL-0.9.6.b
> or newer.
>   URI::ldap  -> URI-1.23.tar.gz
>   Convert::ASN1  -> Convert-ASN1-0.17.tar.gz
>
> I built perl using
> sun4 # pkginfo -l SMCgcc
>    PKGINST:  SMCgcc
>       NAME:  gcc
>   CATEGORY:  application
>       ARCH:  sparc
>    VERSION:  3.2
>    BASEDIR:  /usr/local
>     VENDOR:  Free Software Foundation
>     PSTAMP:  Steve Christensen
>   INSTDATE:  Jun 16 2003 11:50
>      EMAIL:  [EMAIL PROTECTED]
>     STATUS:  completely installed
>      FILES:     1776 installed pathnames
>                   21 shared pathnames
>                    4 linked files
>                  136 directories
>                   43 executables
>               548584 blocks used (approx)
>
> sun4 # pkginfo -l SMClibgcc
>    PKGINST:  SMClibgcc
>       NAME:  libgcc
>   CATEGORY:  application
>       ARCH:  sparc
>    VERSION:  3.2
>    BASEDIR:  /usr/local/lib
>     VENDOR:  Free Software Foundation
>     PSTAMP:  Steve Christensen
>   INSTDATE:  Jun 16 2003 11:52
>      EMAIL:  [EMAIL PROTECTED]
>     STATUS:  completely installed
>      FILES:       25 installed pathnames
>                   15 shared pathnames
>                    1 directories
>                   10 executables
>               111319 blocks used (approx)
>
>
> Many Thanks,
>
> Steve.
> ----------
> Steven Carr,
> ISP Engineering,
> [EMAIL PROTECTED]
>
> ish GmbH & Co. KG
> Network Operations Center
> Michael-Schumacher-Str. 1
> 50170 Kerpen
>
>

Reply via email to