Problem with setting ACLs on Cyrus (using perl)

Thomas Stather thomas.stather at sit.fraunhofer.de
Fri Jul 4 03:42:50 EDT 2008


Hello guys

ive written a small perl-script to hirachically delete a users mailbox:


#! /usr/bin/perl
# DELETE USERS MAILBOX #
use IMAP::Admin;
use Crypt::CBC;
use strict;
my $user,
my $input;
my $seconds=5;
my $i;
my $imap;
my @list;
my $err;
my $argc;
my $pw_clear;
$argc = @ARGV;
if ( $argc != "1" ) {
  print "ungueltige Anzahl von Parametern angegeben\n";
  exit 1;
}
else {
  open(FILE,"<password") || die ("Die Datei kann nicht geoeffnet 
werden,\nFehler: $!}n");
  my $cipher = Crypt::CBC->new(
           -key => "xxxxxxxxxxxxxx",
           -cipher => "Crypt::OpenSSL::AES"
  );
  $user= shift(@ARGV);
  print "lösche die Mailbox des Users $user, Abbrechen mit Escape, 
weiter mit Enter\n";
  $input=<STDIN>;
  chomp($input);
  if ( $input eq "\e" ) {
    print "Script wird beendet\n";
    exit 1;
  }
  else {
    $imap = IMAP::Admin-> new('Server' => 'mailint',
                             'Login' => 'root',
                            'Password' => eval { 
$cipher->decrypt(<FILE>);} );
    close (FILE);
    eval {
     $err = $imap->set_acl("user.".$user, "root", "lrswipdca");
    };
    if ($err != 0) {
      print "$imap->{'Error'}\n";
      print "$imap->error\n";
      exit 1;
    }
    print "ACL erfolgreich gesetzt\n";
    }
    eval {
     $err = $imap->h_delete("user.".$user);
     $imap->close;
    };
    if ($err != 0) {
      print "$imap->{'Error'}\n";
      print "$imap->error\n";
      exit 1;
    }
    exit 0;
}


this will set the ACL for the root mailbox which is then able to be 
deleted, but not for the subfolders. How can i do this in perl (because 
then i can use the h_delete method to hirachically delete the mailbox)?


Greets

Thomas Stather

Thomas Stather, Fraunhofer SIT
Rheinstrasse 75, 64295 Darmstadt, Germany
Tel: +49 (0) 6151 86960058
http://sit.fraunhofer.de


More information about the Cyrus-devel mailing list