ispman/bin ispman.ldifupdate,1.8,1.9

Joerg Delker <[email protected]> Tue, 31 Jul 2007 07:17:15 +0000
Newsgroups gmane.comp.isp.ispman.cvs
Message-ID <[email protected]>
Update of /cvsroot/ispman/ispman/bin
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv24365/bin

Modified Files:
	ispman.ldifupdate 
Log Message:
fixed bug [ 1754330 ] After Upgr. non-PAB branch to PAB Branch,add user throws err


Index: ispman.ldifupdate
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.ldifupdate,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ispman.ldifupdate	11 Jun 2007 12:16:20 -0000	1.8
+++ ispman.ldifupdate	31 Jul 2007 07:17:12 -0000	1.9
@@ -128,6 +128,37 @@
     return $msg;
 }
 
+# check for PAB tree
+sub check_pabtree {
+    my $domain = shift;
+
+    my $msg          = "";
+    my $ispmanDomain = $domain->get_value("ispmanDomain");
+
+    my $entry = $ispman->getEntry(
+        "ou=pabs,".$ispman->{'Config'}{'ldapBaseDN'},
+        "ou=$ispmanDomain",
+        "dn", "one"
+    );
+
+    if ( !$entry ) {
+        # add new pab entry
+        $entry = Net::LDAP::Entry->new;
+
+        $entry->dn( "ou=$ispmanDomain,ou=pabs,"
+              . $ispman->{'Config'}{'ldapBaseDN'} );
+        $entry->add(
+            objectclass => 'organizationalUnit',
+            ou          => $ispmanDomain
+        );
+
+        $OUT->write_entry($entry);
+        $msg .= "creating new pab entry for domain $ispmanDomain\n";
+    }
+
+    return $msg;
+}
+
 #
 # checking RDN
 #
@@ -225,7 +256,7 @@
     # check objectclass
     $msg .= check_objectclass($entry);
 
-    # update ispmanDomain objectclasses
+    # update non-replica domains
     if ( $entry->get_value("ispmanDomainType") ne "replica" ) {
 
         # check ispmanDomainDefaultFileServer attribute
@@ -311,6 +342,9 @@
                 }
             }
         }
+
+        # check domain's pab tree
+        $msg .= check_pabtree($entry);
     }
 
     return $msg;
@@ -620,6 +654,25 @@
 print STDERR "default_domainShell = "
   . $ispman->{'Config'}{'default_domainShell'} . "\n";
 
+### UPDATE ###
+
+# try to fetch install ldif and look for new/changed entries
+my $install_ldif =
+    "cat $ispman->{'Config'}{'installDir'}/conf/ldif/ispman.ldif|"
+  . "$ispman->{'Config'}{'installDir'}/bin/ispman.substConf|";
+
+my $ldif = Net::LDAP::LDIF->new($install_ldif);
+print STDERR "WARNING: Can't open $install_ldif" unless $ldif;
+
+print STDERR "\nChecking for missing ISPMan entries ...\n";
+while ( not $ldif->eof() ) {
+    my $entry = $ldif->read_entry();
+    if ( !$ispman->branchExists( $entry->dn ) ) {
+        $msg = "adding missing entry " . $entry->dn;
+        commit( $entry, $msg );
+    }
+}
+
 ### CHECKS ###
 
 # checking objectclasses
@@ -687,24 +740,6 @@
     }
 }
 
-### UPDATE ###
-
-# try to fetch install ldif and look for new/changed entries
-my $install_ldif =
-    "cat $ispman->{'Config'}{'installDir'}/conf/ldif/ispman.ldif|"
-  . "$ispman->{'Config'}{'installDir'}/bin/ispman.substConf|";
-
-my $ldif = Net::LDAP::LDIF->new($install_ldif);
-print STDERR "WARNING: Can't open $install_ldif" unless $ldif;
-
-print STDERR "\nChecking for missing ISPMan entries ...\n";
-while ( not $ldif->eof() ) {
-    my $entry = $ldif->read_entry();
-    if ( !$ispman->branchExists( $entry->dn ) ) {
-        $msg = "adding missing entry " . $entry->dn;
-        commit( $entry, $msg );
-    }
-}
 
 $OUT->done();
 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/