[prev in list] [next in list] [prev in thread] [next in thread] 

List:       exim-users
Subject:    [exim] Exim MySQL and PAM
From:       "Silmar A. Marca" <marca () grupogsn ! com ! br>
Date:       2004-11-27 12:21:07
Message-ID: 1101558067.41a8713317376 () webmail ! grupogsn ! com ! br
[Download RAW message or body]

This is my auth clause (tested). If the user not contain "@", this is a real
user (pam). If this contain "@" this is a virtual user in mysql bd (password
stored in md5 format).

..Clause
 MYSQL_PASSWD_MD5_LOGIN = SELECT popbox.password_md5  from popbox LEFT JOIN
domain ON ( popbox.domain_name = domain.domain_name ) \
where popbox.local_part='${quote_mysql:${extract {1}{@%!}{$1}}}' and
popbox.domain_name='${quote_mysql:${extract {2}{@%!}{$1}}}' \
AND domain.ativo='1' AND popbox.ativo='1' LIMIT 1


begin authenticators

# PLAIN: user e pass codificados em base64-coded - usado pelo Netscape
plain:
  driver                = plaintext
  public_name           = PLAIN
.ifdef MYSQL_SERVER
  server_condition      = "${if eq {${if match{$2}{@}{yes}{no}}}{yes}\
    {${if and{\
        {!eq {$2}{}} {!eq {$3}{}} \
        {eq {${lookup mysql {MYSQL_PASSWD_MD5_PLAIN}{$value}{*:*}}}{${md5:$3}}}
\
      }{yes}{no}}}\
      {${if pam{$2:${sg{$3}{:}{::}}}{yes}{no}}}}"
.else
  server_condition      = ${if pam{$2:${sg{$3}{:}{::}}}{yes}{no}}
.endif
  server_set_id = $2

# LOGIN: codificacao em md5-encoded com usado pelo Outlook Express
login:
  driver                = plaintext
  public_name           = LOGIN
  server_prompts        = "Username:: : Password::"
.ifdef MYSQL_SERVER
  server_condition      = "${if eq {${if match{$1}{@}{yes}{no}}}{yes}\
    {${if and{\
        {!eq {$1}{}} {!eq {$2}{}} \
        {eq {${lookup mysql {MYSQL_PASSWD_MD5_LOGIN}{$value}{*:*}}}{${md5:$2}}}
\
      }{yes}{no}}}\
      {${if pam{$1:${sg{$2}{:}{::}}}{yes}{no}}}}"
.else
  server_condition      = ${if pam{$1:${sg{$2}{:}{::}}}{yes}{no}}
.endif
  server_set_id = $1





Cordialmente, Silmar A. Marca
GrupoGSN - Desenvolvimento, Implantação e Verificação de Servidores
Profissionais baseados em Linux/Novell
http://www.grupogsn.com.br/~marca/
------------------------------------------------------------
Se algo não lhe faz mal (fisico, moral ou psicologicamente),
experimente! O máximo e você perder tempo! E tempo, e
o que você tem a vida toda pra perder.....
Mais vale um instante de prazer que uma eternidade fútil!
------------------------------------------------------------







-- 
## List details at http://www.exim.org/mailman/listinfo/exim-users Exim details at \
http://www.exim.org/ ##


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic