On Tue, August 26, 2008 11:12 am, Jani Taskinen wrote: > Diego Woitasen wrote: >> On Wed, August 20, 2008 10:55 pm, Jani Taskinen wrote: >>> Diego Woitasen kirjoitti: >>>> Hi, >>>> I attach the patch that adds imap_myrights function to IMAP module. >>>> MYRIGHTS is a standard IMAP command defined in RFC 2086. >>>> >>>> diff -u -r php-5.2.6/ext/imap/php_imap.c >>>> php-myrights/ext/imap/php_imap.c >>>> --- php-5.2.6/ext/imap/php_imap.c Thu Apr 17 13:04:49 2008 >>>> +++ php-myrights/ext/imap/php_imap.c Tue Jun 3 18:06:37 2008 >>>> @@ -154,6 +154,7 @@ >>>> PHP_FE(imap_set_quota, >>>> NULL) >>>> PHP_FE(imap_setacl, >>>> NULL) >>>> PHP_FE(imap_getacl, >>>> NULL) >>>> + PHP_FE(imap_myrights, >>>> NULL) >>>> #endif >>>> >>>> PHP_FE(imap_mail, >>>> NULL) >>>> @@ -413,6 +414,20 @@ >>>> } >>>> /* }}} */ >>>> >>>> +/* {{{ mail_myrights >>>> + * >>>> + * Mail MYRIGHTS callback >>>> + * Called via the mail_parameter function in >>>> c-client:src/c-client/mail.c >>>> + */ >>>> +void mail_myrights(MAILSTREAM *stream, char *mailbox, char *rights) >>>> +{ >>>> + TSRMLS_FETCH(); >>>> + >>>> + ZVAL_STRING(IMAPG(imap_acl_list), rights, 1) >>>> + >>>> +} >>>> +/* }}} */ >>>> + >>>> #endif >>> Does this really work? You're blindly overwriting the acl global, >>> AFAICT..? >>> Or is that intentional? >> >> Yes, it works. I use the imap_getacl() function as example to write >> imap_myrights(). What's the problem with overwriting acl global? > > So you don't use imap_setacl/imap_getacl ?? Or care if someone else > does? I'm not sure how this really works, but it doesn't sound quite > right.. > > --Jani >
I looked at the code again. imap_acl_list contains the last value returned by imap_getacl() (and imap_myrights() with the patch). I don't undertand why writing that variable is a problem. GETACL and MYRIGHTS have different meanings, the first gets all ACLs of a folder and the second just only the ACLs of the current user. If the users doesn't have permissions or isn't the owner, GETACL fails and MYRIGHTS no. -- Diego Woitasen XTECH - Soluciones Linux para empresas (54) 011 5219-0678 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php