예제 #1
0
func (d *DefaultsBackend) startTLS(w ldap.ResponseWriter, m *ldap.Message) {
	tlsconfig, _ := d.getTLSconfig()
	tlsConn := tls.Server(m.Client.GetConn(), tlsconfig)
	res := ldap.NewExtendedResponse(ldap.LDAPResultSuccess)
	res.SetResponseName(ldap.NoticeOfStartTLS)
	w.Write(res)

	if err := tlsConn.Handshake(); err != nil {
		d.Log.Error("StartTLS Handshake error", log.Ctx{"error": err})
		res.SetDiagnosticMessage(fmt.Sprintf("StartTLS Handshake error : \"%s\"", err.Error()))
		res.SetResultCode(ldap.LDAPResultOperationsError)
		w.Write(res)
		return
	}

	m.Client.SetConn(tlsConn)
	d.Log.Debug("StartTLS OK")
}
예제 #2
0
func (d *DebugBackend) Extended(w ldap.ResponseWriter, m *ldap.Message) {
	r := m.GetExtendedRequest()
	dump(r)
	res := ldap.NewExtendedResponse(ldap.LDAPResultSuccess)
	w.Write(res)
}
예제 #3
0
func (l *LdifBackend) Extended(w ldap.ResponseWriter, m *ldap.Message) {
	r := m.GetExtendedRequest()
	l.Log.Debug("Extended request received", log.Ctx{"name": r.RequestName(), "value": r.RequestValue()})
	res := ldap.NewExtendedResponse(ldap.LDAPResultSuccess)
	w.Write(res)
}