Package dovecot implements functions to interact with Dovecot's authentication service.

    In particular, it supports doing user authorization, and checking if a user exists. It is a very basic implementation, with only the minimum needed to cover chasquid's needs.



    View Source
    const DefaultTimeout = 5 * time.Second

      DefaultTimeout to use. We expect Dovecot to be quite fast, but don't want to hang forever if something gets stuck.


      This section is empty.


      This section is empty.


      type Auth

      type Auth struct {
      	// Timeout for connection and I/O operations (applies on each call).
      	// Set to DefaultTimeout by NewAuth.
      	Timeout time.Duration
      	// contains filtered or unexported fields

        Auth represents a particular Dovecot auth service to use.

        func Autodetect

        func Autodetect(userdb, client string) *Auth

          Autodetect where the dovecot authentication paths are, and return an Auth instance for them. If any of userdb or client are != "", they will be used and not autodetected.

          func NewAuth

          func NewAuth(userdb, client string) *Auth

            NewAuth returns a new connection against Dovecot authentication service. It takes the addresses of userdb and client sockets (usually paths as configured in dovecot).

            func (*Auth) Authenticate

            func (a *Auth) Authenticate(user, passwd string) (bool, error)

              Authenticate returns true if the password is valid for the user, false otherwise.

              func (*Auth) Check

              func (a *Auth) Check() error

                Check to see if this auth is valid (but may not be working).

                func (*Auth) Exists

                func (a *Auth) Exists(user string) (bool, error)

                  Exists returns true if the user exists, false otherwise.

                  func (*Auth) Reload

                  func (a *Auth) Reload() error

                    Reload the authenticator. It's a no-op for dovecot, but it is needed to conform with the auth.Backend interface.

                    func (*Auth) String

                    func (a *Auth) String() string

                      String representation of this Auth, for human consumption.

                      Source Files