ispman/scripts ldifupdate,1.11,1.12

Joerg Delker <[email protected]>
Newsgroups gmane.comp.isp.ispman.cvs
Message-ID <[email protected]>
Update of /cvsroot/ispman/ispman/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4530/scripts

Modified Files:
	ldifupdate 
Log Message:
fixes handling of multi-line values
added check for proper encoding of ispmanVhostExtraConf value

Index: ldifupdate
===================================================================
RCS file: /cvsroot/ispman/ispman/scripts/ldifupdate,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- ldifupdate	30 May 2004 23:35:39 -0000	1.11
+++ ldifupdate	1 Jun 2004 00:07:25 -0000	1.12
@@ -14,6 +14,8 @@
 use Getopt::Std;
 use Net::LDAP::LDIF;
 use Net::LDAP::Entry;
+use HTML::Entities;
+use MIME::Base64;
 
 # defines
 my @oc_normalDomain       = qw(ispmanDomain PureFTPdUser posixAccount);
@@ -62,11 +64,23 @@
 
     # generate ldif change
     $ldif = "$cmd: $attr\n";
+    my $values;
     if ( ref $attrval eq "ARRAY" ) {
-        for (@$attrval) { $ldif .= "$attr: $_\n"; }
+        $values=$attrval;
     }
     else {
-        $ldif .= "$attr: $attrval\n";
+        $values=[$attrval];
+    }
+
+    for (@$values) {
+        # encode value if it contains linebreaks 
+        if ( $_ =~ /\n/ ) {
+            my $code=MIME::Base64::encode($_, "\n ");
+            $ldif .= "${attr}:: " . $code . "\n";
+        }
+        else {
+            $ldif .= "$attr: $_\n";
+        }
     }
 
     $ldif .= "-\n";
@@ -354,6 +368,14 @@
             ldif_action( "add", "loginshell", $default_vhostShell );
         }
 
+        # checking ispmanVhostExtraConf
+        my $extraconf = $entry->get_value("ispmanVhostExtraConf");
+        if ( $extraconf && $extraconf =~ /<.*>/) {
+            my $codedconf=HTML::Entities::encode($extraconf);
+            $msg .= "NOTICE: ispmanVhostExtraConf is not HTML encoded!\n";
+            $msg .= "changing: ispmanVhostExtraConf\n";
+            ldif_action( "replace", "ispmanVhostExtraConf", $codedconf );
+        }
     }
     elsif ( $oc{'ispmanDomainUser'} ) {
 



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.