func doRunTry() { if tryMany > 0 { runTryMany(tryMany) } else { ok, err := saslauthd.Auth(name, pwd, service, realm) if err != nil { log.Fatal(err) } printResult(ok) } }
func runTryMany(count int) { readys := make(chan bool, count) for i := 0; i < count; i++ { go func() { var err error var ok bool ok, err = saslauthd.Auth(name, pwd, service, realm) if err != nil { log.Fatal(err) } readys <- ok }() } ok := true for i := 0; i < count; i++ { ok = ok && <-readys } printResult(ok) }
// Check method verifies given creds. func (sa SASLDAuth) Check(req *AuthReq, ok *bool) (err error) { *ok, err = saslauthd.Auth(req.User, req.Password, service, realm) return }