Re: is it possbile to disable smtp, pop3 or imap service for per user?

Carlos García Gómez <[email protected]> Thu, 14 Jul 2011 09:28:47 +0200
Newsgroups gmane.mail.qmail.ldap
Message-ID <[email protected]>
Hi,

In qmail-ldap when you disable some account you put ldap attribute accountStatus to noaccess. It disables qmail-pop3 and qmail-imap(s) in account user.

Look at below of this mail.

Regards

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

Sistemas de Información y Comunicaciones
Fundación Integra. http://www.f-integra.org

Teléfono: +34 968 355161
Fax: +34 968 355131
Correo: [email protected]

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

Este mensaje y los posibles documentos adjuntos al mismo son confidenciales y dirigidos exclusivamente a los destinatarios de los mismos. Si por un error de transmisión, o equivocación en la dirección de envío, usted ha recibido este mensaje y no es el destinatario de la información, por favor, notifíqueselo
al remitente y borre este mensaje, sin usar, informar, distribuir, imprimir, copiar o difundir el mensaje, total o parcialmente, por ningún medio. Gracias.


From: Dika Ye 
Sent: Thursday, July 14, 2011 3:49 AM
To: [email protected] 
Subject: is it possbile to disable smtp, pop3 or imap service for per user?
Dear all,


is it possbile to disable smtp, pop3 or imap service for per user?


Best wishes,


Dika.Ye
------------------------------------------------------------------------------------
NTT Com Asia Network Systems (Guangzhou) Company Limited.

Tel: (86)-20-8113 0687
Fax: (86)-20-8135 0322
Mobile: (86)-135 3371 0342
Email: [email protected]

www.ntt.com.hk



####################################################################################################################

From: Carlos García Gómez 
Sent: Monday, May 04, 2009 12:17 PM
To: [email protected] 
Subject: Qmail-ldap - qmail-imap courier-imap-Version.3.0.8

Hello,

I´m using qmail-ldap-couierImap like mix mail solution.

Qmail-send, qmail-smtp, qmail-pop3, qmail-pop3-ssl and qmail-qmqpd  in QMAIL
Courier-authlib, Courier-imap and courier-imap-ssl in COURIER ( versions courier-imap-4.1.3  and courier-authlib-0.59.3 )

In qmail-ldap when you disable some account you put ldap attribute accountStatus to noaccess. It disables qmail-pop3 and qmail-imap(s) in account user.
I have always wanted to remove courier-imap from my scenary and use qmail-imap but I could not do it becasue I must be able to disable independently pop3 and imap in some account.

I have touch qmail-ldap code in order to add some level of account status ==> noimap and nopop3. So...

qmail-ldap.h
/* the same values as ints */
#define STATUS_DELETE           3
#define STATUS_BOUNCE           2
#define STATUS_NOACCESS         1
#define STATUS_NOIMAP           4
#define STATUS_NOPOP3           5
#define STATUS_OK               0
#define STATUS_UNDEF            -1

#define ISACTIVE_BOUNCE         "disabled"
#define ISACTIVE_DELETE         "deleted"
#define ISACTIVE_NOACCESS       "noaccess"
#define ISACTIVE_NOIMAP         "noimap"
#define ISACTIVE_NOPOP3         "nopop3"
#define ISACTIVE_ACTIVE         "active"


qldap.c
        } else if (r == OK) {
                if (!case_diffs(ldap_attr.s, ISACTIVE_BOUNCE))
                        *status = STATUS_BOUNCE;
                else if (!case_diffs(ldap_attr.s, ISACTIVE_DELETE))
                        *status = STATUS_DELETE;
                else if (!case_diffs(ldap_attr.s, ISACTIVE_NOACCESS))
                        *status = STATUS_NOACCESS;
                else if (!case_diffs(ldap_attr.s, ISACTIVE_NOIMAP))
                        *status = STATUS_NOIMAP;
                else if (!case_diffs(ldap_attr.s, ISACTIVE_NOPOP3))
                        *status = STATUS_NOPOP3;
                else    *status = STATUS_OK; /* default to OK */
                /* perhaps we should spill out a warning for unknown settings */
                return OK;

qmail-ldaplookup.c
                switch (status) {
                case STATUS_BOUNCE:
                        output(subfdout, "%s: %s\n",
                            LDAP_ISACTIVE, ISACTIVE_BOUNCE);
                        break;
                case STATUS_NOACCESS:
                        output(subfdout, "%s: %s\n",
                            LDAP_ISACTIVE, ISACTIVE_NOACCESS);
                        break;
                case STATUS_NOIMAP:
                        output(subfdout, "%s: %s\n",
                            LDAP_ISACTIVE, ISACTIVE_NOIMAP);
                        break;
                case STATUS_NOPOP3:
                        output(subfdout, "%s: %s\n",
                            LDAP_ISACTIVE, ISACTIVE_NOPOP3);
                        break;
                case STATUS_OK:
                        output(subfdout, "%s: %s\n",
                            LDAP_ISACTIVE, ISACTIVE_ACTIVE);
                        break;


and in checkpassword.c
        if ( status == STATUS_BOUNCE ||  status == STATUS_DELETE || status == STATUS_NOACCESS ) {
                qldap_free(q);
                return ACC_DISABLED;
        }else if ( status == STATUS_NOPOP3 ) {
                if ( strcmp(env_get("TCPLOCALPORT"),"110") == 0 || strcmp(env_get("TCPLOCALPORT"),"995") == 0 ) {
                        fprintf(stderr,"User %s is not allowed to log on PORT %s\n",login->s,env_get("TCPLOCALPORT"));
                        qldap_free(q);
                        return ACC_DISABLED;
                }
        }else if ( status == STATUS_NOIMAP ) {
                if ( strcmp(env_get("TCPLOCALPORT"),"143") == 0 || strcmp(env_get("TCPLOCALPORT"),"993") == 0 ) {
                        fprintf(stderr,"User %s is not allowed to log on PORT %s\n",login->s,env_get("TCPLOCALPORT"));
                        qldap_free(q);
                        return ACC_DISABLED;
                }
        }



And it seems that`s is all right!!!

Only one thing: If I want to use qmail-imap I have to use courier-login from courier-imap-VERSION-3.0.8. My question is:

Is it safe?
What`s your opinion? (use courier-imap-VERSION-3.0.8)
Any bugs known in courier-imap-VERSION-3.0.8?

Regards


---------------------------------------------------------------------
 
Carlos García Gómez
Sistemas de Información y Comunicaciones
Fundación Integra. http://www.f-integra.org
 
Teléfono: +34 968 355161
Fax:      +34 968 355131
Correo:   [email protected]
 
----------------------------------------------------------------------
 
Este mensaje y los posibles documentos adjuntos al mismo son confidenciales y dirigidos exclusivamente a los destinatarios de los mismos. Si por un error de transmisión, o equivocación en la dirección de envío, usted ha recibido este mensaje y no es el destinatario de la información, por favor, notifíqueselo
al remitente y borre este mensaje, sin usar, informar, distribuir, imprimir, copiar o difundir el mensaje, total o parcialmente, por ningún medio. Gracias.