|
From: Jamie C. <jca...@we...> - 2006-08-22 17:23:08
|
On 22/Aug/2006 01:15 Murray Trainer wrote ..
> On Thu, 2006-08-17 at 17:59 -0700, Jamie Cameron wrote:
> > On 17/Aug/2006 02:07 Murray Trainer wrote ..
> > > On Tue, 2006-08-15 at 09:55 -0700, Jamie Cameron wrote:
> > > > On 15/Aug/2006 03:06 Murray Trainer wrote ..
> > > > > On Sun, 2006-07-23 at 22:20 -0700, Jamie Cameron wrote:
> > > > > > On 23/Jul/2006 18:55 Murray Trainer wrote ..
> > > > > > > On Fri, 2006-07-21 at 12:37 -0700, Jamie Cameron wrote:
> > > > > > > > On 19/Jul/2006 19:02 Murray Trainer wrote ..
> > > > > > > > > Hi Jamie,
> > > > > > > > >
> > > > > > > > > Thanks for all your modifications to this module to date.
> > > I haven't
> > > > > > > > > asked for anything for a while so here goes :-) The module
> > > currently
> > > > > > > > > has a hard coded IMAP quota value in its config which has
> been
> > > > > fine
> > > > > > > > > until now. We now need to create different classes of
> users
> > > with
> > > > > > > > > different IMAP quotas. We use the Cyrus IMAP module for
> maintaining
> > > > > > > > > user mailboxes but want to keep the user creation process
> to
> > > a
> > > > > single
> > > > > > > > > step. An IMAP quota field in the user creation/edit screen
> > > that
> > > > > can
> > > > > > > > > override the module's default IMAP quota would be really
> helpful.
> > > > > > > > >
> > > > > > > > > It appears you use the NET::IMAP perl module in ldap-useradmin-lib.pl.
> > > > > > > > > The code you use to set the user's quota in save_user.cgi
> is:
> > > > > > > > >
> > > > > > > > > if ($config{'quota'}) {
> > > > > > > > > # Set his IMAP quota
> > > > > > > > > $rv = $imap->setquota("user.".$user,
> > > > > > > > > "STORAGE", $config{'quota'});
> > > > > > > > > $rv->{'Status'} eq 'ok' ||
> > > > > > > > > &imap_error($text{'usave_eiquota'},
> > > $rv);
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > > I would assume you could use the getquota function described
> > > below
> > > > > > > to
> > > > > > > > > get the current quota on the mailbox.
> > > > > > > > >
> > > > > > > > > http://search.cpan.org/~kjohnson/NetxAP-0.02/Net/IMAP.pm#getquota_%
> > > > > > > > > 24quotaroot
> > > > > > > > >
> > > > > > > > > Hope you're not too busy to have a look at this one if
> you
> > > think
> > > > > it's
> > > > > > > a
> > > > > > > > > reasonable idea.
> > > > > > > >
> > > > > > > > That is quite a good idea, and I have just added it to the
> module.
> > > > > However
> > > > > > > > I don't actually run a Cyrus IMAP server myself, so I can't
> fully
> > > > > test
> > > > > > > it!
> > > > > > > > But you can, by downloading the module from :
> > > > > > > >
> > > > > > > > http://www.webmin.com/updates/ldap-useradmin-1.290-4.wbm.gz
> > > > > > > >
> > > > > > > > Let me know how it goes.
> > > > > > > >
> > > > > > > > - Jamie
> > > > > > >
> > > > > > > I upgraded the ldap-useradmin from 1.273 to the above. It brings
> > > up
> > > > > the
> > > > > > > add user form with the default quota OK but I get the error
> below
> > > when
> > > > > > > saving the user. Not sure where that problem slipped in -
> doesn't
> > > > > sound
> > > > > > > related to your change.
> > > > > > >
> > > > > > > Failed to save user : Failed to add user to LDAP database :
> attribute
> > > > > > > 'givenName' provided more than once
> > > > > >
> > > > > > I did also fix a bug related to that field in this new version,
> so
> > > that
> > > > > > whatever you enter into the 'First name' field is set as the
> givenName
> > > > > > LDAP attribute.
> > > > > >
> > > > > > Do you have a custom setting on the Module Config page for the
> givenName
> > > > > > attribute as well? If so, it should probably be removed..
> > > > > >
> > > > > > - Jamie
> > > > >
> > > > > Hi Jamie,
> > > > >
> > > > > I just had another look at upgrading the LDAP Users module to your
> > > test
> > > > > version but I still get the error "attribute 'givenName' provided
> more
> > > > > than once" above. I don't have any custom settings to do with
> > > > > givenName. Of course I have the setting "Show fields for given
> name
> > > and
> > > > > surname" on. Somehow Webmin is trying to save that attribute twice?
> > > > > Could you maybe look at the code that was fixed and maybe see how
> it
> > > > > could cause my problem?
> > > >
> > > > That is quite odd, as in the code givenName is only set once.
> > > > Does running grep -i givenName /etc/webmin/ldap-useradmin/config
> find
> > > anything?
> > > >
> > > > Also, are you running the latest 1.296 development version of Webmin?
> > > There
> > > > was a bug related to givenName fixed since 1.290.
> > > >
> > > > - Jamie
> > >
> > > I downloaded that and still get the same error. Version 1.273 works
> and
> > > 1.296 doesn't. The grep for givenName above returns nothing. I will
> > > e-mail you directly a tarfile containing my config file and ldap
> > > schemas.
> >
> > Thanks for that file - I see the problem now. In your schema, gn is an
> alias
> > for givenName, so Webmin detects that they are both valid and tries to
> set them
> > both - which of course fails, because it is setting the same attribute
> twice!
> >
> > To fix this, edit the file ldap-useradmin/save_user.cgi under the Webmin
> root,
> > and replace the name_fields function with :
> >
> > sub name_fields
> > {
> > if ($config{'given'}) {
> > if ($firstname) {
> > if (&in_schema($schema, "gn")) {
> > push(@props, "gn", $firstname);
> > }
> > elsif (&in_schema($schema, "givenName")) {
> > push(@props, "givenName", $firstname)
> > }
> > }
> > if ($lastname && &in_schema($schema, "sn")) {
> > push(@props, "sn", $lastname);
> > }
> > if ($firstname || $lastname) {
> > push(@classes, $config{'given_class'});
> > }
> > }
> > if (&in_schema($schema, "gecos")) {
> > push(@props, "gecos", &remove_accents($in{'real'}));
> > }
> > }
> >
> > - Jamie
> >
>
> Hi Jamie,
>
> The patch above fixed the gn/givenName issue. I found I had to disable
> the default IMAP quota value in this module for it to attempt to set a
> new quota value - perhaps it should override the default anyway. The
> result of trying to set a custom IMAP quota for a user with a numeric
> value in the field is the error below:
>
> The user was saved successfully in the LDAP database, but an IMAP error
> occurred : Failed to set IMAP quota : Invalid quota list in Setquota
>
> Also the value in the IMAP quota field for any existing user is always
> 0. Perhaps the format of both the set and get values is incorrect.
Hmm .. I wasn't able to test this feature, as I don't run an IMAP server
with quota support myself. Any change I could login to yours to test the
get/set quota commands?
- Jamie
|