ispman/bin ispman.createMailbox, 1.5, 1.5.6.1 ispman.createSubMailbox, 1.3, 1.3.6.1 ispman.deleteUser, 1.3, 1.3.6.1 ispman.setMailboxQuota, 1.4, 1.4.6.1

Joerg Delker <[email protected]>
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-serv11362/bin

Modified Files:
      Tag: dev_1_3-cyrus_virtdomain
	ispman.createMailbox ispman.createSubMailbox ispman.deleteUser 
	ispman.setMailboxQuota 
Log Message:
applied s0undt3ch's patch for cyrus virtudomain feature


Index: ispman.setMailboxQuota
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.setMailboxQuota,v
retrieving revision 1.4
retrieving revision 1.4.6.1
diff -u -d -r1.4 -r1.4.6.1
--- ispman.setMailboxQuota	30 May 2004 23:35:32 -0000	1.4
+++ ispman.setMailboxQuota	8 Sep 2006 13:15:38 -0000	1.4.6.1
@@ -11,7 +11,29 @@
 }
 require "cyrusadmin.pm";
 
-$mailbox = join "", ( $mailbox_prefix, $ARGV[0] );
+sub email2uid {
+    my $str = shift;
+    ( $uid, $domain ) = split( '@', $str );
+    if ( $ISPMan::Config->{'AllowFullEmailLogins'} ) {
+        if ( $ISPMan::Config->{'CyrusUnixHierarchySep'} ) {
+            if ($uid) {
+                $uid =~s/\./\\./g;
+            }
+        }
+        if ($domain) {
+            $domain =~ s/\./\\./g;
+            $str = join '\@', ( $uid, $domain );
+        }
+    } else {
+        if ($domain) {
+            $domain =~ s/\./_/g;
+            $str = join '_', ( $uid, $domain );
+        }
+    }
+    return $str;
+}
+
+$mailbox = join "", ( $mailbox_prefix, email2uid($ARGV[0]) );
 $quota = $ARGV[1];
 try( $imap->set_quota( $mailbox, $quota ) );
 

Index: ispman.deleteUser
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.deleteUser,v
retrieving revision 1.3
retrieving revision 1.3.6.1
diff -u -d -r1.3 -r1.3.6.1
--- ispman.deleteUser	30 May 2004 23:35:31 -0000	1.3
+++ ispman.deleteUser	8 Sep 2006 13:15:38 -0000	1.3.6.1
@@ -20,8 +20,16 @@
 ( $user, $domain ) = split( '@', $ARGV[0] );
 $ispmanDomain = $domain;
 
-$domain =~ s/\./_/g;
-$uid = join '_', ( $user, $domain );
+if ( $ISPMan::Config->{'AllowFullEmailLogins'} ) {
+    if ( $ISPMan::Config->{'CyrusUnixHierarchySep'} ) {
+        $user = ~s/\./\\./g;
+    }
+    $domain =~ s/\./\\./g;
+    $uid = join '\@', ( $user, $domain );
+} else {
+    $domain =~ s/\./_/g;
+    $uid = join '_', ( $user, $domain );
+}
 
 my $dn = $ispman->getUserDN( $ispmanDomain, $uid );
 if ( $ispman->entryExists($dn) ) {

Index: ispman.createMailbox
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.createMailbox,v
retrieving revision 1.5
retrieving revision 1.5.6.1
diff -u -d -r1.5 -r1.5.6.1
--- ispman.createMailbox	30 May 2004 23:35:31 -0000	1.5
+++ ispman.createMailbox	8 Sep 2006 13:15:38 -0000	1.5.6.1
@@ -26,9 +26,21 @@
 sub email2uid {
     my $str = shift;
     ( $uid, $domain ) = split( '@', $str );
-    if ($domain) {
-        $domain =~ s/\./_/g;
-        $str = join '_', ( $uid, $domain );
+    if ( $ISPMan::Config->{'AllowFullEmailLogins'} ) {
+        if ( $ISPMan::Config->{'CyrusUnixHierarchySep'} ) {
+            if ($uid) {
+                $uid =~s/\./\\./g;
+            }
+        }
+        if ($domain) {
+            $domain =~ s/\./\\./g;
+            $str = join '\@', ( $uid, $domain );
+        }
+    } else {
+        if ($domain) {
+            $domain =~ s/\./_/g;
+            $str = join '_', ( $uid, $domain );
+        }
     }
     return $str;
 }

Index: ispman.createSubMailbox
===================================================================
RCS file: /cvsroot/ispman/ispman/bin/ispman.createSubMailbox,v
retrieving revision 1.3
retrieving revision 1.3.6.1
diff -u -d -r1.3 -r1.3.6.1
--- ispman.createSubMailbox	5 Jun 2004 12:45:18 -0000	1.3
+++ ispman.createSubMailbox	8 Sep 2006 13:15:38 -0000	1.3.6.1
@@ -28,6 +28,7 @@
 
 my $uid_filter = $ARGV[0];
 my $folder     = $ARGV[1];
+my $sep         = '';
 
 my $users = $ispman->getEntriesAsHashRef( $ispman->{'Config'}{'ldapBaseDN'},
     "&(objectclass=ispmanDomainUser)(uid=$uid_filter)" );
@@ -37,18 +38,35 @@
     $uid     = $uids[0];
     $mailbox = join "", ( $mailbox_prefix, $uid );
     if ( $imap->list($mailbox) ) {
-
         # mailbox exists. Lets continue
+        if ( $ISPMan::Config->{'AllowFullEmailLogins'} ) {
+            if ( $ISPMan::Config->{'CyrusUnixHierarchySep'} ) {
+                $sep = '/';
+            } else {
+                $sep = '.';
+            }
+            ( $tuid, $tdomain ) = split( '@', $uid );
+            $mailbox = join "", ( $mailbox_prefix, $tuid );
+            if ( $imap->list( join '', ( $mailbox, $sep, $folder, '@', $tdomain ) ) ) {
+                # Already Exists
+                print "$folder on $mailbox\@$tdomain already exists. Skipping\n";
+            } else {
+                my $tmailbox = join '', ( $mailbox, '@', $tdomain );
+                try( $imap->set_acl( $tmailbox, $admin, "lrswipdca" ) );
+                print "Creating $folder on $mailbox\@$tdomain\n";
+                my $tmailbox = join '', ( $mailbox, $sep, $folder, '@', $tdomain );
+                try( $imap->create( $tmailbox ) );
+            }
+        } else {
+            if ( $imap->list( join '.', ( $mailbox, $folder ) ) ) {
+                # Already Exists
 
-        if ( $imap->list( join '.', ( $mailbox, $folder ) ) ) {
-
-            # Already Exists
-            print "$folder on $mailbox already exists. Skipping\n";
-        }
-        else {
-            try( $imap->set_acl( $mailbox, $admin, "lrswipdca" ) );
-            print "Creating $folder on $mailbox\n";
-            try( $imap->create( join '.', ( $mailbox, $folder ) ) );
+                print "$folder on $mailbox already exists. Skipping\n";
+            } else {
+                try( $imap->set_acl( $mailbox, $admin, "lrswipdca" ) );
+                print "Creating $folder on $mailbox\n";
+                try( $imap->create( join '.', ( $mailbox, $folder ) ) );
+            }
         }
 
     }


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
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.