diff --git a/handler.go b/handler.go index c13bba2..e379d2e 100644 --- a/handler.go +++ b/handler.go @@ -24,6 +24,8 @@ type Handler interface { ModifyDN(*Conn, *Message, *ModifyDNRequest) // Perform a Search request Search(*Conn, *Message, *SearchRequest) + // Handle unrecognized requests + Other(*Conn, *Message) } // Basic server functionality. @@ -104,3 +106,7 @@ func (*BaseHandler) StartTLS(conn *Conn, msg *Message) { } conn.SendResult(msg.MessageID, nil, TypeExtendedResponseOp, &res) } + +func (*BaseHandler) Other(conn *Conn, msg *Message) { + conn.SendResult(msg.MessageID, nil, BerTypeSequence, UnsupportedOperation) +} diff --git a/server.go b/server.go index 1f67344..9fa6272 100644 --- a/server.go +++ b/server.go @@ -246,6 +246,6 @@ func (s *LDAPServer) handleMessage(conn *Conn, msg *Message) { conn.Close() default: log.Println("Unknown operation type:", msg.ProtocolOp.Type) - conn.SendResult(msg.MessageID, nil, BerTypeSequence, UnsupportedOperation) + s.Handler.Other(conn, msg) } }