<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Interesting, the documentation and the
      build-in help of dovecot-lda do not mention -r exists :)<br>
      <br>
      <table class="highlight tab-size js-file-line-container"
        data-tab-size="8" style="box-sizing: border-box; border-spacing:
        0px; border-collapse: collapse; tab-size: 8; color: rgb(36, 41,
        46); font-family: -apple-system, BlinkMacSystemFont, "Segoe
        UI", Helvetica, Arial, sans-serif, "Apple Color
        Emoji", "Segoe UI Emoji", "Segoe UI
        Symbol"; font-size: 14px; font-style: normal;
        font-variant-ligatures: normal; font-variant-caps: normal;
        font-weight: 400; letter-spacing: normal; orphans: 2;
        text-align: start; text-indent: 0px; text-transform: none;
        white-space: normal; widows: 2; word-spacing: 0px;
        -webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
        255); text-decoration-style: initial; text-decoration-color:
        initial;">
        <tbody style="box-sizing: border-box;">
          <tr style="box-sizing: border-box;">
            <td id="LC358" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; color: rgb(36, 41, 46); word-wrap: normal; white-space: pre;">           <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">case</span> <span class="pl-s" style="box-sizing: border-box; color: rgb(3, 47, 98);"><span class="pl-pds" style="box-sizing: border-box; color: rgb(3, 47, 98);">'</span>r<span class="pl-pds" style="box-sizing: border-box; color: rgb(3, 47, 98);">'</span></span>:</td>
          </tr>
          <tr style="box-sizing: border-box;">
            <td id="L359" class="blob-num js-line-number"
              data-line-number="359" style="box-sizing: border-box;
              padding: 0px 10px; width: 50px; min-width: 50px;
              font-family: SFMono-Regular, Consolas, "Liberation
              Mono", Menlo, Courier, monospace; font-size: 12px;
              line-height: 20px; color: rgba(27, 31, 35, 0.3);
              text-align: right; white-space: nowrap; vertical-align:
              top; cursor: pointer; user-select: none;"><br>
            </td>
            <td id="LC359" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; color: rgb(36, 41, 46); word-wrap: normal; white-space: pre;">                   <span class="pl-c" style="box-sizing: border-box; color: rgb(106, 115, 125);"><span class="pl-c" style="box-sizing: border-box; color: rgb(106, 115, 125);">/*</span> final recipient address <span class="pl-c" style="box-sizing: border-box; color: rgb(106, 115, 125);">*/</span></span></td>
          </tr>
          <tr style="box-sizing: border-box;">
            <td id="L360" class="blob-num js-line-number"
              data-line-number="360" style="box-sizing: border-box;
              padding: 0px 10px; width: 50px; min-width: 50px;
              font-family: SFMono-Regular, Consolas, "Liberation
              Mono", Menlo, Courier, monospace; font-size: 12px;
              line-height: 20px; color: rgba(27, 31, 35, 0.3);
              text-align: right; white-space: nowrap; vertical-align:
              top; cursor: pointer; user-select: none;"><br>
            </td>
            <td id="LC360" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; color: rgb(36, 41, 46); word-wrap: normal; white-space: pre;">                   <span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">if</span> (<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">smtp_address_parse_path</span>(ctx.<span class="pl-smi" style="box-sizing: border-box; color: rgb(36, 41, 46);">pool</span>, <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">optarg</span>,</td>
          </tr>
          <tr style="box-sizing: border-box;">
            <td id="L361" class="blob-num js-line-number"
              data-line-number="361" style="box-sizing: border-box;
              padding: 0px 10px; width: 50px; min-width: 50px;
              font-family: SFMono-Regular, Consolas, "Liberation
              Mono", Menlo, Courier, monospace; font-size: 12px;
              line-height: 20px; color: rgba(27, 31, 35, 0.3);
              text-align: right; white-space: nowrap; vertical-align:
              top; cursor: pointer; user-select: none;"><br>
            </td>
            <td id="LC361" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; color: rgb(36, 41, 46); word-wrap: normal; white-space: pre;">                           SMTP_ADDRESS_PARSE_FLAG_ALLOW_LOCALPART |</td>
          </tr>
          <tr style="box-sizing: border-box;">
            <td id="L362" class="blob-num js-line-number"
              data-line-number="362" style="box-sizing: border-box;
              padding: 0px 10px; width: 50px; min-width: 50px;
              font-family: SFMono-Regular, Consolas, "Liberation
              Mono", Menlo, Courier, monospace; font-size: 12px;
              line-height: 20px; color: rgba(27, 31, 35, 0.3);
              text-align: right; white-space: nowrap; vertical-align:
              top; cursor: pointer; user-select: none;"><br>
            </td>
            <td id="LC362" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; color: rgb(36, 41, 46); word-wrap: normal; white-space: pre;">                           SMTP_ADDRESS_PARSE_FLAG_BRACKETS_OPTIONAL,</td>
          </tr>
          <tr style="box-sizing: border-box;">
            <td id="L363" class="blob-num js-line-number"
              data-line-number="363" style="box-sizing: border-box;
              padding: 0px 10px; width: 50px; min-width: 50px;
              font-family: SFMono-Regular, Consolas, "Liberation
              Mono", Menlo, Courier, monospace; font-size: 12px;
              line-height: 20px; color: rgba(27, 31, 35, 0.3);
              text-align: right; white-space: nowrap; vertical-align:
              top; cursor: pointer; user-select: none;"><br>
            </td>
            <td id="LC363" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; color: rgb(36, 41, 46); word-wrap: normal; white-space: pre;">                           &final_rcpt_to, &errstr) < <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">0</span>) {</td>
          </tr>
          <tr style="box-sizing: border-box;">
            <td id="L364" class="blob-num js-line-number"
              data-line-number="364" style="box-sizing: border-box;
              padding: 0px 10px; width: 50px; min-width: 50px;
              font-family: SFMono-Regular, Consolas, "Liberation
              Mono", Menlo, Courier, monospace; font-size: 12px;
              line-height: 20px; color: rgba(27, 31, 35, 0.3);
              text-align: right; white-space: nowrap; vertical-align:
              top; cursor: pointer; user-select: none;"><br>
            </td>
            <td id="LC364" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; color: rgb(36, 41, 46); word-wrap: normal; white-space: pre;">                           <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">i_fatal_status</span>(EX_USAGE,</td>
          </tr>
          <tr style="box-sizing: border-box;">
            <td id="L365" class="blob-num js-line-number"
              data-line-number="365" style="box-sizing: border-box;
              padding: 0px 10px; width: 50px; min-width: 50px;
              font-family: SFMono-Regular, Consolas, "Liberation
              Mono", Menlo, Courier, monospace; font-size: 12px;
              line-height: 20px; color: rgba(27, 31, 35, 0.3);
              text-align: right; white-space: nowrap; vertical-align:
              top; cursor: pointer; user-select: none;"><br>
            </td>
            <td id="LC365" class="blob-code blob-code-inner js-file-line" style="box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 12px; color: rgb(36, 41, 46); word-wrap: normal; white-space: pre;">                                   <span class="pl-s" style="box-sizing: border-box; color: rgb(3, 47, 98);"><span class="pl-pds" style="box-sizing: border-box; color: rgb(3, 47, 98);">"</span>Invalid -a parameter: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 92, 197);">%s</span><span class="pl-pds" style="box-sizing: border-box; color: rgb(3, 47, 98);">"</span></span>, errstr);</td>
          </tr>
        </tbody>
      </table>
      <br>
      Btw: Should the error message not read "Invalid -r parameter: %s"
      instead?<br>
      <br>
      I think the problem is the different handling in Postfix and
      Dovecot: <br>
      Postfix seems to automatically strip the quotes out of the
      username, at least for SQL lookup (but does the splitting
      correctly, which Dovecot 2.3 does NOT).<br>
      Dovecot does not strip quotes.<br>
      <br>
      What is the recommended (i.e. endorsed by its developers) way for
      Dovecot to deal with Mail addresses containing Quotation marks?
      Strip them out? Keep them? Since they are disabled by default
      (auth_username_chars), it seems like stripping, but then the
      splitting of local part and domain does not work correctly.<br>
      Am I really the first one to play around with this? Does it make
      sense to prepare patches for example for fixing the splitting?<br>
      <br>
      On a side note: Has support for UTF8 in local parts already landed
      in Dovecot? I could not find up-to-date information on this topic.<br>
      <br>
      Kind regards,<br>
      Philipp<br>
      <br>
      Am 07-Mar-18 um 15:50 schrieb Stephan Bosch:<br>
    </div>
    <blockquote type="cite"
      cite="mid:9b2291cb-7bbc-9f46-e8f2-db9416f55328@rename-it.nl">
      <br>
      <br>
      Op 7-3-2018 om 15:40 schreef Stephan Bosch:
      <br>
      <blockquote type="cite">
        <br>
        <br>
        Op 7-3-2018 om 13:46 schreef Philipp Berger:
        <br>
        <blockquote type="cite">I wrapped the LDA command in a script. I
          can see that Postfix passes
          <br>
          <a class="moz-txt-link-rfc2396E" href="mailto:@@mydomain.tld">"@@mydomain.tld"</a> as the -d argument, without quotes.
          <br>
          I then adapted the script to specifically replace this address
          with
          <br>
          "@"@mydomain.tld, but this results in the following error
          message by
          <br>
          Dovecot:
          <br>
          <br>
               auth: Info: userdb(?): Username character disallowed by
          <br>
          auth_username_chars: 0x22 (username: "@"@mydomain.tld)
          <br>
          <br>
          So what would be the appropriate quoting/setting for this
          address?
          <br>
        </blockquote>
        <br>
        Adding " to auth_username_chars would help.
        <br>
        <br>
        But why are you trying to accept such incredibly horrible
        email-addresses/usernames?
        <br>
        <br>
      </blockquote>
      Also, -d is used to provide the username. For -d, you could leave
      out the double quotes and provide the full e-mail
      address--including the required quotes--to the -r argument.
      <br>
      <br>
      It all depends on what your userdb expects.
      <br>
      <br>
      Regards,
      <br>
      <br>
      Stephan.
      <br>
      <br>
      <blockquote type="cite">
        <blockquote type="cite">Am 06-Mar-18 um 15:08 schrieb Stephan
          Bosch:
          <br>
          <blockquote type="cite">
            <br>
            Op 6-3-2018 om 14:34 schreef Philipp Berger:
            <br>
            <blockquote type="cite">I upgraded to Dovecot 2.3.0.1 as
              advised, but it still seems broken. In
              <br>
              the Postfix log I now see:
              <br>
              <br>
              Mar  6 13:49:03 myhost amavis[7165]: (07165-10)
              K00VtLRHdrYw FWD from
              <br>
              <a class="moz-txt-link-rfc2396E" href="mailto:admin@mydomain.tld"><admin@mydomain.tld></a> -> <"@"@mydomain.tld>,
              BODY=7BIT 250 2.0.0 from
              <br>
              MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as
              B8CA22DA1B37
              <br>
              Mar  6 13:49:03 myhost amavis[7165]: (07165-10) Passed
              CLEAN
              <br>
              {RelayedInbound}, [someIp]:11439 [someIp]
              <a class="moz-txt-link-rfc2396E" href="mailto:admin@mydomain.tld"><admin@mydomain.tld></a> ->
              <br>
              <"@"@mydomain.tld>, Queue-ID: D27792DA167C,
              Message-ID:
              <br>
              <a class="moz-txt-link-rfc2396E" href="mailto:22b95756-e95e-86cf-219c-3b603f7587c8@mydomain.tld"><22b95756-e95e-86cf-219c-3b603f7587c8@mydomain.tld></a>,
              mail_id:
              <br>
              K00VtLRHdrYw, Hits: -3, size: 7472, queued_as:
              B8CA22DA1B37, 1863 ms
              <br>
              Mar  6 13:49:03 myhost postfix/smtp[2329]: D27792DA167C:
              <br>
              to=<a class="moz-txt-link-rfc2396E" href="mailto:@@mydomain.tld"><@@mydomain.tld></a>,
              relay=127.0.0.1[127.0.0.1]:10024, delay=2,
              <br>
              delays=0.15/0.01/0/1.9, dsn=2.0.0, status=sent (250 2.0.0
              from
              <br>
              MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as
              B8CA22DA1B37)
              <br>
              Mar  6 13:49:03 myhost postfix/pipe[2282]: B8CA22DA1B37:
              <br>
              to=<a class="moz-txt-link-rfc2396E" href="mailto:@@mydomain.tld"><@@mydomain.tld></a>, relay=dovecot, delay=0.2,
              delays=0.11/0/0/0.09,
              <br>
              dsn=5.1.1, status=bounced (user unknown)
              <br>
              Mar  6 13:49:03 myhost postfix/cleanup[2280]:
              EA37E2DA1F80:
              <br>
message-id=<a class="moz-txt-link-rfc2396E" href="mailto:20180306124903.EA37E2DA1F80@mydomain.tld"><20180306124903.EA37E2DA1F80@mydomain.tld></a>
              <br>
              Mar  6 13:49:04 myhost postfix/bounce[2334]: B8CA22DA1B37:
              sender
              <br>
              non-delivery notification: EA37E2DA1F80
              <br>
              Mar  6 13:49:04 myhost postfix/qmgr[21911]: EA37E2DA1F80:
              from=<>,
              <br>
              size=9830, nrcpt=1 (queue active)
              <br>
              Mar  6 13:49:04 myhost postfix/qmgr[21911]: B8CA22DA1B37:
              removed
              <br>
              Mar  6 13:49:04 myhost postfix/pipe[2282]: EA37E2DA1F80:
              <br>
              to=<a class="moz-txt-link-rfc2396E" href="mailto:admin@mydomain.tld"><admin@mydomain.tld></a>, relay=dovecot, delay=0.07,
              <br>
              delays=0.05/0/0/0.02, dsn=5.3.0, status=bounced (command
              line usage
              <br>
              error. Command output: lda: Fatal: Invalid -f parameter:
              Missing
              <br>
              domain )
              <br>
              <br>
              I can see in my MySQL Log that Dovecot queried at the same
              time with %n
              <br>
              = "" (empty) and %d = "@mydomain.tld". So now the "@" is
              dropped
              <br>
              entirely.
              <br>
              <br>
              What does the "Fatal: Invalid -f parameter: Missing
              domain" tell us? Do
              <br>
              I need to change the way Postfix calls Dovecot? Add more
              quotes? :D
              <br>
            </blockquote>
            Can you check what Postfix is feeding to Dovecot exactly
            (i.e.,
            <br>
            whether it is properly escaped)? Maybe wrap dovecot-lda in
            some shell
            <br>
            script and see what is passed.
            <br>
            <br>
            Regards,
            <br>
            <br>
            Stephan.
            <br>
            <br>
            <blockquote type="cite">Kind regards,
              <br>
              Philipp
              <br>
              <br>
              Am 04-Mar-18 um 21:12 schrieb Stephan Bosch:
              <br>
              <blockquote type="cite">Op 3/1/2018 om 2:07 PM schreef
                Philipp Berger:
                <br>
                <blockquote type="cite">Dear all,
                  <br>
                  <br>
                  I have a working setup with Postfix + Dovecot, storing
                  users in a
                  <br>
                  MySQL
                  <br>
                  table.
                  <br>
                  <br>
                  I ran into problems setting up and using a mail
                  address like
                  <br>
                  a"@"<a class="moz-txt-link-abbreviated" href="mailto:b@mydomain.tld">b@mydomain.tld</a>, which by RFC should be valid, but
                  leads to
                  <br>
                  problems
                  <br>
                  in Dovecot. From my debugging, I can see that on the
                  lookup, Dovecot
                  <br>
                  replaces %n with "a" (quotes added by me) and %d with
                  <a class="moz-txt-link-rfc2396E" href="mailto:b@mydomain.tld">"b@mydomain.tld"</a>
                  <br>
                  (quotes added by me). So the original quotes are gone,
                  and the
                  <br>
                  domain/user split is incorrect.
                  <br>
                  <br>
                  I am not sure of Postfix passes the address without
                  quotes to
                  <br>
                  Dovecot or
                  <br>
                  whether Dovecot can not handle quotes correctly, but I
                  was hoping that
                  <br>
                  someone with more insight into Dovecot could help me
                  out here.
                  <br>
                  <br>
                  System Info: Debian 9, Postifx 3.1.6-0+deb9u1, Dovecot
                  2.2.27-3+deb9u1
                  <br>
                  Postfix master.cf for Dovecot:
                  <br>
                  dovecot unix  -       n       n       -       - pipe
                  <br>
                      flags=DRhu user=virtual:virtual
                  <br>
                  argv=/usr/lib/dovecot/dovecot-lda -f
                  <br>
                  ${sender} -d ${user}@${nexthop}
                  <br>
                  <br>
                  I am grateful for any hints :)
                  <br>
                  <br>
                  Thank you in advance, kind regards,
                  <br>
                </blockquote>
                Yeah, Dovecot v2.2 is doing some funky stuff with SMTP
                address parsing.
                <br>
                Dovecot v2.3 should do a better job. I am still not sure
                if this can be
                <br>
                fixed well for Dovecot v2.2.
                <br>
                <br>
                Regards,
                <br>
                <br>
                Stephan.
                <br>
              </blockquote>
              <br>
            </blockquote>
          </blockquote>
          <br>
        </blockquote>
        <br>
      </blockquote>
      <br>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>