| 56 | } |
| 57 | |
| 58 | func (a *Auth) Configure(inlineArgs []string, cfg *config.Map) error { |
| 59 | if len(inlineArgs) != 0 { |
| 60 | return errors.New("pam: inline arguments are not used") |
| 61 | } |
| 62 | |
| 63 | cfg.Bool("debug", true, false, &a.Log.Debug) |
| 64 | cfg.Bool("use_helper", false, false, &a.useHelper) |
| 65 | if _, err := cfg.Process(); err != nil { |
| 66 | return err |
| 67 | } |
| 68 | if !canCallDirectly && !a.useHelper { |
| 69 | return errors.New("pam: this build lacks support for direct libpam invocation, use helper binary") |
| 70 | } |
| 71 | |
| 72 | if a.useHelper { |
| 73 | a.helperPath = filepath.Join(config.LibexecDirectory, "maddy-pam-helper") |
| 74 | if _, err := os.Stat(a.helperPath); err != nil { |
| 75 | return fmt.Errorf("pam: no helper binary (maddy-pam-helper) found in %s", config.LibexecDirectory) |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | return nil |
| 80 | } |
| 81 | |
| 82 | func (a *Auth) AuthPlain(username, password string) error { |
| 83 | if a.useHelper { |