apply ldap filtering rules to values being substituted into ldap filters
This commit is contained in:
parent
7bf37b35a5
commit
c738c86fd1
|
@ -4,6 +4,8 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/tiagoapimenta/nginx-ldap-auth/ldap"
|
||||
|
||||
gldap "gopkg.in/ldap.v2"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
|
@ -23,6 +25,8 @@ func NewService(pool *ldap.Pool, base, filter, attr string) *Service {
|
|||
}
|
||||
|
||||
func (p *Service) Find(id string) ([]string, error) {
|
||||
id = gldap.EscapeFilter(id)
|
||||
|
||||
ok, _, groups, err := p.pool.Search(
|
||||
p.base,
|
||||
strings.Replace(p.filter, "{0}", id, -1),
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/tiagoapimenta/nginx-ldap-auth/ldap"
|
||||
|
||||
gldap "gopkg.in/ldap.v2"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
|
@ -21,6 +23,8 @@ func NewService(pool *ldap.Pool, base, filter string) *Service {
|
|||
}
|
||||
|
||||
func (p *Service) Find(username string) (bool, string, error) {
|
||||
username = gldap.EscapeFilter(username)
|
||||
|
||||
ok, id, _, err := p.pool.Search(
|
||||
p.base,
|
||||
strings.Replace(p.filter, "{0}", username, -1),
|
||||
|
|
Reference in a new issue