Пример #1
0
func doRunTry() {
	if tryMany > 0 {
		runTryMany(tryMany)
	} else {
		ok, err := saslauthd.Auth(name, pwd, service, realm)
		if err != nil {
			log.Fatal(err)
		}
		printResult(ok)
	}
}
Пример #2
0
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)
}
Пример #3
0
// 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
}