please HELP
Heiler Bemerguy
heiler.bemerguy at cinbesa.com.br
Tue Jan 23 12:14:01 EST 2018
I'm trying to fix the mailboxes with something like this:
imap_setacl ($mbox, "user/".$argv[1]."/*",
$wrongname."todelete", "");
imap_setacl ($mbox, "user/".$argv[1]."/*", $argv[1],
"lrswipkxtea");
But it seems imap_setacl can't use wildcards. And I can't write one by
one by hand.
Anyone can help me with that?
The full php script is below:
<?php
if ($argc < 2 )
{
exit( "Usage: ./rename.php LOGIN (without TODELETE)\nUse ^
instead of DOTS\n\n" );
}
$mbox = imap_open("{localhost:143/novalidate-cert}", "admin",
"<SECRET>", OP_HALFOPEN) or die("can't connect: " . imap_last_error());
imap_renamemailbox($mbox,
"{localhost:143}user/".$argv[1]."TODELETE",
"{localhost:143}user/".$argv[1]) or die("can't rename, already exists?:
" . imap_last_error());
$wrongname = str_replace("^", ".", $argv[1]);
imap_setacl ($mbox, "user/".$argv[1], $wrongname."todelete",
"") or print("can't remove $wrongname todelete of $argv[1]\n");
imap_setacl ($mbox, "user/".$argv[1]."/*",
$wrongname."todelete", "") or print("can't remove $wrongname todelete of
$argv[1]/*\n");
imap_setacl ($mbox, "user/".$argv[1], $argv[1], "lrswipkxtea")
or print("can't set $argv[1] with lrswipkxtea into $argv[1]\n");
imap_setacl ($mbox, "user/".$argv[1]."/*", $argv[1],
"lrswipkxtea") or print("can't set $argv[1] with lrswipkxtea into
$argv[1]/*\n");
imap_close($mbox);
shell_exec("cyrus reconstruct -x -r -f user/".$argv[1]);
?>
--
Atenciosamente / Best Regards,
Heiler Bemerguy
Network Manager - CINBESA
55 91 98151-4894/3184-1751
Em 22/01/2018 22:09, Patrick Boutilier escreveu:
> On 01/22/2018 07:55 PM, Heiler Bemerguy via Info-cyrus wrote:
>>
>>>> The way I interpret it is that the / means unixhierarchysep is on.
>>>>
>>>> Just tested this on 2.4.18 and the same thing happens. When you
>>>> rename back no messages are listed and reconstruct does nothing.
>>>
>>> Ah. As suspected the rights are wrong. You just need to set the
>>> rights back to the real user. You probably need to use / instead of .
>>>
>>> localhost> lam user.test
>>> testtodelete lrswipkxtecda
>>>
>>> localhost> sam user.test test lrswipkxtecda
>>>
>>> localhost> lam user.test
>>> testtodelete lrswipkxtecda
>>> test lrswipkxtecda
>>>
>>> localhost> sam user.test testtodelete ''
>>>
>>> localhost> lam user.test
>>> test lrswipkxtecda
>>
>> localhost> lam user/asaude
>> asaudetodelete lrswipkxtecda
>> localhost> lam user/ana^claudia
>> ana.claudiatodelete lrswipkxtecda
>> localhost>
>>
>> OMG it's completely borked. Why did it happen? How it changed to
>> "TODELETE" but didn't change back hours later?!?
>
> Just looks like a bug.
>
> Maybe was the capital
>> letters?!
>
> Yup. I tested and using capital letters causes this behaviour.
>
>
>>
>> Then I'll have to change one by one? with "sam"? Could you please
>> explain what you did? I understood the LAMs but didn't the SAMs lol
>> it seems in your case you had two acls?! a right and a wrong?
>>
>
> You will have to change the rights somehow. Should be able to do it
> with a PHP or perl script.
>
> Correct, need to remove the wrong ACL and put the correct one on. For
> example:
>
> sam user/asaude asaudetodelete ''
> sam user/asaude asaude lrswipkxtecda
>
> First sam deletes the wrong ACL, second sam adds the correct one.
>
> Of course those only get the InBox. For folders you will have to also
> do something like:
>
> sam user/asaude/* asaudetodelete ''
> sam user/asaude/* asaude lrswipkxtecda
More information about the Info-cyrus
mailing list