From: Atif G. <ma...@us...> - 2001-02-06 15:19:48
|
Update of /cvsroot/ispman/ispman-utils/lib/ISPMan In directory usw-pr-cvs1:/tmp/cvs-serv15768 Modified Files: LDAP.pm Log Message: Adding a sub called fixLdif. This should check if an LDIF has a problem/extra spaces etc Index: LDAP.pm =================================================================== RCS file: /cvsroot/ispman/ispman-utils/lib/ISPMan/LDAP.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** LDAP.pm 2001/02/01 11:26:47 1.1 --- LDAP.pm 2001/02/06 15:20:03 1.2 *************** *** 29,32 **** --- 29,33 ---- deleteEntry getCount + fixLdif ); $VERSION = '0.01'; *************** *** 489,502 **** my $template=$self->getTemplate(join "/", ($self->SUPER::getConf("installDir") , "templates/domain.$domaintype.ldif.template")); ! my $text=$template->fill_in(PACKAGE => "ISPMan"); #print "\n<pre>$text\n</pre>"; tie *OUT, 'IO::Scalar', \$text; my $ldif = Net::LDAP::LDIF->new(\*OUT,"r"); ! open F, ">/tmp/$domain"; ! print F $text; ! close ("F"); while( my $entry = $ldif->read() ) { --- 490,504 ---- my $template=$self->getTemplate(join "/", ($self->SUPER::getConf("installDir") , "templates/domain.$domaintype.ldif.template")); ! my $text=$self->fixLdif($template->fill_in(PACKAGE => "ISPMan")); #print "\n<pre>$text\n</pre>"; tie *OUT, 'IO::Scalar', \$text; + my $ldif = Net::LDAP::LDIF->new(\*OUT,"r"); ! #open F, ">/tmp/$domain"; ! #print F $text; ! #close ("F"); while( my $entry = $ldif->read() ) { *************** *** 513,516 **** --- 515,530 ---- } return; + } + + + sub fixLdif { + my $self=shift; + my $ldif_text=shift; + + $ldif_text=~s/dn:/\ndn:/g; + $ldif_text=~s/\n\n\n+?dn/\n\ndn/g; + $ldif_text=~s/^\n//g; + chomp($ldif_text); + return $ldif_text; } |