[imp] IMP, Quotas, Courier-IMAP and LDAP

eculp@encontacto.net eculp@encontacto.net
Wed Nov 27 20:47:12 2002


Quoting Brian Clark <bclark@protocolusa.com>:

 | Yes, that is what I was thinking as well. Some sort of shell script to
 | go through and remove the maildirsize file from all of the users'
 | Maildir folder. However, I am not very good at shell scripting. Same
 | with the LDAP thing. I'd have to modify the mailQuota attribute of every
 | user, and I am not sure how to do that. Would you mind sharing how you
 | did this with LDAP? I use OpenLDAP 2.0.23, if that makes a difference.

Not really.  The problem is that I don't keep those scripts because I've 
found that it usually takes me longer to find it than to write a new one.
Since I didn't plan o doing it again I didn't "bullitproof" it and save it.

I will give you a couple here that you should be able to modify and use.

First lets change the quota.

This is a real hack it is definitely not for production but it should work
for this one time even though not very efficient.

# START
ldapsearch -x -D 'cn=manager,o=YOURDOMAIN.COM' -w yourPassword \
'mailQuota=*' dn |egrep -v '^#|^[       ]*$|^version|^search|^result' \
| while read line
  do
    ldapmodify  -x -D 'cn=manager,o=YOURDOMAIN' -w yourPassword<<%
      $line
      changetype: modify
      replace: quota
      mailQuota: 250000000S
%
done
# END

The first line is split and is composed of the first three lines in this 
email.  The egrep -v was an ugly hack to remove extra lines in the result:
  o- the version of openldap 
  o- the lines that begin with 
     * # 
     * version 
     * search 
     * result
  o- blank lines.  

You could also substitute a value for the * in mailQuota to search for
only a specific quota.  This searches for all who have a mailQuota assigned.

This script outputs the dn's that have a mailquota assigned and pipes
them to the while loop and the here documment that actually modifies the 
individual records.

You will want to change your rootdn, password and mailQuota, unless you want
to make your users very happy with a lot of space;-)

To erase the maildirsize simply use find.

# find /usr/virtual -name maildirsize -delete

or if you want to accept all 2000 you could use -ok but I doubt it.

If you have any questions, let me know.

I hope this helps,

ed


-------------------------------------------------



More information about the imp mailing list