This patch successfully applyied on courier-imap-3.0.7 and courier-0.47
, we have a debian repository for those packages with the patch included
here : http://debian.telecomlille.net/

I saw that the authlib is now out of courier and courier-imap source
package, so I also included the file containing the function
checkip(const char * ip, const char * config_string);

here the old code in imapd.c :

    p=authgetoptionenv("allowimapfrom");
    // some hack for ipv6 ::ffff:192.168.1.1
    if( (real_ip = strrchr(ip, ':')) == NULL )
    {
        real_ip = ip;
    }
    else
    {
        real_ip++;
    }
    if ( p && !authcheckip(real_ip, p) )
    {
        writes("* BYE IMAP access disabled for this account.\r\n");
        writeflush();
        exit(0);
    }
    free(p);

This option works as the one from Apache without the "Allow from" :

Allow from 192.168.0.
Allow from all
Allow from 127.0.0.1

Regards,
Jon.


Michael Carmack wrote:

> jonathan wrote:
>
>> Any chances to get an answer for that ?
>> I might not be posting on the right mailing-list ?
>
>
> Post the patch to the list.
>
>
>>> Hi,
>>>
>>> I needed an option in Courier-imap to allow some users to connect to
>>> IMAP and some to use only the webmail. I know I could have done that
>>> using the provided SqWebMail but I am sorry, I prefer using
>>> SquirrelMail.
>>>
>>> Thanks to the very good Courier source code, I easily created my own
>>> option to insert into my LDAP directory a value where I can say from
>>> which host (or netmask) a user is allowed to authenticate from. Using
>>> 127.0.0.1, or any webserver IP you want Squirrel on, a user can only
>>> log into Squirrel while an other can use the full IMAP protocol.
>>>
>>> This code has been running on a production server for more than 6
>>> month now and I think it could helps some more people. So why not
>>> include it into Courier. How can I submit my changes ? or should I
>>> just give you the function code ?
>>>
>>> Jon.
>>
>>
>>
>>
>

Attachment: checkip.c.gz
Description: GNU Zip compressed data

Attachment: courier-imap-allowbyip.patch.diff.gz
Description: GNU Zip compressed data

Reply via email to