From 8e4537d2ef7cad3428d1ca668568d928f2a472d3 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sun, 26 Jan 2020 21:03:18 +0100 Subject: Fixes --- main.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 26d46b3..d55601b 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main -// @FIXME: Panics if invalid keys are in consul (consulToDN in util.go) +// @FIXME: Auto populate entryuuid creatorsname createtimestamp modifiersname modifytimestamp (uuid: github.com/google/uuid, timestamps: 20060102150405Z) +// @FIXME: Use memberof and not memberOf // @FIXME: Implement missing search filters (in applyFilter) // @FIXME: Add an initial prefix to the consul key value @@ -112,6 +113,8 @@ func readConfig() Config { } func main() { + flag.Parse() + ldap.Logger = log.New(os.Stdout, "[ldapserver] ", log.LstdFlags) config := readConfig() @@ -739,7 +742,10 @@ func (server *Server) handleDeleteInternal(state *State, r *message.DelRequest) return ldap.LDAPResultNoSuchObject, fmt.Errorf("Not found: %s", dn) } for _, item := range items { - itemDN, _ := consulToDN(item.Key) + itemDN, _, err := consulToDN(item.Key) + if err != nil { + continue + } if itemDN != dn { return ldap.LDAPResultNotAllowedOnNonLeaf, fmt.Errorf( "Cannot delete %d as it has children", dn) @@ -833,7 +839,10 @@ func (server *Server) handleModifyInternal(state *State, r *message.ModifyReques prevEntry := Entry{} for _, item := range items { - itemDN, attr := consulToDN(item.Key) + itemDN, attr, err := consulToDN(item.Key) + if err != nil { + continue + } if itemDN != dn { panic("itemDN != dn in handleModifyInternal") } -- cgit v1.2.3