sendmail to exchange w/ldap problem slightly OT SOLVED

Steven Andrews sandrews at andrewscompanies.com
Tue Nov 4 18:29:37 GMT 2008


I gave up on 4.7; found a way to install 4.3 on another box and shovel
that drive into the R200.  Now it works.

 

Goofy computers.

 

From: mailscanner-bounces at lists.mailscanner.info
[mailto:mailscanner-bounces at lists.mailscanner.info] On Behalf Of Steven
Andrews
Sent: Tuesday, November 04, 2008 9:29 AM
To: MailScanner discussion
Subject: RE: sendmail to exchange w/ldap problem slightly OT

 

I've seen that but haven't played with it.  The implementation I've used
quite a number of times, but seemingly doesn't want to play ball on
centos 4.7 (probably a perl thing, but I'm a perl-idiot), works well for
us.  I like it because it doesn't talk to the exchange box very often so
if for whatever reason it can't nothing bounces except addresses that
may have changed  on the exchange side since that last time they talked.

 

It appears that it's complaining about the declaration and/or use of the
variables, but I didn't write the code in the first place and couldn't
perl myself out of a paper bag so I'm a little stuck as to why it's
kosher on 4.3 but fails on 4.7.

 

From: mailscanner-bounces at lists.mailscanner.info
[mailto:mailscanner-bounces at lists.mailscanner.info] On Behalf Of
Martin.Hepworth
Sent: Tuesday, November 04, 2008 9:13 AM
To: MailScanner discussion
Subject: RE: sendmail to exchange w/ldap problem slightly OT

 

Stephen

 

what ware you trying to achieve here? If you want to know if the end
email address exists before accepting the email in the incoming sendmail
then sendmail Sender Address Verification
(http://smfs.sourceforge.net/smf-sav.html) will do this for you..

--
Martin Hepworth
Snr Systems Administrator
Solid State Logic
Tel: +44 (0)1865 842300 

 

	 

	
________________________________


	From: mailscanner-bounces at lists.mailscanner.info
[mailto:mailscanner-bounces at lists.mailscanner.info] On Behalf Of Steven
Andrews
	Sent: 04 November 2008 13:58
	To: MailScanner discussion
	Subject: sendmail to exchange w/ldap problem slightly OT

	I've been using a hunk of code to have MS/Sendmail query
exchange 2000/2003 boxes for some time with no problems.  Today, I'm
setting up a nice little dell R200 and so I had to use Centos4.7 over my
default 4.3 to get sata support.  

	 

	Any help, much appreciated...

	 

	When I run the code, I get this silliness:

	 

	[root at spamfilter mail]# ./sendmail-ldap.sh

	Name "main::EMAILS" used only once: possible typo at
./sendmail-ldap.sh line 57, <DATA> line 275.

	Name "main::DOMAINS" used only once: possible typo at
./sendmail-ldap.sh line 60, <DATA> line 275.

	starting ./sendmail-ldap.sh at Tue Nov  4 08:55:00 EST 2008

	Undefined subroutine &main::extract_emails called at
./sendmail-ldap.sh line 51, <DATA> line 466.

	[root at spamfilter mail]#

	  

	 

	Code here:

	#!/usr/bin/perl -w

	 

	use strict;

	use Net::LDAP;

	 

	print "starting $0 at ", `date`;

	 

	my $debug = 0;

	my %mails = ();

	my $hostname = `hostname -f`;

	chomp $hostname;

	my %domains = ($hostname => 1);

	my $dir = "/etc/mail";

	 

	my $emails_file = "$dir/temp-emails";

	my $domains_file = "$dir/temp-domains";

	my $access_file = "$dir/access";

	my @prefixes = ("postmaster", "abuse", "root");

	my @servers =

	(     "mail.boogidy.com"

	);

	 

	sub extract_emails($);

	 

	my $ldap = undef;

	my $mesg = undef;

	 

	for my $server (@servers)

	{       print STDERR "Connecting to server $server...\n" if
$debug;

	        $ldap = Net::LDAP->new( $server ) and last;

	}

	 

	$ldap or die "Unable to connect to any LDAP servers.";

	 

	print STDERR "Binding...\n" if $debug;

	$mesg = $ldap->bind(

	        dn => 'BOOGIDY\Administrator',

	        password => 'redacted'

	) or die "Could not bind LDAP: $@";

	 

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

	 

	print STDERR "Searching...\n" if $debug;

	$mesg = $ldap->search(

	        base   => "dc=boogidy,dc=local",

	        filter =>
"(|(objectClass=publicFolder)(&(sAMAccountName=*)(mail=*)))"

	);

	 

	print STDERR "Checking code...\n" if $debug;

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

	extract_emails($mesg);

	 

	print STDERR "Unbinding...\n" if $debug;

	$mesg = $ldap->unbind;   # take down session

	 

	open EMAILS, "> $emails_file"

	        or die("Could not open > $emails_file\n$!");

	 

	open DOMAINS, "> $domains_file"

	        or die("Could not open > $domains_file\n$!");

	 

	open ACCESS, "> $access_file"

	        or die("Could not open > $access_file\n$!");

	 

	print ACCESS << "END";

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

	#

	# This access database is generated by $0

	#

	# This is regenerated by a cron job

	# Any change you make will be wiped out!

	#

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

	 

	# Check the /usr/share/doc/sendmail/README.cf file for a
description

	# of the format of this file. (search for access_db in that
file)

	# The /usr/share/doc/sendmail/README.cf is part of the
sendmail-doc

	# package.

	#

	# by default we allow relaying from localhost...

	Connect:localhost               RELAY

	Connect:127.0.0.1               RELAY

	GreetPause:127.0.0.1       0

	ClientConn:127.0.0.1       0

	ClientConn:                10

	 

	END

	 

	Steven R. Andrews, President 
	Andrews Companies Incorporated 
	Small Business Information Technology Consultants 
	sandrews at andrewscompanies.com 
	Phone: 317.536.1807

	"If your only tool is a hammer, every problem looks like a
nail." 


********************************************************************** 
Confidentiality : This e-mail and any attachments are intended for the 
addressee only and may be confidential. If they come to you in error 
you must take no action based on them, nor must you copy or show them 
to anyone. Please advise the sender by replying to this e-mail 
immediately and then delete the original from your computer. 
Opinion : Any opinions expressed in this e-mail are entirely those of 
the author and unless specifically stated to the contrary, are not 
necessarily those of the author's employer. 
Security Warning : Internet e-mail is not necessarily a secure 
communications medium and can be subject to data corruption. We advise 
that you consider this fact when e-mailing us. 
Viruses : We have taken steps to ensure that this e-mail and any 
attachments are free from known viruses but in keeping with good 
computing practice, you should ensure that they are virus free. 

Red Lion 49 Ltd T/A Solid State Logic 
Registered as a limited company in England and Wales 
(Company No:5362730) 
Registered Office: 25 Spring Hill Road, Begbroke, Oxford OX5 1RU, 
United Kingdom 
********************************************************************** 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mailscanner.info/pipermail/mailscanner/attachments/20081104/ad5ed549/attachment.html


More information about the MailScanner mailing list