Skip to content

Commit

Permalink
fix query limit
Browse files Browse the repository at this point in the history
  • Loading branch information
iamacarpet committed Apr 8, 2020
1 parent 0a263b8 commit 2dd0c46
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
freepbx-ldap
freepbx-ldap
freepbx-ldap.linux.amd64
11 changes: 11 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module github.com/a1comms/freepbx-ldap

go 1.14

replace github.com/vjeantet/goldap => github.com/a1comms/goldap v0.0.0-20200408161836-36acb05c4fa0

require (
github.com/go-sql-driver/mysql v1.5.0
github.com/vjeantet/goldap v0.0.0-00010101000000-000000000000
github.com/vjeantet/ldapserver v0.0.0-20170919170217-479fece7c5f1
)
7 changes: 7 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
github.com/a1comms/goldap v0.0.0-20200408161836-36acb05c4fa0 h1:clLDwaQh/1nSvMZ+4TgIa9wzNpnVi+sT7ymhPN04NmM=
github.com/a1comms/goldap v0.0.0-20200408161836-36acb05c4fa0/go.mod h1:rhEoqsvpT50cYK43wB7BgFREb0Ssa6RYOQCeOEuwsUo=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/lor00x/goldap v0.0.0-20180618054307-a546dffdd1a3/go.mod h1:37YR9jabpiIxsb8X9VCIx8qFOjTDIIrIHHODa8C4gz0=
github.com/vjeantet/ldapserver v0.0.0-20170919170217-479fece7c5f1 h1:VWE8ZC9ER1YIfx0V0QgZGdG4UB/nGeaSmKxesfVuheo=
github.com/vjeantet/ldapserver v0.0.0-20170919170217-479fece7c5f1/go.mod h1:+KHPMCVmFBVXK3UAUom0AgP/IeOXH5C3ieEwA+JU3WE=
6 changes: 5 additions & 1 deletion main.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ func handleSearchDSE(w ldap.ResponseWriter, m *ldap.Message) {
sql += " " + recursiveFilter(r.Filter(), true) + " "

sql += " ORDER BY name ASC LIMIT 0, ?"
sqlVals = append(sqlVals, r.SizeLimit().Int())
if r.SizeLimit().Int() > 0 {
sqlVals = append(sqlVals, r.SizeLimit().Int())
} else {
sqlVals = append(sqlVals, 99)
}

log.Printf("Query SQL: %s %#v", sql, sqlVals)
result, err := SQLSearch(sql, sqlVals)
Expand Down

0 comments on commit 2dd0c46

Please sign in to comment.