Exemplo n.º 1
0
Arquivo: sasl.go Projeto: whawty/auth
// NewServerFromListener creates a server struct using a UnixListener specified
// by ln. cb is the callback function which will get called for any authentication
// request.
func NewServerFromListener(ln *net.UnixListener, cb AuthCB) (s *Server, err error) {
	s = &Server{}
	s.sockPath = ln.Addr().String()
	s.cb = cb
	s.ln = net.Listener(ln)
	return
}
Exemplo n.º 2
0
func runSaslAuthSocketListener(listener *net.UnixListener, store *StoreChan) error {
	path := listener.Addr().String()
	s, err := sasl.NewServerFromListener(listener, func(log string, pwd string, srv string, rlm string) (bool, string, error) {
		return callback(log, pwd, srv, rlm, path, store)
	})
	if err != nil {
		return err
	}
	wl.Printf("listening on '%s'", path)

	if err := s.Run(); err != nil {
		wl.Printf("error on sasl socket '%s': %s", path, err)
	}
	return nil
}