Solved

How to connect the directory service of exchange server?

Posted on 2001-07-13
30
669 Views
Last Modified: 2007-12-19
How to connect the directory service of exchange server?

I am using Windows NT 4.0 server , iPlanet Enterprise server 4.1 Web Server and Active Perl 5.6

I have tried to install the Perl-LDAP  modules.
However, there are a synate error in the modules, that mean it cannot work.

Thus, is there any other method to do it.
I just need to the use email address to search alias from the exchange server.
0
Comment
Question by:cstsang
  • 15
  • 12
  • +2
30 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6280959
does the Exchange Server listen on port 389?
Could you please post the erros.
0
 
LVL 7

Author Comment

by:cstsang
ID: 6281313
Yes, I can use the outlook express to connect to it.
The error message is something like "Compilation error in XXX.pm"
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6281624
> Yes, I can use the outlook express to connect to it.
Are you shure that Outllok uses the LDAP port to connect, I won't believe.

> .. something like Compilation error"
well is it red or green @~(

Would you please post exact messages, if you realy expect help.
perl is very noisy about error messages: module name, line#, and other details.
0
 
LVL 7

Author Comment

by:cstsang
ID: 6282856
>Are you shure that Outllok uses the LDAP port to connect, I won't believe.

Yes, I check it in the properties page. It use 389 port.Also, I am using "outlook express" not outlook.

About the error message, I will give you when I back to the office.(today is sunday).
0
 
LVL 7

Author Comment

by:cstsang
ID: 6284429
Sorry to bother you, the error message is that:
Can't locate Convert/ASN1.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/site/li
b .) at C:/Perl/site/lib/Net/LDAP.pm line 11.
BEGIN failed--compilation aborted at C:/Perl/site/lib/Net/LDAP.pm line 11.
Compilation failed in require at E:\html\cgi-bin\LDAP.pl line 1.
BEGIN failed--compilation aborted at E:\html\cgi-bin\LDAP.pl line 1.
0
 
LVL 7

Author Comment

by:cstsang
ID: 6284450
I have install the convert-asn1 module.
However, it return nothing.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6285162
you euther need to install the module in one of the paths known by @INC, or you need to extend @INC with the path where you installed the module.
   push( @INC, '/your/path/to/module' );
0
 
LVL 7

Author Comment

by:cstsang
ID: 6285188
After install the asn1 modules, the error message is disappear. Also, I can platform search. However, I still cannot get any result from the exchange server. I think it may be the convention problem
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6285403
again, posting more information (part of script, error messages, etc.) might help ;-)
0
 
LVL 7

Author Comment

by:cstsang
ID: 6288130
In fact, there are no error message return.
It just return nothing.
#!c:\perl\bin\perl
print "Content-type: text/html\n\n";
use Net::LDAP qw(:all);                      # use for all code

$ldap = Net::LDAP->new('myserver',async => 1) or die "$@";
#$mesg = $ldap->bind( version => 3 );         # use for searches
$ldap->bind ;
$mesg = $ldap->search (  # perform a search
                        base   => "c=US,o=CLK",
                        filter => "(&(cn=c s tsang))"
                       );
 
#$mesg->code && die $mesg->error;
$i=0;
print "Hello<br>";print ++$i;
foreach $entry ($mesg->all_entries)
  {    
       $entry->dump;
  }
$ldap->unbind;   # take down session
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6290172
- does the script work from commandline, not within your webserver?
- what does
       $mesg->code && die $mesg->error;
  tell you (commented out above)
- I'm not shure if
        filter => "(&(cn=c s tsang))"
  works 'cause of the blanks, probably try
         filter => "(&(cn=*tsang))"
  or escape the blanks
0
 
LVL 7

Author Comment

by:cstsang
ID: 6367114
I have followed your instruction to adjust my program.
However, it still return nothing.

Here is my code:
#!c:\perl\bin\perl
print "Content-type: text/html\n\n";
use Net::LDAP qw(:all);                      # use for all code

$ldap = Net::LDAP->new('AAHOES',async => 1) or die "$@";
#$mesg = $ldap->bind( version => 3 );         # use for searches
$ldap->bind ;
$mesg = $ldap->search (  # perform a search
                        base   => "c=US,o=HKAIRPORT,ou=CLK,cn=Recipients",
                        filter => "(&(cn=*tsang))"
                       );
 
#$mesg->code && die $mesg->error;
$i=0;
print "Hello<br>";
##print ++$i;
foreach $entry ($mesg->all_entries)
  {    
       $entry->dump;
  }
$ldap->unbind;   # take down session
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6367174
> I have followed your instruction to adjust my program.
and what was the output of   $mesg->code and $mesg->error ?
 
0
 
LVL 7

Author Comment

by:cstsang
ID: 6367192
It return :
DSA is unwilling to perform at my_file_name line 13
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6367236
is this all what you get from Active Perl? useless!
line 13 is a comment.
If you count only perl statements, it's the $entry->dump;  which makes sence according to the message.
That's 'cause you do a anonimous bind, probably.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 7

Author Comment

by:cstsang
ID: 6367268
If I comment line 13, nothing return.
If I uncomment line 13 ,return the previous error.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6367308
what exactly is "line 13"?
A real perl interpreter list the cpmplete line.
Could you please be more specific.
0
 
LVL 7

Author Comment

by:cstsang
ID: 6367318
Line 13 content is:
$mesg->code && die $mesg->error;
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6371519
that could not be, 'cause this line is commented out (in what you posted here) !
0
 
LVL 7

Author Comment

by:cstsang
ID: 6427499
I have another coding which return error message="SET decode not implemented".
Here is the code:
use strict;
use Net::LDAP;

my $ldap_server = "server_name";
my $BASEDN = "o=HKAIRPORT, c=*";

