AuthDatabase CheckPassword broken?

Aki Tuomi aki.tuomi at dovecot.fi
Thu Feb 1 10:02:10 EET 2018



On 01.02.2018 08:00, Mark Foley wrote:
> I had been using the CheckPassword authentication interface with dovecot 2.2.15, 
> https://wiki2.dovecot.org/AuthDatabase/CheckPassword, and it was working.
>
> After upgrading to 2.2.33.2 CheckPassword no longer works. The referenced wiki page says, 
>
> Checkpassword Interface
>
>     Read <username> NUL <password> NUL from fd 3. 
>
> I've checked the information read from fd 3 with 2.2.33.2 and I get <username> followed by 3
> nulls. I'm guessing the 2nd null is supposed to be the password.
>
> Why is this no longer working? How can I fix it?
>
> THX --Mark
Our CI has test

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys

DOVECOT_PW_FD = 3

def checkPassword():
  with os.fdopen(DOVECOT_PW_FD, 'r') as s:
    data = s.read().split("\0")
    if data[0] != "testuser" or data[1] != "pass":
      return False
    os.environ["USER"] = data[0]
    os.environ["EXTRA"] = "userdb_uid=vmail userdb_gid=vmail"
  return True

if __name__ == "__main__":
  if not checkPassword():
    sys.exit(1)
  os.execv(sys.argv[1], sys.argv[1:])

And it seems to work.

Aki


More information about the dovecot mailing list