func handleExtended(w ldap.ResponseWriter, m *ldap.Message) { r := m.GetExtendedRequest() log.Printf("Extended request received, name=%s", r.GetResponseName()) log.Printf("Extended request received, value=%x", r.GetResponseValue()) res := ldap.NewExtendedResponse(ldap.LDAPResultSuccess) w.Write(res) }
func handleStartTLS(w ldap.ResponseWriter, m *ldap.Message) { tlsconfig, _ := getTLSconfig() tlsConn := tls.Server(m.Client.GetConn(), tlsconfig) res := ldap.NewExtendedResponse(ldap.LDAPResultSuccess) res.ResponseName = ldap.NoticeOfStartTLS w.Write(res) if err := tlsConn.Handshake(); err != nil { log.Printf("StartTLS Handshake error %v", err) res.DiagnosticMessage = fmt.Sprintf("StartTLS Handshake error : \"%s\"", err.Error()) res.ResultCode = ldap.LDAPResultOperationsError w.Write(res) return } m.Client.SetConn(tlsConn) log.Println("StartTLS OK") }
func handleWhoAmI(w ldap.ResponseWriter, m *ldap.Message) { res := ldap.NewExtendedResponse(ldap.LDAPResultSuccess) w.Write(res) }