aboutsummaryrefslogtreecommitdiff
path: root/ldapserver
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2021-07-07 01:49:33 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2021-09-16 13:09:26 +0200
commit563fc272a36c8be317fbe95c8308ca2dfa29c3aa (patch)
tree0b6f9a6a15516e7234fc928ecbebbd32d3154074 /ldapserver
parentaa912b5ceb24cb8772709171ea9589b0771bbe54 (diff)
downloadbottin-563fc272a36c8be317fbe95c8308ca2dfa29c3aa.tar.gz
bottin-563fc272a36c8be317fbe95c8308ca2dfa29c3aa.zip
Vendor goldap, fix ASN.1 BER integer and length encoding
- Add tests for goldap to prevent regressions - Disable reconnection for our functional tests
Diffstat (limited to 'ldapserver')
-rw-r--r--ldapserver/client.go8
-rw-r--r--ldapserver/constants.go2
-rw-r--r--ldapserver/message.go2
-rw-r--r--ldapserver/packet.go3
-rw-r--r--ldapserver/responsemessage.go2
-rw-r--r--ldapserver/route.go2
6 files changed, 12 insertions, 7 deletions
diff --git a/ldapserver/client.go b/ldapserver/client.go
index 91a5980..3674ba4 100644
--- a/ldapserver/client.go
+++ b/ldapserver/client.go
@@ -6,7 +6,7 @@ import (
"sync"
"time"
- ldap "github.com/lor00x/goldap/message"
+ ldap "bottin/goldap"
)
type UserState interface{}
@@ -206,10 +206,14 @@ func (c *client) close() {
}
func (c *client) writeMessage(m *ldap.LDAPMessage) {
- data, _ := m.Write()
+ data, err := m.Write()
+ if err != nil {
+ Logger.Errorf("bottin: unable to marshal response message: %v", err)
+ }
//Logger.Printf(">>> %d - %s - hex=%x", c.Numero, m.ProtocolOpName(), data.Bytes())
Logger.Tracef(">>> [%d] %#v", c.Numero, m)
+ Logger.Tracef("%v", data.Bytes())
c.bw.Write(data.Bytes())
c.bw.Flush()
diff --git a/ldapserver/constants.go b/ldapserver/constants.go
index de6d229..a04ca43 100644
--- a/ldapserver/constants.go
+++ b/ldapserver/constants.go
@@ -1,6 +1,6 @@
package ldapserver
-import ldap "github.com/lor00x/goldap/message"
+import ldap "bottin/goldap"
// LDAP Application Codes
const (
diff --git a/ldapserver/message.go b/ldapserver/message.go
index f6e609f..7033e06 100644
--- a/ldapserver/message.go
+++ b/ldapserver/message.go
@@ -3,7 +3,7 @@ package ldapserver
import (
"fmt"
- ldap "github.com/lor00x/goldap/message"
+ ldap "bottin/goldap"
)
type Message struct {
diff --git a/ldapserver/packet.go b/ldapserver/packet.go
index 77b4926..a60a44a 100644
--- a/ldapserver/packet.go
+++ b/ldapserver/packet.go
@@ -5,7 +5,7 @@ import (
"errors"
"fmt"
- ldap "github.com/lor00x/goldap/message"
+ ldap "bottin/goldap"
)
type messagePacket struct {
@@ -141,6 +141,7 @@ func readBytes(conn *bufio.Reader, bytes *[]byte, length int) (b byte, err error
if n != length {
fmt.Errorf("%d bytes read instead of %d", n, length)
} else if err != nil {
+ fmt.Println("ooopsie an error occured here:", err)
return
}
*bytes = append(*bytes, newbytes...)
diff --git a/ldapserver/responsemessage.go b/ldapserver/responsemessage.go
index 23527b9..9dc0406 100644
--- a/ldapserver/responsemessage.go
+++ b/ldapserver/responsemessage.go
@@ -1,6 +1,6 @@
package ldapserver
-import ldap "github.com/lor00x/goldap/message"
+import ldap "bottin/goldap"
func NewBindResponse(resultCode int) ldap.BindResponse {
r := ldap.BindResponse{}
diff --git a/ldapserver/route.go b/ldapserver/route.go
index dfd5240..3ba5618 100644
--- a/ldapserver/route.go
+++ b/ldapserver/route.go
@@ -3,7 +3,7 @@ package ldapserver
import (
"strings"
- ldap "github.com/lor00x/goldap/message"
+ ldap "bottin/goldap"
)
// Constant to LDAP Request protocol Type names