<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <font face="Helvetica, Arial, sans-serif">yep that would work !</font><br>
    <div class="moz-signature">
      <font color="blue">
        <meta http-equiv="content-type" content="text/html;
          charset=UTF-8">
        <title></title>
        <br>
        <br>
        Happy Tuesday !!!<br>
        Thanks - paul<br>
        <br>
        Paul Kudla<br>
        <br>
        <br>
        <a href="http://www.scom.ca"><img alt="Scom.ca Internet
            Services" src="cid:part1.ae7dNO9u.0dhpCRdV@scom.ca"
            width="191" height="43" border="0"></a><br>
        004-1009 Byron Street South<br>
        Whitby, Ontario - Canada<br>
        L1N 4S3<br>
        <br>
        Toronto 416.642.7266<br>
        Main 1.866.411.7266<br>
        Fax 1.888.892.7266<br>
        Email <a class="moz-txt-link-abbreviated" href="mailto:paul@scom.ca">paul@scom.ca</a>
      </font></div>
    <div class="moz-cite-prefix">On 8/2/2022 8:58 AM, Cristiano Deana
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:048e7d79-592f-4004-7418-2c5cf978c9ac@megaweb.it">
      <br>
      Hi,
      <br>
      <br>
      I had a similar problem.
      <br>
      Solved with "password, TO_BASE64('%w')" and decoding later into
      the (php) script updating my db
      <br>
      <br>
      Il 01/08/2022 10:47, Franz Beslmeisl ha scritto:
      <br>
      <blockquote type="cite">In order to change the password scheme I
        wrote a script named
        <br>
        updateproxy that needs the plain text password from the user.
        <br>
        To get that I use the line
        <br>
        <br>
             password_query = SELECT username as user, password, \
        <br>
               '%w' as userdb_plain_pass FROM auth_user WHERE
        username='%n'
        <br>
        <br>
        This works nicely with almost all passwords but not with this
        one
        <br>
        <br>
             1234567%&/abcd
        <br>
        <br>
        the error message being
        <br>
        <br>
             dovecot: Failed to expand plugin setting plain_pass =
        <br>
               '1234567%&/abcd': Unknown variable '%&'
        <br>
        <br>
        It seems to me that dovecot tries to do another level of
        variable
        <br>
        evaluation upon the **value** of the already evaluated variable.
        <br>
        <br>
        So I searched for ways to escape problematic characters like %
        <br>
        and changed my line to
        <br>
        <br>
             password_query = SELECT username as user, password, \
        <br>
               '%E{w}' as userdb_plain_pass FROM auth_user WHERE
        username='%n'
        <br>
        <br>
        but this produces problems with password values containing
        quotes.
        <br>
        <br>
        So how can I get a plain text password containing any ascii char
        <br>
        (or even better any utf-8 char) safely to my script?
        <br>
        <br>
        Thanks for your suggestions
        <br>
        <br>
        <br>
        <br>
        -------------- here the nasty details, if you want -------------
        <br>
        $ dovecot -n
        <br>
        # 2.3.7.2 (3c910f64b): /etc/dovecot/dovecot.conf
        <br>
        # Pigeonhole version 0.5.7.2 ()
        <br>
        # OS: Linux 5.4.0-122-generic x86_64 Ubuntu 20.04.4 LTS
        <br>
        # Hostname: mx-10-2.bildung.hessen.de
        <br>
        auth_mechanisms = plain login
        <br>
        auth_username_chars =
        abcdefghijklmnopqrstuvwxyz_0123456789.ABCDEFGHIJKLMNOPQRSTUVWXYZ-@
        <br>
        lda_mailbox_autocreate = yes
        <br>
        lda_mailbox_autosubscribe = yes
        <br>
        mail_location = maildir:~/Maildir
        <br>
        mail_privileged_group = mail
        <br>
        managesieve_notify_capability = mailto
        <br>
        managesieve_sieve_capability = fileinto reject envelope
        encoded-character vacation subaddress comparator-i;ascii-numeric
        relational regex imap4flags copy include variables body enotify
        environment mailbox date index ihave duplicate mime foreverypart
        extracttext
        <br>
        namespace inbox {
        <br>
           inbox = yes
        <br>
           location =
        <br>
           mailbox Drafts {
        <br>
             auto = subscribe
        <br>
             special_use = \Drafts
        <br>
           }
        <br>
           mailbox Junk {
        <br>
             auto = subscribe
        <br>
             special_use = \Junk
        <br>
           }
        <br>
           mailbox Sent {
        <br>
             auto = subscribe
        <br>
             special_use = \Sent
        <br>
           }
        <br>
           mailbox "Sent Messages" {
        <br>
             special_use = \Sent
        <br>
           }
        <br>
           mailbox Trash {
        <br>
             auto = subscribe
        <br>
             special_use = \Trash
        <br>
           }
        <br>
           prefix =
        <br>
        }
        <br>
        passdb {
        <br>
           # the following file contains a '%w'-line
        <br>
           args = /etc/dovecot/db1.conf
        <br>
           driver = sql
        <br>
        }
        <br>
        passdb {
        <br>
           # the following file contains a '%w'-line
        <br>
           args = /etc/dovecot/db2.conf
        <br>
           driver = sql
        <br>
        }
        <br>
        passdb {
        <br>
           # the following file contains no '%w'-line (just for detail)
        <br>
           args = /etc/dovecot/db3.conf
        <br>
           driver = sql
        <br>
        }
        <br>
        plugin {
        <br>
           sieve = ~/.dovecot.sieve
        <br>
           sieve_dir = ~/sieve
        <br>
           sieve_max_actions = 64
        <br>
           sieve_max_redirects = 16
        <br>
           sieve_max_script_size = 10M
        <br>
           sieve_trace_debug = yes
        <br>
           sieve_user_log = ~/sievelog
        <br>
           sieve_vacation_dont_check_recipient = yes
        <br>
           sieve_vacation_use_original_recipient = yes
        <br>
        }
        <br>
        protocols = imap sieve lmtp
        <br>
        service auth {
        <br>
           unix_listener /var/spool/postfix/private/dovecot-auth {
        <br>
             group = postfix
        <br>
             mode = 0660
        <br>
             user = postfix
        <br>
           }
        <br>
        }
        <br>
        service imap {
        <br>
           executable = imap after-login
        <br>
        }
        <br>
        service lmtp {
        <br>
           unix_listener /var/spool/postfix/private/dovecot-lmtp {
        <br>
             group = postfix
        <br>
             mode = 0660
        <br>
             user = postfix
        <br>
           }
        <br>
        }
        <br>
        service after-login {
        <br>
           executable = script-login /etc/dovecot/updateproxy
        <br>
           user = vmail
        <br>
        }
        <br>
        service stats {
        <br>
           unix_listener stats-reader {
        <br>
             group = mail
        <br>
             mode = 0666
        <br>
           }
        <br>
           unix_listener stats-writer {
        <br>
             group = mail
        <br>
             mode = 0666
        <br>
           }
        <br>
        }
        <br>
        ssl_cert = </etc/dovecot/private/dovecot.pem
        <br>
        ssl_cipher_list =
        ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP:-SSLv3
        <br>
        ssl_key = # hidden, use -P to show it
        <br>
        ssl_min_protocol = SSLv3
        <br>
        ssl_prefer_server_ciphers = yes
        <br>
        userdb {
        <br>
           args = uid=vmail gid=vmail home=/var/vmail/%n
        <br>
           driver = static
        <br>
        }
        <br>
        protocol lmtp {
        <br>
           mail_plugins = quota sieve
        <br>
           postmaster_address = <a class="moz-txt-link-abbreviated" href="mailto:somebody@somwhere.org">somebody@somwhere.org</a>
        <br>
        }
        <br>
        protocol lda {
        <br>
           deliver_log_format = msgid=%m: %$
        <br>
           mail_plugins = sieve
        <br>
           postmaster_address = <a class="moz-txt-link-abbreviated" href="mailto:somebody@somehwere.org">somebody@somehwere.org</a>
        <br>
           quota_full_tempfail = yes
        <br>
           rejection_reason = Your message to <%t> was
        automatically rejected:%n%r
        <br>
        }
        <br>
        protocol imap {
        <br>
           imap_client_workarounds = delay-newmail
        <br>
           mail_max_userip_connections = 300
        <br>
        }
        <br>
        <br>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </body>
</html>