my @fields = qw(cn mail sn givenname);

my $ldap = Net::LDAP->new($ldap_server) or die "$@";

$ldap->bind;

my @result;

foreach my $ask_for (@ARGV) {
    my $query = join '', map { "($_=$ask_for*) " } @fields;
    my $mesg = $ldap->search(base => $BASEDN, filter => "(|$query)");
    $mesg->code && die $mesg->error;
    foreach my $entry ($mesg->all_entries) {
        my $mail = $entry->get_value('mail');
        my $name = $entry->get_value('givenName') . " " . $entry->get_value('sn');
        my $telephone = $entry->get_value('telephoneNumber');
        push(@result, "$mail\t$name\t$telephone");
    }
}
print "LDAP query: found ", scalar(@result), "\n";
print join "\n", @result;

exit 1 if ! @result;

$ldap->unbind;
0
 
LVL 7

Author Comment

by:cstsang
ID: 6427541
The file name of about the file is ldap.pl.
If I execute the file in command line using "ldap sn=c s", it return "Admin Limit exceeded at line 18".
Here is the content of line 18:

$mesg->code && die $mesg->error;


0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6427901
which problem should be solved?
0
 
LVL 7

Author Comment

by:cstsang
ID: 6427990
I just want to know the meaning of "Admin Limit exceeded".
0
 
LVL 7

Author Comment

by:cstsang
ID: 6439885
This is another piece of code:
use Net::LDAP;
$server='my_exchange_server';
$ldap = Net::LDAP->new($server) or die "$@";
$ldap->bind('cn=my_nt_username,cn=my_org', password=>'my_nt_password');
$mesg = $ldap->search(
                       base   => "cn=Recipients,ou=my_site,o=my_org",
                       filter => "cn=my_alias_in_exchange_ server",
                      );

  $mesg->code && die $mesg->error;
  print $mesg->code."\n";
  my $max = $mesg->count;
  print $max;
  for( my $index = 0 ; $index < $max ; $index++)
  {
    my $entry = $mesg->entry($index);
    foreach my $attr ($entry->attributes)
      {
        foreach my $value ($entry->get_value($attr))
          {
            print $attr, ": ", $value, "\n";
          }
      }
  }
undef $ldap;

It return 0(no error) and 0 (0 entry found)
However, if I change "cn=my_alias_in_exchange_ server" to "rdn=my_alias_in_exchange_ server", it return "SET decode not implemented"
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6440088
hmm, I'm out of ideas 'cause I never used M$'s Exchange as LDAP server.

Do you have a ldapsearch command? then try to connect to your Exchange server and check if it works.
If you prefer GUIs, use Netscape browser to connect to the LDAP server, like:
     ldap://ldap_server/cn=Recipients,ou=my_site,o=my_org
0
 
LVL 7

Author Comment

by:cstsang
ID: 6443208
Ok
What is "ldapsearch command"?
Do you mean perl command?
Well!can give me resource that related to "how to connect exchange server directory service using"?
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 100 total points
ID: 6444480
oops, ldapsearch comes with the LDAP libs on UNIX systems. Not shure if there exist one for M$.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6855439
AMINISTRATION WILL BE CONTACTING YOU SHORTLY REGARDING YOUR OPEN AND ABANDONED QUESTIONS, SOME AS OLD AS THE YEAR 2000.

Question(s) below appears to have been abandoned. Your options are:
 
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Please click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site.  If you are an EE Pro user, use the Power Search option to find them.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.11069265.html
http://www.experts-exchange.com/questions/Q.20075870.html
http://www.experts-exchange.com/questions/Q.20088543.html
http://www.experts-exchange.com/questions/Q.20115980.html
http://www.experts-exchange.com/questions/Q.11641318.html
http://www.experts-exchange.com/questions/Q.20146081.html
http://www.experts-exchange.com/questions/Q.20150364.html
http://www.experts-exchange.com/questions/Q.20180820.html
http://www.experts-exchange.com/questions/Q.20202235.html
http://www.experts-exchange.com/questions/Q.20226705.html
http://www.experts-exchange.com/questions/Q.20251551.html
http://www.experts-exchange.com/questions/Q.20255676.html
http://www.experts-exchange.com/questions/Q.20262636.html
http://www.experts-exchange.com/questions/Q.20272875.html


To view your locked questions, please click the following link(s) and evaluate the proposed answer.
http://www.experts-exchange.com/questions/Q.11483199.html

PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:  Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.  Also, if you are interested in the cleanup effort, please click this link http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange

P.S.  For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
0
 

Expert Comment

by:RotaredoM
ID: 8241838
cstsang,

It seems that you made it a habit not resolving your old questions.

You are requeried to follow the instructions I gave you at http://www.experts-exchange.com/Q_20410648.html !!!

Please consider this as last warning!

If you don't resolve ALL your old open questions within the next 72 Hrs, then steps will be taken to permanently suspend your account at EE.

To see the full list of your open questions, click on your member name link, located at the top left corner of each page, or click on the following links:
First asked questions page: http://www.experts-exchange.com/memberProfile.jsp?mbr=cstsang
Second asked questions page: http://www.experts-exchange.com/memberProfile.jsp?mbr=cstsang&showQHistory=true&qAskBegin=51&qAskEnd=100#1

If you need any help resolving the questions, you should post a 0 (zero) points question at Community Support Topic Area http://www.experts-exchange.com/Community_Support/ and we'll be happy to assist.

Thank you,

RotaredoM
CS Mod @ EE
0
 
LVL 20

Expert Comment

by:jmcg
ID: 9482459
Nothing has happened on this question in over 12 months.
I will leave a recommendation in the Cleanup topic area that
the answer by ahoffman be accepted (A for effort even if no
complete solution was found).

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now